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

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

本文整理了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

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

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

private static boolean awaitTermination(
    final ThreadPool threadPool,
    final long timeout,
    final TimeUnit timeUnit) {
  try {
    if (threadPool.awaitTermination(timeout, timeUnit)) {
      return true;
    }
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  return false;
}

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

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

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

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

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

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

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

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

private static boolean awaitTermination(
    final ThreadPool pool,
    final long timeout,
    final TimeUnit timeUnit) {
  try {
    if (pool.awaitTermination(timeout, timeUnit)) {
      return true;
    }
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  return false;
}

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

private static boolean awaitTermination(
    final ThreadPool threadPool,
    final long timeout,
    final TimeUnit timeUnit) {
  try {
    if (threadPool.awaitTermination(timeout, timeUnit)) {
      return true;
    }
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  return false;
}

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

static final class Fields {
    static final String TYPE = "type";
    static final String MIN = "min";
    static final String MAX = "max";
    static final String KEEP_ALIVE = "keep_alive";
    static final String QUEUE_SIZE = "queue_size";
  }
}

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

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

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

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

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

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

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

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

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

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

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

相关文章