Skip to content

Commit

Permalink
Inline queue size method in fixed executor builder
Browse files Browse the repository at this point in the history
This commit inlines the queue size utility method in the fixed executor
builder as it was only used in one place.
  • Loading branch information
jasontedor committed Jun 2, 2016
1 parent 070e260 commit b2fb135
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ThreadPool.ExecutorHolder build(final FixedExecutorSettings settings, final Thre
final ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(EsExecutors.threadName(settings.nodeName, name()));
Executor executor = EsExecutors.newFixed(name(), size, queueSize, threadFactory, threadContext);
final ThreadPool.Info info =
new ThreadPool.Info(name(), ThreadPool.ThreadPoolType.FIXED, size, size, null, queueSizeValue(queueSize));
new ThreadPool.Info(name(), ThreadPool.ThreadPoolType.FIXED, size, size, null, queueSize < 0 ? null : new SizeValue(queueSize));
return new ThreadPool.ExecutorHolder(executor, info);
}

Expand All @@ -119,10 +119,6 @@ String formatInfo(ThreadPool.Info info) {
info.getQueueSize() == null ? "unbounded" : info.getQueueSize());
}

private static SizeValue queueSizeValue(int queueSize) {
return queueSize < 0 ? null : new SizeValue(queueSize);
}

static class FixedExecutorSettings extends ExecutorBuilder.ExecutorSettings {

private final int size;
Expand Down

0 comments on commit b2fb135

Please sign in to comment.