Skip to content

Commit 48364c6

Browse files
committed
add comment
1 parent d53d5c3 commit 48364c6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/src/main/java/org/elasticsearch/common/util/concurrent/EsExecutors.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ private void put(ThreadPoolExecutor executor, Runnable task) {
555555
if (probeWorkerPool && task == queue.peek()) { // referential equality
556556
// If the task is at the head of the queue, we can assume the queue was previously empty. In this case available workers
557557
// might have timed out in the meanwhile. To prevent the task from starving, we submit a noop probe to the executor.
558+
// Note, this deliberately doesn't check getPoolSize()==0 to avoid potential race conditions,
559+
// as the count in the atomic state (used by workerCountOf) is decremented first.
558560
executor.execute(EsThreadPoolExecutor.WORKER_PROBE);
559561
}
560562
} catch (final InterruptedException e) {

0 commit comments

Comments
 (0)