本文整理了Java中org.elasticsearch.threadpool.ThreadPool.terminate()
方法的一些代码示例,展示了ThreadPool.terminate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPool.terminate()
方法的具体详情如下:
包路径:org.elasticsearch.threadpool.ThreadPool
类名称:ThreadPool
方法名:terminate
[英]Returns true
if the given service was terminated successfully. If the termination timed out, the service is null
this method will return false
.
[中]如果给定服务已成功终止,则返回true
。如果终止超时,服务为null
,此方法将返回false
。
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
protected synchronized void doStop() {
ThreadPool.terminate(threadPoolExecutor, 10, TimeUnit.SECONDS);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void close() {
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
Releasables.close(activePingingRounds.values());
closed = true;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Closes the client.
*/
@Override
public void close() {
List<Closeable> closeables = new ArrayList<>();
closeables.add(nodesService);
closeables.add(injector.getInstance(TransportService.class));
for (LifecycleComponent plugin : pluginLifecycleComponents) {
closeables.add(plugin);
}
closeables.add(() -> ThreadPool.terminate(injector.getInstance(ThreadPool.class), 10, TimeUnit.SECONDS));
closeables.add(injector.getInstance(PageCacheRecycler.class));
IOUtils.closeWhileHandlingException(closeables);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@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);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
final List<Closeable> resourcesToClose = new ArrayList<>();
final ThreadPool threadPool = new ThreadPool(settings);
resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
final NetworkService networkService = new NetworkService(Collections.emptyList());
try {
代码示例来源:origin: harbby/presto-connectors
@Override
public void close() {
ThreadPool.terminate(concurrentStreamPool, 1, TimeUnit.SECONDS);
ThreadPool.terminate(concurrentSmallFileStreamPool, 1, TimeUnit.SECONDS);
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
public static boolean terminate(ExecutorService... services) throws InterruptedException {
boolean terminated = true;
for (ExecutorService service : services) {
if (service != null) {
terminated &= ThreadPool.terminate(service, 10, TimeUnit.SECONDS);
}
}
return terminated;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
protected synchronized void doStop() {
ThreadPool.terminate(threadPoolExecutor, 10, TimeUnit.SECONDS);
}
代码示例来源:origin: harbby/presto-connectors
@Override
protected void doClose() {
ThreadPool.terminate(workers, 10, TimeUnit.SECONDS);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
protected void doClose() {
ThreadPool.terminate(workers, 10, TimeUnit.SECONDS);
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
@Override
protected void stopInternal() {
ThreadPool.terminate(executor, 10, TimeUnit.SECONDS);
synchronized (openChannels) {
assert openChannels.isEmpty() : "there are still open channels: " + openChannels;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public void close() {
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
Releasables.close(activePingingRounds.values());
closed = true;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public void close() {
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
Releasables.close(activePingingRounds.values());
closed = true;
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
@Override
public void tearDown() throws Exception {
try {
ThreadPool.terminate(threadPool, 30, TimeUnit.SECONDS);
} finally {
super.tearDown();
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public void close() {
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
Releasables.close(activePingingRounds.values());
closed = true;
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
@Override
public void close() {
try {
ThreadPool.terminate(threadPool(), 10, TimeUnit.SECONDS);
} catch (Exception e) {
throw new ElasticsearchException(e.getMessage(), e);
}
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Closes the client.
*/
@Override
public void close() {
List<Closeable> closeables = new ArrayList<>();
closeables.add(nodesService);
closeables.add(injector.getInstance(TransportService.class));
for (LifecycleComponent plugin : pluginLifecycleComponents) {
closeables.add(plugin);
}
closeables.add(() -> ThreadPool.terminate(injector.getInstance(ThreadPool.class), 10, TimeUnit.SECONDS));
closeables.add(injector.getInstance(BigArrays.class));
IOUtils.closeWhileHandlingException(closeables);
}
代码示例来源:origin: harbby/presto-connectors
@Override
protected void doClose() {
transportService.removeHandler(ACTION_NAME);
ThreadPool.terminate(unicastConnectExecutor, 0, TimeUnit.SECONDS);
try {
IOUtils.close(receivedResponses.values());
} catch (IOException e) {
throw new ElasticsearchException("Error wile closing send ping handlers", e);
}
closed = true;
}
代码示例来源:origin: harbby/presto-connectors
@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);
}
内容来源于网络,如有侵权,请联系作者删除!