本文整理了Java中org.elasticsearch.threadpool.ThreadPool.shutdownNow()
方法的一些代码示例,展示了ThreadPool.shutdownNow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPool.shutdownNow()
方法的具体详情如下:
包路径:org.elasticsearch.threadpool.ThreadPool
类名称:ThreadPool
方法名:shutdownNow
暂无
代码示例来源:origin: dadoonet/fscrawler
@Override
public void close() throws IOException {
logger.debug("Closing Elasticsearch client manager");
if (bulkProcessor != null) {
try {
bulkProcessor.awaitClose(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
logger.warn("Did not succeed in closing the bulk processor for documents", e);
throw new IOException(e);
}
}
if (threadPool != null) {
threadPool.shutdownNow();
}
if (lowLevelClient != null) {
lowLevelClient.close();
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
if (pool != null) {
try {
pool.shutdown();
if (awaitTermination(pool, timeout, timeUnit)) {
return true;
}
// last resort
pool.shutdownNow();
return awaitTermination(pool, timeout, timeUnit);
} finally {
IOUtils.closeWhileHandlingException(pool);
}
}
return false;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
toClose.add(() -> injector.getInstance(ThreadPool.class).shutdownNow());
toClose.add(() -> stopWatch.stop());
代码示例来源:origin: fr.pilato.elasticsearch.crawler/fscrawler-elasticsearch-client-v5
@Override
public void close() throws IOException {
logger.debug("Closing Elasticsearch client manager");
if (bulkProcessor != null) {
try {
bulkProcessor.awaitClose(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
logger.warn("Did not succeed in closing the bulk processor for documents", e);
throw new IOException(e);
}
}
if (threadPool != null) {
threadPool.shutdownNow();
}
if (lowLevelClient != null) {
lowLevelClient.close();
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
if (pool != null) {
pool.shutdown();
try {
if (pool.awaitTermination(timeout, timeUnit)) {
return true;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
// last resort
pool.shutdownNow();
}
return false;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
if (pool != null) {
try {
pool.shutdown();
if (awaitTermination(pool, timeout, timeUnit)) return true;
// last resort
pool.shutdownNow();
return awaitTermination(pool, timeout, timeUnit);
} finally {
IOUtils.closeWhileHandlingException(pool);
}
}
return false;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
if (pool != null) {
try {
pool.shutdown();
if (awaitTermination(pool, timeout, timeUnit)) {
return true;
}
// last resort
pool.shutdownNow();
return awaitTermination(pool, timeout, timeUnit);
} finally {
IOUtils.closeWhileHandlingException(pool);
}
}
return false;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
if (pool != null) {
try {
pool.shutdown();
if (awaitTermination(pool, timeout, timeUnit)) {
return true;
}
// last resort
pool.shutdownNow();
return awaitTermination(pool, timeout, timeUnit);
} finally {
IOUtils.closeWhileHandlingException(pool);
}
}
return false;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
toClose.add(() -> injector.getInstance(ThreadPool.class).shutdownNow());
toClose.add(() -> stopWatch.stop());
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
toClose.add(() -> injector.getInstance(ThreadPool.class).shutdownNow());
toClose.add(() -> stopWatch.stop());
代码示例来源:origin: apache/servicemix-bundles
toClose.add(() -> injector.getInstance(ThreadPool.class).shutdownNow());
toClose.add(() -> stopWatch.stop());
代码示例来源:origin: org.fusesource.insight/insight-elasticsearch
injector.getInstance(ThreadPool.class).shutdownNow();
} catch (Exception e) {
代码示例来源:origin: harbby/presto-connectors
injector.getInstance(ThreadPool.class).shutdownNow();
} catch (Exception e) {
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch
injector.getInstance(ThreadPool.class).shutdownNow();
} catch (Exception e) {
内容来源于网络,如有侵权,请联系作者删除!