add "same" thread pool type (really, just for testing)

This commit is contained in:
kimchy 2011-02-18 07:59:14 +02:00
parent 585c310aa4
commit 9ac048c68c
1 changed files with 4 additions and 1 deletions

View File

@ -137,7 +137,10 @@ public class ThreadPool extends AbstractComponent {
} }
String type = settings.get("type", defaultType); String type = settings.get("type", defaultType);
ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[" + name + "]"); ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[" + name + "]");
if ("cached".equals(type)) { if ("same".equals(type)) {
logger.debug("creating thread_pool [{}], type [{}]", name, type);
return MoreExecutors.sameThreadExecutor();
} else if ("cached".equals(type)) {
TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5))); TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
logger.debug("creating thread_pool [{}], type [{}], keep_alive [{}]", name, type, keepAlive); logger.debug("creating thread_pool [{}], type [{}], keep_alive [{}]", name, type, keepAlive);
return new ThreadPoolExecutor(0, Integer.MAX_VALUE, return new ThreadPoolExecutor(0, Integer.MAX_VALUE,