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.
This commit is contained in:
Jason Tedor 2016-04-24 09:49:15 -04:00
parent d032de2df2
commit e6a06b272e
2 changed files with 3 additions and 2 deletions

View File

@ -525,7 +525,7 @@ public class ThreadPool extends AbstractComponent implements Closeable {
int defaultSize = defaultSettings.getAsInt("size", EsExecutors.boundedNumberOfProcessors(settings)); int defaultSize = defaultSettings.getAsInt("size", EsExecutors.boundedNumberOfProcessors(settings));
final Integer queueSize = settings.getAsInt("queue_size", defaultSettings.getAsInt("queue_size", null)); final Integer queueSize = settings.getAsInt("queue_size", defaultSettings.getAsInt("queue_size", null));
if (queueSize != 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 (previousExecutorHolder != null) {
if (ThreadPoolType.SCALING == previousInfo.getThreadPoolType()) { if (ThreadPoolType.SCALING == previousInfo.getThreadPoolType()) {

View File

@ -212,7 +212,8 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase {
IllegalArgumentException.class, IllegalArgumentException.class,
() -> clusterSettings.applySettings(settings("threadpool." + threadPoolName + ".queue_size", size))); () -> clusterSettings.applySettings(settings("threadpool." + threadPoolName + ".queue_size", size)));
assertThat(e, hasToString( 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 + "]")); size + "]"));
}); });
} }