This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch jira/solr-13350-fixes-9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/jira/solr-13350-fixes-9x by
this push:
new 66c4d385c39 SOLR-13350: Trying the rejected execution handler for perf
benchmarking
66c4d385c39 is described below
commit 66c4d385c3994ed974f88021cbe02779359c0b44
Author: Ishan Chattopadhyaya <[email protected]>
AuthorDate: Wed Jun 26 04:39:41 2024 +0530
SOLR-13350: Trying the rejected execution handler for perf benchmarking
---
.../core/src/java/org/apache/solr/core/CoreContainer.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index ed19d0fa0f1..918fe220ef4 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -450,8 +450,21 @@ public class CoreContainer {
this.collectorExecutor =
ExecutorUtil.newMDCAwareFixedThreadPool(
cfg.getIndexSearcherExecutorThreads(), // thread count
- cfg.getIndexSearcherExecutorThreads() * 1000, // queue size
+ cfg.getIndexSearcherExecutorThreads(), // queue size
new SolrNamedThreadFactory("searcherCollector"));
+
+ ((ExecutorUtil.MDCAwareThreadPoolExecutor)
collectorExecutor).setRejectedExecutionHandler(new RejectedExecutionHandler() {
+ @Override
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
+ if (!executor.isShutdown()) {
+ try {
+ executor.getQueue().put(r);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ });
+
}
@SuppressWarnings({"unchecked"})