org.elasticsearch.threadpool.ThreadPool.shutdown()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.elasticsearch.threadpool.ThreadPool.shutdown()方法的一些代码示例,展示了ThreadPool.shutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPool.shutdown()方法的具体详情如下:
包路径:org.elasticsearch.threadpool.ThreadPool
类名称:ThreadPool
方法名:shutdown

ThreadPool.shutdown介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

  1. /**
  2. * Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
  3. * the service is <code>null</code> this method will return <code>false</code>.
  4. */
  5. public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
  6. if (pool != null) {
  7. try {
  8. pool.shutdown();
  9. if (awaitTermination(pool, timeout, timeUnit)) {
  10. return true;
  11. }
  12. // last resort
  13. pool.shutdownNow();
  14. return awaitTermination(pool, timeout, timeUnit);
  15. } finally {
  16. IOUtils.closeWhileHandlingException(pool);
  17. }
  18. }
  19. return false;
  20. }

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

  1. @After
  2. @Override
  3. public void tearDown() throws Exception {
  4. super.tearDown();
  5. threadPool.shutdown();
  6. }

代码示例来源:origin: org.elasticsearch/elasticsearch

  1. toClose.add(() -> injector.getInstance(ThreadPool.class).shutdown());
  2. toClose.add(() -> {
  3. try {

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
  3. * the service is <code>null</code> this method will return <code>false</code>.
  4. */
  5. public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
  6. if (pool != null) {
  7. pool.shutdown();
  8. try {
  9. if (pool.awaitTermination(timeout, timeUnit)) {
  10. return true;
  11. }
  12. } catch (InterruptedException e) {
  13. Thread.currentThread().interrupt();
  14. }
  15. // last resort
  16. pool.shutdownNow();
  17. }
  18. return false;
  19. }

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

  1. /**
  2. * Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
  3. * the service is <code>null</code> this method will return <code>false</code>.
  4. */
  5. public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
  6. if (pool != null) {
  7. try {
  8. pool.shutdown();
  9. if (awaitTermination(pool, timeout, timeUnit)) return true;
  10. // last resort
  11. pool.shutdownNow();
  12. return awaitTermination(pool, timeout, timeUnit);
  13. } finally {
  14. IOUtils.closeWhileHandlingException(pool);
  15. }
  16. }
  17. return false;
  18. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

  1. /**
  2. * Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
  3. * the service is <code>null</code> this method will return <code>false</code>.
  4. */
  5. public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
  6. if (pool != null) {
  7. try {
  8. pool.shutdown();
  9. if (awaitTermination(pool, timeout, timeUnit)) {
  10. return true;
  11. }
  12. // last resort
  13. pool.shutdownNow();
  14. return awaitTermination(pool, timeout, timeUnit);
  15. } finally {
  16. IOUtils.closeWhileHandlingException(pool);
  17. }
  18. }
  19. return false;
  20. }

代码示例来源:origin: apache/servicemix-bundles

  1. /**
  2. * Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
  3. * the service is <code>null</code> this method will return <code>false</code>.
  4. */
  5. public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) {
  6. if (pool != null) {
  7. try {
  8. pool.shutdown();
  9. if (awaitTermination(pool, timeout, timeUnit)) {
  10. return true;
  11. }
  12. // last resort
  13. pool.shutdownNow();
  14. return awaitTermination(pool, timeout, timeUnit);
  15. } finally {
  16. IOUtils.closeWhileHandlingException(pool);
  17. }
  18. }
  19. return false;
  20. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

  1. toClose.add(() -> injector.getInstance(ThreadPool.class).shutdown());
  2. toClose.add(() -> {
  3. try {

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

  1. toClose.add(() -> injector.getInstance(ThreadPool.class).shutdown());
  2. toClose.add(() -> {
  3. try {

代码示例来源:origin: apache/servicemix-bundles

  1. toClose.add(() -> injector.getInstance(ThreadPool.class).shutdown());
  2. toClose.add(() -> {
  3. try {

代码示例来源:origin: org.fusesource.insight/insight-elasticsearch

  1. injector.getInstance(ThreadPool.class).shutdown();
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);

代码示例来源:origin: harbby/presto-connectors

  1. injector.getInstance(ThreadPool.class).shutdown();
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);

代码示例来源:origin: io.fabric8.insight/insight-elasticsearch

  1. injector.getInstance(ThreadPool.class).shutdown();
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);

相关文章