mirror of https://github.com/apache/lucene.git
if a task is rejected, decrement semaphore
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1385012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a215370b3a
commit
8ca9758dc4
|
@ -29,6 +29,7 @@ import java.util.concurrent.CompletionService;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorCompletionService;
|
import java.util.concurrent.ExecutorCompletionService;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
|
@ -353,7 +354,12 @@ public class SolrCmdDistributor {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Update thread interrupted", e);
|
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Update thread interrupted", e);
|
||||||
}
|
}
|
||||||
pending.add(completionService.submit(task));
|
try {
|
||||||
|
pending.add(completionService.submit(task));
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
semaphore.release();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue