when thread pool queue size is negative use unbounded queue
This commit is contained in:
parent
5f9581d4f0
commit
9d0ce1b1d3
|
@ -479,7 +479,9 @@ public class ThreadPool extends AbstractComponent {
|
||||||
private BlockingQueue<Runnable> newQueue(SizeValue queueSize, String queueType) {
|
private BlockingQueue<Runnable> newQueue(SizeValue queueSize, String queueType) {
|
||||||
if (queueSize == null) {
|
if (queueSize == null) {
|
||||||
return ConcurrentCollections.newBlockingQueue();
|
return ConcurrentCollections.newBlockingQueue();
|
||||||
} else if ((int) queueSize.singles() > 0) {
|
} else if (queueSize.singles() == 0) {
|
||||||
|
return new SynchronousQueue<Runnable>();
|
||||||
|
} else if (queueSize.singles() > 0) {
|
||||||
if ("linked".equals(queueType)) {
|
if ("linked".equals(queueType)) {
|
||||||
return new LinkedBlockingQueue<Runnable>((int) queueSize.singles());
|
return new LinkedBlockingQueue<Runnable>((int) queueSize.singles());
|
||||||
} else if ("array".equals(queueType)) {
|
} else if ("array".equals(queueType)) {
|
||||||
|
@ -487,8 +489,8 @@ public class ThreadPool extends AbstractComponent {
|
||||||
} else {
|
} else {
|
||||||
throw new ElasticSearchIllegalArgumentException("illegal queue_type set to [" + queueType + "], should be either linked or array");
|
throw new ElasticSearchIllegalArgumentException("illegal queue_type set to [" + queueType + "], should be either linked or array");
|
||||||
}
|
}
|
||||||
} else {
|
} else { // queueSize.singles() < 0, just treat it as unbounded queue
|
||||||
return new SynchronousQueue<Runnable>();
|
return ConcurrentCollections.newBlockingQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue