Add `cache` thread pool to handle cache loading of async caches (bloom filter), closes #1777.

This commit is contained in:
Shay Banon 2012-03-09 20:47:59 +02:00
parent c08b968246
commit b83378f4ce
2 changed files with 4 additions and 2 deletions

View File

@ -144,7 +144,7 @@ public class SimpleBloomCache extends AbstractIndexComponent implements BloomCac
filter.loading.set(true);
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
if (asyncLoad) {
threadPool.generic().execute(loader);
threadPool.executor(ThreadPool.Names.CACHE).execute(loader);
} else {
loader.run();
filter = fieldCache.get(fieldName);
@ -159,7 +159,7 @@ public class SimpleBloomCache extends AbstractIndexComponent implements BloomCac
// do the async loading
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
if (asyncLoad) {
threadPool.generic().execute(loader);
threadPool.executor(ThreadPool.Names.CACHE).execute(loader);
} else {
loader.run();
filter = fieldCache.get(fieldName);

View File

@ -66,6 +66,7 @@ public class ThreadPool extends AbstractComponent {
public static final String MANAGEMENT = "management";
public static final String FLUSH = "flush";
public static final String MERGE = "merge";
public static final String CACHE = "cache";
public static final String REFRESH = "refresh";
public static final String SNAPSHOT = "snapshot";
}
@ -96,6 +97,7 @@ public class ThreadPool extends AbstractComponent {
executors.put(Names.FLUSH, build(Names.FLUSH, "scaling", groupSettings.get(Names.FLUSH), settingsBuilder().put("keep_alive", "5m").put("size", 10).build()));
executors.put(Names.MERGE, build(Names.MERGE, "scaling", groupSettings.get(Names.MERGE), settingsBuilder().put("keep_alive", "5m").put("size", 20).build()));
executors.put(Names.REFRESH, build(Names.REFRESH, "cached", groupSettings.get(Names.REFRESH), settingsBuilder().put("keep_alive", "1m").build()));
executors.put(Names.CACHE, build(Names.CACHE, "scaling", groupSettings.get(Names.CACHE), settingsBuilder().put("keep_alive", "5m").put("size", 4).build()));
executors.put(Names.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), settingsBuilder().put("keep_alive", "5m").put("size", 5).build()));
executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(Names.SAME, "same")));
this.executors = ImmutableMap.copyOf(executors);