Thread Pool: Add a dedicated thread pool for refresh, closes #1624.

This commit is contained in:
Shay Banon 2012-01-19 00:22:27 +02:00
parent d95783b158
commit 2eeb609353
3 changed files with 4 additions and 2 deletions

View File

@ -63,7 +63,7 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
@Override @Override
protected String executor() { protected String executor() {
return ThreadPool.Names.MANAGEMENT; return ThreadPool.Names.REFRESH;
} }
@Override @Override

View File

@ -739,7 +739,7 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
} }
return; return;
} }
threadPool.cached().execute(new Runnable() { threadPool.executor(ThreadPool.Names.REFRESH).execute(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {

View File

@ -62,6 +62,7 @@ public class ThreadPool extends AbstractComponent {
public static final String PERCOLATE = "percolate"; public static final String PERCOLATE = "percolate";
public static final String MANAGEMENT = "management"; public static final String MANAGEMENT = "management";
public static final String MERGE = "merge"; public static final String MERGE = "merge";
public static final String REFRESH = "refresh";
public static final String SNAPSHOT = "snapshot"; public static final String SNAPSHOT = "snapshot";
} }
@ -88,6 +89,7 @@ public class ThreadPool extends AbstractComponent {
executors.put(Names.PERCOLATE, build(Names.PERCOLATE, "cached", groupSettings.get(Names.PERCOLATE), ImmutableSettings.Builder.EMPTY_SETTINGS)); executors.put(Names.PERCOLATE, build(Names.PERCOLATE, "cached", groupSettings.get(Names.PERCOLATE), ImmutableSettings.Builder.EMPTY_SETTINGS));
executors.put(Names.MANAGEMENT, build(Names.MANAGEMENT, "scaling", groupSettings.get(Names.MANAGEMENT), settingsBuilder().put("keep_alive", "5m").put("size", 20).build())); executors.put(Names.MANAGEMENT, build(Names.MANAGEMENT, "scaling", groupSettings.get(Names.MANAGEMENT), settingsBuilder().put("keep_alive", "5m").put("size", 20).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.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.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), ImmutableSettings.Builder.EMPTY_SETTINGS)); executors.put(Names.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), ImmutableSettings.Builder.EMPTY_SETTINGS));
executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(Names.SAME, "same"))); executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(Names.SAME, "same")));
this.executors = ImmutableMap.copyOf(executors); this.executors = ImmutableMap.copyOf(executors);