Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

set the thread name during solr queries to the solr query to get better debugging options

Michael Peter Christen900445d8e9ef
diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
index d7325dfea..040ef9813 100644
--- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
+++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
@@ -172,7 +172,13 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
public QueryResponse query(ModifiableSolrParams params) throws IOException {
if (this.server == null) throw new IOException("server disconnected");
try {
- return this.server.query(params);
+ // during the solr query we set the thread name to the query string to get more debugging info in thread dumps
+ String q = params.get("q");
+ String threadname = Thread.currentThread().getName();
+ if (q != null) Thread.currentThread().setName("solr query: q = " + q);
+ QueryResponse rsp = this.server.query(params);
+ if (q != null) Thread.currentThread().setName(threadname);
+ return rsp;
} catch (SolrServerException e) {
throw new IOException(e);
} catch (Throwable e) {