@@ -159,7 +159,7 @@ public static EsThreadPoolExecutor newScaling(
159159 * Creates a scaling {@link EsThreadPoolExecutor} using an unbounded work queue.
160160 * <p>
161161 * The {@link EsThreadPoolExecutor} scales the same way as a regular {@link ThreadPoolExecutor} until the core pool size
162- * (and at least 1) is reached: each time a task is submitted a new worker is added.
162+ * (and at least 1) is reached: each time a task is submitted a new worker is added regardless if an idle worker is available .
163163 * <p>
164164 * Once having reached the core pool size, a {@link ThreadPoolExecutor} will only add a new worker if the work queue rejects
165165 * a task offer. Typically, using a regular unbounded queue, task offers won't ever be rejected, meaning the worker pool would never
@@ -449,6 +449,12 @@ private static <E> LinkedTransferQueue<E> newUnboundedScalingLTQueue(int corePoo
449449 * For that reason {@link ExecutorScalingQueue} cannot be used with executors with empty core and max pool size of 1:
450450 * the only available worker could time out just about at the same time as the task is appended, see
451451 * <a href="https://github.com/elastic/elasticsearch/issues/124667">Github #124667</a> for more details.
452+ * <p>
453+ * Note, configuring executors using core = max size in combination with {@code allowCoreThreadTimeOut} could be an alternative to
454+ * {@link ExecutorScalingQueue}. However, the scaling behavior would be very different: Using {@link ExecutorScalingQueue}
455+ * we are able to reuse idle workers if available by means of {@link ExecutorScalingQueue#tryTransfer(Object)}.
456+ * If setting core = max size, the executor will add a new worker for every task submitted until reaching the core/max pool size
457+ * even if there's idle workers available.
452458 */
453459 static class ExecutorScalingQueue <E > extends LinkedTransferQueue <E > {
454460
0 commit comments