From 900445d8e9efaf63bbbd98f5840826c6c139ef21 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 6 Nov 2012 11:48:04 +0100 Subject: [PATCH] set the thread name during solr queries to the solr query to get better debugging options --- .../federate/solr/connector/EmbeddedSolrConnector.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) {