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

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

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

ThreadPool.awaitTermination介绍

暂无

代码示例

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

  1. /**
  2. * Returns <code>true</code> if the given service 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(ExecutorService service, long timeout, TimeUnit timeUnit) {
  6. if (service != null) {
  7. service.shutdown();
  8. if (awaitTermination(service, timeout, timeUnit)) return true;
  9. service.shutdownNow();
  10. return awaitTermination(service, timeout, timeUnit);
  11. }
  12. return false;
  13. }

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

  1. private static boolean awaitTermination(
  2. final ThreadPool threadPool,
  3. final long timeout,
  4. final TimeUnit timeUnit) {
  5. try {
  6. if (threadPool.awaitTermination(timeout, timeUnit)) {
  7. return true;
  8. }
  9. } catch (InterruptedException e) {
  10. Thread.currentThread().interrupt();
  11. }
  12. return false;
  13. }

代码示例来源: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: org.elasticsearch/elasticsearch

  1. toClose.add(() -> {
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

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

  1. /**
  2. * Returns <code>true</code> if the given service 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(ExecutorService service, long timeout, TimeUnit timeUnit) {
  6. if (service != null) {
  7. service.shutdown();
  8. if (awaitTermination(service, timeout, timeUnit)) return true;
  9. service.shutdownNow();
  10. return awaitTermination(service, timeout, timeUnit);
  11. }
  12. return false;
  13. }

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

  1. /**
  2. * Returns <code>true</code> if the given service 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(ExecutorService service, long timeout, TimeUnit timeUnit) {
  6. if (service != null) {
  7. service.shutdown();
  8. if (awaitTermination(service, timeout, timeUnit)) return true;
  9. service.shutdownNow();
  10. return awaitTermination(service, timeout, timeUnit);
  11. }
  12. return false;
  13. }

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

  1. /**
  2. * Returns <code>true</code> if the given service 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(ExecutorService service, long timeout, TimeUnit timeUnit) {
  6. if (service != null) {
  7. service.shutdown();
  8. if (awaitTermination(service, timeout, timeUnit)) return true;
  9. service.shutdownNow();
  10. return awaitTermination(service, timeout, timeUnit);
  11. }
  12. return false;
  13. }

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

  1. private static boolean awaitTermination(
  2. final ThreadPool pool,
  3. final long timeout,
  4. final TimeUnit timeUnit) {
  5. try {
  6. if (pool.awaitTermination(timeout, timeUnit)) {
  7. return true;
  8. }
  9. } catch (InterruptedException e) {
  10. Thread.currentThread().interrupt();
  11. }
  12. return false;
  13. }

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

  1. private static boolean awaitTermination(
  2. final ThreadPool threadPool,
  3. final long timeout,
  4. final TimeUnit timeUnit) {
  5. try {
  6. if (threadPool.awaitTermination(timeout, timeUnit)) {
  7. return true;
  8. }
  9. } catch (InterruptedException e) {
  10. Thread.currentThread().interrupt();
  11. }
  12. return false;
  13. }

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

  1. static final class Fields {
  2. static final String TYPE = "type";
  3. static final String MIN = "min";
  4. static final String MAX = "max";
  5. static final String KEEP_ALIVE = "keep_alive";
  6. static final String QUEUE_SIZE = "queue_size";
  7. }
  8. }

代码示例来源: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: 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: 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(() -> {
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

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

  1. toClose.add(() -> {
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

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

  1. toClose.add(() -> {
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

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

  1. injector.getInstance(ThreadPool.class).shutdown();
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

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

  1. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  2. } catch (InterruptedException e) {

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

  1. injector.getInstance(ThreadPool.class).shutdown();
  2. try {
  3. injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
  4. } catch (InterruptedException e) {

相关文章