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

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

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

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) {

相关文章