Skip to content

Commit

Permalink
#161- Add a timeout toe SolrQueuedThreadPool.
Browse files Browse the repository at this point in the history
  • Loading branch information
markrmiller committed Jul 15, 2020
1 parent 738556b commit cbf2e16
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.Closeable;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit;

import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.common.util.SolrNamedThreadFactory;
Expand Down Expand Up @@ -67,7 +68,11 @@ protected void runJob(Runnable job) {
// }

public void close() {
TimeOut timeout = new TimeOut(5, TimeUnit.SECONDS, TimeSource.NANO_TIME);
while (getBusyThreads() != 0) {
if (timeout.hasTimedOut()) {
throw new RuntimeException("Timed out waiting for SolrQueuedThreadPool to close");
}
try {
synchronized (notify) {
notify.wait(500);
Expand Down

0 comments on commit cbf2e16

Please sign in to comment.