org.elasticsearch.node.Node.close()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(200)

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

Node.close介绍

暂无

代码示例

代码示例来源:origin: apache/flink

  1. @Override
  2. public void cleanup() {
  3. if (node != null && !node.isClosed()) {
  4. node.close();
  5. node = null;
  6. }
  7. }
  8. }

代码示例来源:origin: Netflix/conductor

  1. @Override
  2. public synchronized void stop() throws Exception {
  3. if (instance != null && !instance.isClosed()) {
  4. String port = getPort();
  5. logger.info("Stopping Elastic Search");
  6. instance.close();
  7. instance = null;
  8. logger.info("Elastic Search on port {} stopped", port);
  9. }
  10. }
  11. }

代码示例来源:origin: thinkaurelius/titan

  1. @Override
  2. public void close() throws BackendException {
  3. if (node != null && !node.isClosed()) {
  4. node.close();
  5. }
  6. client.close();
  7. }

代码示例来源:origin: loklak/loklak_server

  1. /**
  2. * Close the connection to the remote elasticsearch client. This should only be called when the application is
  3. * terminated.
  4. * Please avoid to open and close the ElasticsearchClient for the same cluster and index more than once.
  5. * To avoid that this method is called more than once, the elasticsearch_client object is set to null
  6. * as soon this was called the first time. This is needed because the finalize method calls this
  7. * method as well.
  8. */
  9. public void close() {
  10. if (this.elasticsearchClient != null) {
  11. this.elasticsearchClient.close();
  12. this.elasticsearchClient = null;
  13. }
  14. if (this.elasticsearchNode != null) {
  15. this.elasticsearchNode.close();
  16. this.elasticsearchNode = null;
  17. }
  18. }

代码示例来源:origin: brianfrankcooper/YCSB

  1. @Override
  2. public void cleanup() throws DBException {
  3. if (!remoteMode) {
  4. if (!node.isClosed()) {
  5. client.close();
  6. node.close();
  7. }
  8. } else {
  9. client.close();
  10. }
  11. }

代码示例来源:origin: Netflix/conductor

  1. public synchronized void start(String clusterName, String host, int port) throws Exception {
  2. if (instance != null) {
  3. String msg = String.format(
  4. "An instance of this Embedded Elastic Search server is already running on port: %d. " +
  5. "It must be stopped before you can call start again.",
  6. getPort()
  7. );
  8. logger.error(msg);
  9. throw new IllegalStateException(msg);
  10. }
  11. final Settings settings = getSettings(clusterName, host, port);
  12. dataDir = setupDataDir(settings.get(ElasticSearchConfiguration.EMBEDDED_DATA_PATH_DEFAULT_VALUE));
  13. logger.info("Starting ElasticSearch for cluster {} ", settings.get("cluster.name"));
  14. instance = new PluginConfigurableNode(settings, singletonList(Netty4Plugin.class));
  15. instance.start();
  16. Runtime.getRuntime().addShutdownHook(new Thread(() -> {
  17. try {
  18. if (instance != null) {
  19. instance.close();
  20. }
  21. } catch (IOException e) {
  22. logger.error("Error closing ElasticSearch");
  23. }
  24. }));
  25. logger.info("ElasticSearch cluster {} started in local mode on port {}", instance.settings().get("cluster.name"), getPort());
  26. }

代码示例来源:origin: floragunncom/search-guard

  1. private static void closeNode(Node node) {
  2. try {
  3. LoggerContext context = (LoggerContext) LogManager.getContext(false);
  4. Configurator.shutdown(context);
  5. node.close();
  6. Thread.sleep(250);
  7. } catch (Throwable e) {
  8. //ignore
  9. }
  10. }

代码示例来源:origin: stagemonitor/stagemonitor

  1. public static void main(String[] args) throws Exception {
  2. final Timer.Context timer = Stagemonitor.getMetric2Registry().timer(name("startElasticsearch").build()).time();
  3. startElasticsearch();
  4. Stagemonitor.init();
  5. timer.stop();
  6. printResults();
  7. node.close();
  8. }

代码示例来源:origin: Impetus/Kundera

  1. /**
  2. * Tear down after class.
  3. *
  4. * @throws Exception
  5. * the exception
  6. */
  7. @AfterClass
  8. public static void tearDownAfterClass() throws Exception {
  9. node.close();
  10. }

代码示例来源:origin: Impetus/Kundera

  1. @AfterClass
  2. public static void tearDownAfterClass() throws Exception
  3. {
  4. node.close();
  5. }

代码示例来源:origin: Impetus/Kundera

  1. @AfterClass
  2. public static void tearDownAfterClass() throws Exception
  3. {
  4. node.close();
  5. }

代码示例来源:origin: Impetus/Kundera

  1. /**
  2. * Tear down after class.
  3. *
  4. * @throws Exception
  5. * the exception
  6. */
  7. @AfterClass
  8. public static void tearDownAfterClass() throws Exception
  9. {
  10. if (node != null)
  11. node.close();
  12. }

代码示例来源:origin: Impetus/Kundera

  1. @AfterClass
  2. public static void tearDownAfterClass() throws Exception
  3. {
  4. node.close();
  5. }

代码示例来源:origin: Impetus/Kundera

  1. /**
  2. * Tear down after class.
  3. *
  4. * @throws Exception
  5. * the exception
  6. */
  7. @AfterClass
  8. public static void tearDownAfterClass() throws Exception
  9. {
  10. if (node != null)
  11. node.close();
  12. }

代码示例来源:origin: Impetus/Kundera

  1. /**
  2. * Tear down after class.
  3. *
  4. * @throws Exception
  5. * the exception
  6. */
  7. @AfterClass
  8. public static void tearDownAfterClass() throws Exception
  9. {
  10. if (node != null)
  11. node.close();
  12. }

代码示例来源:origin: Impetus/Kundera

  1. @AfterClass
  2. public static void tearDownAfterClass() throws Exception
  3. {
  4. // node.stop();
  5. node.close();
  6. }

代码示例来源:origin: Impetus/Kundera

  1. /**
  2. * Tear down after class.
  3. *
  4. * @throws Exception
  5. * the exception
  6. */
  7. @AfterClass
  8. public static void tearDownAfterClass() throws Exception
  9. {
  10. node.close();
  11. }

代码示例来源:origin: Impetus/Kundera

  1. @After
  2. public void tearDown() throws Exception
  3. {
  4. if (checkIfServerRunning() && node != null)
  5. {
  6. node.close();
  7. }
  8. }

代码示例来源:origin: Impetus/Kundera

  1. @After
  2. public void tearDown() throws Exception
  3. {
  4. if (checkIfServerRunning() && node != null)
  5. {
  6. node.close();
  7. }
  8. }

代码示例来源:origin: Impetus/Kundera

  1. @After
  2. public void tearDown()
  3. {
  4. if (checkIfServerRunning() && node != null)
  5. {
  6. node.close();
  7. }
  8. tearDownInternal();
  9. }

相关文章