mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
[ThreadPool] Use DirectExecutor instead of deprecated API
Guava deprecated MoreExecutors#sameThreadExecutor in favour of a more efficient implemenation. We should move over to the new impl.
This commit is contained in:
parent
4638d23484
commit
cb839b56b2
@ -286,7 +286,7 @@ public class ThreadPool extends AbstractComponent {
|
||||
} else {
|
||||
logger.debug("creating thread_pool [{}], type [{}]", name, type);
|
||||
}
|
||||
return new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(name, type));
|
||||
return new ExecutorHolder(MoreExecutors.directExecutor(), new Info(name, type));
|
||||
} else if ("cached".equals(type)) {
|
||||
TimeValue defaultKeepAlive = defaultSettings.getAsTime("keep_alive", timeValueMinutes(5));
|
||||
if (previousExecutorHolder != null) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.threadpool;
|
||||
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
@ -61,7 +62,7 @@ public class UpdateThreadPoolSettingsTests extends ElasticsearchTestCase {
|
||||
// Replace with different type
|
||||
threadPool.updateSettings(settingsBuilder().put("threadpool.search.type", "same").build());
|
||||
assertThat(info(threadPool, Names.SEARCH).getType(), equalTo("same"));
|
||||
assertThat(threadPool.executor(Names.SEARCH), instanceOf(ListeningExecutorService.class));
|
||||
assertThat(threadPool.executor(Names.SEARCH), instanceOf(MoreExecutors.directExecutor().getClass()));
|
||||
|
||||
// Replace with different type again
|
||||
threadPool.updateSettings(settingsBuilder()
|
||||
|
Loading…
x
Reference in New Issue
Block a user