cpoerschke commented on a change in pull request #227:
URL: https://github.com/apache/solr/pull/227#discussion_r673293571
##########
File path: solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
##########
@@ -148,6 +148,8 @@ public static ExecutorService
newMDCAwareCachedThreadPool(int maxThreads, Thread
threadFactory);
}
+ public final static ThreadLocal<Exception> submitter = new ThreadLocal<>();
Review comment:
```suggestion
final static ThreadLocal<Exception> submitter = new ThreadLocal<>();
```
##########
File path: solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
##########
@@ -196,7 +198,13 @@ public void execute(final Runnable command) {
String ctxStr = contextString.toString().replace("/", "//");
final String submitterContextStr = ctxStr.length() <=
MAX_THREAD_NAME_LEN ? ctxStr : ctxStr.substring(0, MAX_THREAD_NAME_LEN);
- final Exception submitterStackTrace = enableSubmitterStackTrace ? new
Exception("Submitter stack trace") : null;
+ final Exception submitterStackTrace;
+ if (enableSubmitterStackTrace) {
+ Exception grandParentSubmitter = submitter.get();
+ submitterStackTrace = new Exception("Submitter stack trace",
grandParentSubmitter);
Review comment:
Could we have a comment (or rename) w.r.t. the `grandParent` bit here?
At a glance `parent` is intuitive with the `get/construct/set` pattern. On
second glance it seems the current method executes the `submitter.set` call in
a pool, making this method the "parent" relative to the pool execution and the
`submitter.get` result the "parent" relative to this method but the "grand
parent" relative to the method that will run in the pool. Is that it, more or
less?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]