Skip to content

Commit

Permalink
Distinguished solr connectors thread names for easier monitoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
luccioman committed Feb 3, 2017
1 parent f6ad927 commit 9a5a124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -206,7 +206,7 @@ public SolrQueryResponse query(SolrQueryRequest req) throws SolrException {
// during the solr query we set the thread name to the query string to get more debugging info in thread dumps
String threadname = Thread.currentThread().getName();
String ql = ""; try {ql = URLDecoder.decode(req.getParams().toString(), StandardCharsets.UTF_8.name());} catch (UnsupportedEncodingException e) {}
Thread.currentThread().setName("solr query: " + ql); // for debugging in Threaddump
Thread.currentThread().setName("Embedded solr query: " + ql); // for debugging in Threaddump
ConcurrentLog.fine("EmbeddedSolrConnector.query", "QUERY: " + ql);

SolrQueryResponse rsp = new SolrQueryResponse();
Expand Down Expand Up @@ -331,7 +331,7 @@ public QueryResponse getResponseByParams(ModifiableSolrParams params) throws IOE
// during the solr query we set the thread name to the query string to get more debugging info in thread dumps
String threadname = Thread.currentThread().getName();
String ql = ""; try {ql = URLDecoder.decode(params.toString(), StandardCharsets.UTF_8.name());} catch (UnsupportedEncodingException e) {}
Thread.currentThread().setName("solr query: q=" + ql);
Thread.currentThread().setName("Embedded.getResponseByParams solr query: q=" + ql);
ConcurrentLog.info("EmbeddedSolrConnector.getResponseByParams", "QUERY: " + ql);
//System.out.println("EmbeddedSolrConnector.getResponseByParams * QUERY: " + ql); System.out.println("STACKTRACE: " + ConcurrentLog.stackTrace());
QueryResponse rsp;
Expand Down Expand Up @@ -365,7 +365,7 @@ public SolrDocumentList getDocumentListByParams(ModifiableSolrParams params) thr
String sort = params.get(CommonParams.SORT);
String threadname = Thread.currentThread().getName();
try {
if (q != null) Thread.currentThread().setName("solr query: q = " + q + (fq == null ? "" : ", fq = " + fq) + (sort == null ? "" : ", sort = " + sort)); // for debugging in Threaddump
if (q != null) Thread.currentThread().setName("Embedded.getDocumentListByParams solr query: q = " + q + (fq == null ? "" : ", fq = " + fq) + (sort == null ? "" : ", sort = " + sort)); // for debugging in Threaddump
response = this.query(req);
if (q != null) Thread.currentThread().setName(threadname);
if (response == null) throw new IOException("response == null");
Expand Down
Expand Up @@ -102,7 +102,7 @@ public QueryResponse getResponseByParams(ModifiableSolrParams params) throws IOE
String q = params.get(CommonParams.Q);
String fq = params.get(CommonParams.FQ);
String threadname = Thread.currentThread().getName();
if (q != null) Thread.currentThread().setName("solr query: q = " + q + (fq == null ? "" : ", fq = " + fq));
if (q != null) Thread.currentThread().setName("Remote solr query: q = " + q + (fq == null ? "" : ", fq = " + fq));

QueryRequest request = new QueryRequest(params);
ResponseParser responseParser = useBinaryResponseWriter ? new BinaryResponseParser() : new XMLResponseParser();
Expand Down

0 comments on commit 9a5a124

Please sign in to comment.