From e6a06b272e23d1abf07f2b9b8bc74fd195b94dd4 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sun, 24 Apr 2016 09:49:15 -0400 Subject: [PATCH] Clarify message on resize scaling executor queues This commit clarifies an error message that is produced when an attempt is made to resize the backing queue for a scaling executor. As this queue is unbounded, resizing the backing queue does not make sense. The clarification here is to specify that this restriction is because the executor is a scaling executor. --- .../src/main/java/org/elasticsearch/threadpool/ThreadPool.java | 2 +- .../org/elasticsearch/threadpool/ScalingThreadPoolTests.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index 9e95299c159..1f5baec1040 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -525,7 +525,7 @@ public class ThreadPool extends AbstractComponent implements Closeable { int defaultSize = defaultSettings.getAsInt("size", EsExecutors.boundedNumberOfProcessors(settings)); final Integer queueSize = settings.getAsInt("queue_size", defaultSettings.getAsInt("queue_size", null)); if (queueSize != null) { - throw new IllegalArgumentException("thread pool [" + name + "] can not have its queue re-sized but was [" + queueSize + "]"); + throw new IllegalArgumentException("thread pool [" + name + "] of type scaling can not have its queue re-sized but was [" + queueSize + "]"); } if (previousExecutorHolder != null) { if (ThreadPoolType.SCALING == previousInfo.getThreadPoolType()) { diff --git a/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java b/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java index e229b466ff7..a73ffdb2129 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java +++ b/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java @@ -212,7 +212,8 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase { IllegalArgumentException.class, () -> clusterSettings.applySettings(settings("threadpool." + threadPoolName + ".queue_size", size))); assertThat(e, hasToString( - "java.lang.IllegalArgumentException: thread pool [" + threadPoolName + "] can not have its queue re-sized but was [" + + "java.lang.IllegalArgumentException: thread pool [" + threadPoolName + + "] of type scaling can not have its queue re-sized but was [" + size + "]")); }); }