當前位置: 首頁>>代碼示例>>Java>>正文


Java ThreadPool.terminate方法代碼示例

本文整理匯總了Java中org.elasticsearch.threadpool.ThreadPool.terminate方法的典型用法代碼示例。如果您正苦於以下問題:Java ThreadPool.terminate方法的具體用法?Java ThreadPool.terminate怎麽用?Java ThreadPool.terminate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.threadpool.ThreadPool的用法示例。


在下文中一共展示了ThreadPool.terminate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doStop

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
protected synchronized void doStop() {
    for (NotifyTimeout onGoingTimeout : onGoingTimeouts) {
        onGoingTimeout.cancel();
        try {
            onGoingTimeout.cancel();
            onGoingTimeout.listener.onClose();
        } catch (Exception ex) {
            logger.debug("failed to notify listeners on shutdown", ex);
        }
    }
    ThreadPool.terminate(threadPoolExecutor, 10, TimeUnit.SECONDS);
    // close timeout listeners that did not have an ongoing timeout
    timeoutClusterStateListeners.forEach(TimeoutClusterStateListener::onClose);
    removeListener(localNodeMasterListeners);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:ClusterService.java

示例2: tearDown

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
public void tearDown() throws Exception {
    try {
        ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
    } finally {
        super.tearDown();
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:IndexShardTestCase.java

示例3: doStop

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
protected void doStop() {
    FutureUtils.cancel(this.reconnectToNodes);
    for (NotifyTimeout onGoingTimeout : onGoingTimeouts) {
        onGoingTimeout.cancel();
        onGoingTimeout.listener.onClose();
    }
    ThreadPool.terminate(updateTasksExecutor, 10, TimeUnit.SECONDS);
    remove(localNodeMasterListeners);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:InternalClusterService.java

示例4: close

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
public void close() {
    try {
        ThreadPool.terminate(threadPool(), 10, TimeUnit.SECONDS);
    } catch (Exception e) {
        throw new ElasticsearchException(e.getMessage(), e);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:NoOpClient.java

示例5: tearDown

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
@After
public void tearDown() throws Exception {
    transportService.stop();
    ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
    threadPool = null;
    super.tearDown();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:NodeConnectionsServiceTests.java

示例6: destroyThreadPool

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@AfterClass
public static void destroyThreadPool() {
    ThreadPool.terminate(THREAD_POOL, 30, TimeUnit.SECONDS);
    // since static must set to null to be eligible for collection
    THREAD_POOL = null;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:7,代碼來源:TransportNodesActionTests.java

示例7: close

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
public void close() {
    ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
    Releasables.close(activePingingRounds.values());
    closed = true;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:7,代碼來源:UnicastZenPing.java

示例8: afterClass

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@AfterClass
public static void afterClass() {
    ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
    threadPool = null;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:6,代碼來源:NodeJoinControllerTests.java

示例9: shutdownThreadPool

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@AfterClass
public static void shutdownThreadPool() {
    ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
    threadPool = null;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:6,代碼來源:IndexShardOperationsLockTests.java

示例10: terminateThreadPool

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@AfterClass
public static void terminateThreadPool() {
    ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
    // since static must set to null to be eligible for collection
    threadPool = null;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:7,代碼來源:TransportServiceHandshakeTests.java

示例11: stopThreadPool

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@AfterClass
public static void stopThreadPool() {
    ThreadPool.terminate(THREAD_POOL, 30, TimeUnit.SECONDS);
    THREAD_POOL = null;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:6,代碼來源:ShardStateActionTests.java

示例12: doClose

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
protected void doClose() {
    ThreadPool.terminate(workers, 10, TimeUnit.SECONDS);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:5,代碼來源:LocalTransport.java

示例13: build

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
/**
 * Builds a new instance of the transport client.
 */
public TransportClient build() {
    Settings settings = InternalSettingsPreparer.prepareSettings(this.settings);
    settings = settingsBuilder()
            .put(NettyTransport.PING_SCHEDULE, "5s") // enable by default the transport schedule ping interval
            .put(settings)
            .put("network.server", false)
            .put("node.client", true)
            .put(CLIENT_TYPE_SETTING, CLIENT_TYPE)
            .build();

    PluginsService pluginsService = new PluginsService(settings, null, null, pluginClasses);
    this.settings = pluginsService.updatedSettings();

    Version version = Version.CURRENT;

    final ThreadPool threadPool = new ThreadPool(settings);
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();

    boolean success = false;
    try {
        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new Version.Module(version));
        // plugin modules must be added here, before others or we can get crazy injection errors...
        for (Module pluginModule : pluginsService.nodeModules()) {
            modules.add(pluginModule);
        }
        modules.add(new PluginsModule(pluginsService));
        modules.add(new SettingsModule(this.settings));
        modules.add(new NetworkModule(namedWriteableRegistry));
        modules.add(new ClusterNameModule(this.settings));
        modules.add(new ThreadPoolModule(threadPool));
        modules.add(new TransportModule(this.settings, namedWriteableRegistry));
        modules.add(new SearchModule() {
            @Override
            protected void configure() {
                // noop
            }
        });
        modules.add(new ActionModule(true));
        modules.add(new ClientTransportModule());
        modules.add(new CircuitBreakerModule(this.settings));

        pluginsService.processModules(modules);

        Injector injector = modules.createInjector();
        final TransportService transportService = injector.getInstance(TransportService.class);
        transportService.start();
        transportService.acceptIncomingRequests();

        TransportClient transportClient = new TransportClient(injector);
        success = true;
        return transportClient;
    } finally {
        if (!success) {
            ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:62,代碼來源:TransportClient.java

示例14: tearDown

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
public void tearDown() throws Exception {
    super.tearDown();
    ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:6,代碼來源:RemoteClusterServiceTests.java

示例15: close

import org.elasticsearch.threadpool.ThreadPool; //導入方法依賴的package包/類
@Override
public void close() {
    ThreadPool.terminate(concurrentStreamPool, 1, TimeUnit.SECONDS);
    ThreadPool.terminate(concurrentSmallFileStreamPool, 1, TimeUnit.SECONDS);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:6,代碼來源:RecoverySettings.java


注:本文中的org.elasticsearch.threadpool.ThreadPool.terminate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。