Skip to content

Commit

Permalink
#147 - Give core loading back it's own exec.
Browse files Browse the repository at this point in the history
  • Loading branch information
markrmiller committed Jul 14, 2020
1 parent 28f1bd3 commit 5df8928
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 21 additions & 2 deletions solr/core/src/java/org/apache/solr/core/CoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

Expand Down Expand Up @@ -188,7 +191,23 @@ public CoreLoadFailure(CoreDescriptor cd, Exception loadFailure) {
protected volatile ZkContainer zkSys = null;
protected volatile ShardHandlerFactory shardHandlerFactory;

protected volatile UpdateShardHandler updateShardHandler;
private volatile UpdateShardHandler updateShardHandler;

private final static ThreadPoolExecutor solrCoreLoadExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE,
3, TimeUnit.SECONDS,
new SynchronousQueue<>(),
new SolrNamedThreadFactory("SolrCoreLoader"));
static {
solrCoreLoadExecutor.setThreadFactory(new ThreadFactory() {
@Override
public Thread newThread(Runnable runnable) {
Thread t = new Thread(runnable);
t.setDaemon(true);
t.setName("SolrCoreLoader");
return t;
}
});
}

private final OrderedExecutor replayUpdatesExecutor;

Expand Down Expand Up @@ -872,7 +891,7 @@ public void load() {
}
if (cd.isLoadOnStartup()) {
ParWork.sizePoolByLoad();
futures.add(ParWork.getExecutor().submit(() -> {
futures.add(solrCoreLoadExecutor.submit(() -> {
SolrCore core;
try {
if (isZooKeeperAware()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public boolean reject(Thread t) {
if (threadName.startsWith("ConnnectionExpirer")) {
return true;
}

if (threadName.startsWith("SolrCoreLoader")) {
return true;
}



Expand Down

0 comments on commit 5df8928

Please sign in to comment.