Thread Pool: Blocking thread pool type configuration fails, closes #1321.

This commit is contained in:
Shay Banon 2011-09-11 01:06:57 +03:00
parent 8532dc84e9
commit e6f277474e
2 changed files with 16 additions and 2 deletions

View File

@ -38,3 +38,17 @@
# Unicast Discovery (disable multicast)
#discovery.zen.ping.multicast.enabled: false
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
threadpool:
search:
type: blocking
min: 5
max: 20
wait_time: 30s
keep_alive: 90s
index:
type: blocking
min: 3
max: 10
wait_time: 30s
keep_alive: 90s

View File

@ -195,9 +195,9 @@ public class ThreadPool extends AbstractComponent {
TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
int min = settings.getAsInt("min", defaultSettings.getAsInt("min", 1));
int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
SizeValue capacity = settings.getAsSize("capacity", defaultSettings.getAsSize("capacity", new SizeValue(0)));
SizeValue capacity = settings.getAsSize("queue_size", defaultSettings.getAsSize("queue_size", new SizeValue(1000)));
TimeValue waitTime = settings.getAsTime("wait_time", defaultSettings.getAsTime("wait_time", timeValueSeconds(60)));
logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], keep_alive [{}], wait_time [{}]", name, type, min, size, keepAlive, waitTime);
logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], queue_size [{}], keep_alive [{}], wait_time [{}]", name, type, min, size, capacity.singles(), keepAlive, waitTime);
return DynamicExecutors.newBlockingThreadPool(min, size, keepAlive.millis(), (int) capacity.singles(), waitTime.millis(), threadFactory);
}
throw new ElasticSearchIllegalArgumentException("No type found [" + type + "], for [" + name + "]");