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

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

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

Node.close介绍

暂无

代码示例

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

@Override
  public void cleanup() {
    if (node != null && !node.isClosed()) {
      node.close();
      node = null;
    }
  }
}

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

@Override
  public synchronized void stop() throws Exception {

    if (instance != null && !instance.isClosed()) {
      String port = getPort();
      logger.info("Stopping Elastic Search");
      instance.close();
      instance = null;
      logger.info("Elastic Search on port {} stopped", port);
    }

  }
}

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

@Override
public void close() throws BackendException {
  if (node != null && !node.isClosed()) {
    node.close();
  }
  client.close();
}

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

/**
 * Close the connection to the remote elasticsearch client. This should only be called when the application is
 * terminated.
 * Please avoid to open and close the ElasticsearchClient for the same cluster and index more than once.
 * To avoid that this method is called more than once, the elasticsearch_client object is set to null
 * as soon this was called the first time. This is needed because the finalize method calls this
 * method as well.
 */
public void close() {
  if (this.elasticsearchClient != null) {
    this.elasticsearchClient.close();
    this.elasticsearchClient = null;
  }
  if (this.elasticsearchNode != null) {
    this.elasticsearchNode.close();
    this.elasticsearchNode = null;
  }
}

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

@Override
public void cleanup() throws DBException {
 if (!remoteMode) {
  if (!node.isClosed()) {
   client.close();
   node.close();
  }
 } else {
  client.close();
 }
}

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

public synchronized void start(String clusterName, String host, int port) throws Exception {
  if (instance != null) {
    String msg = String.format(
            "An instance of this Embedded Elastic Search server is already running on port: %d.  " +
                "It must be stopped before you can call start again.",
            getPort()
        );
    logger.error(msg);
    throw new IllegalStateException(msg);
  }
  final Settings settings = getSettings(clusterName, host, port);
  dataDir = setupDataDir(settings.get(ElasticSearchConfiguration.EMBEDDED_DATA_PATH_DEFAULT_VALUE));
  logger.info("Starting ElasticSearch for cluster {} ", settings.get("cluster.name"));
  instance = new PluginConfigurableNode(settings, singletonList(Netty4Plugin.class));
  instance.start();
  Runtime.getRuntime().addShutdownHook(new Thread(() -> {
    try {
      if (instance != null) {
        instance.close();
      }
    } catch (IOException e) {
      logger.error("Error closing ElasticSearch");
    }
  }));
  logger.info("ElasticSearch cluster {} started in local mode on port {}", instance.settings().get("cluster.name"), getPort());
}

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

private static void closeNode(Node node) {
  try {
    LoggerContext context = (LoggerContext) LogManager.getContext(false);
    Configurator.shutdown(context);
    node.close();
    Thread.sleep(250);
  } catch (Throwable e) {
    //ignore
  }
}

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

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

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

/**
 * Tear down after class.
 * 
 * @throws Exception
 *             the exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception {
  node.close();
}

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

@AfterClass
public static void tearDownAfterClass() throws Exception
{
  node.close();
}

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

@AfterClass
public static void tearDownAfterClass() throws Exception
{
  node.close();
}

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

/**
 * Tear down after class.
 * 
 * @throws Exception
 *             the exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception
{
  if (node != null)
    node.close();
}

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

@AfterClass
public static void tearDownAfterClass() throws Exception
{
  node.close();
}

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

/**
 * Tear down after class.
 * 
 * @throws Exception
 *             the exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception
{
  if (node != null)
    node.close();
}

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

/**
 * Tear down after class.
 * 
 * @throws Exception
 *             the exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception
{
  if (node != null)
    node.close();
}

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

@AfterClass
  public static void tearDownAfterClass() throws Exception
  {
//        node.stop();
    node.close();
  }

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

/**
 * Tear down after class.
 *
 * @throws Exception
 *             the exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception
{
  node.close();
}

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

@After
public void tearDown() throws Exception
{
  if (checkIfServerRunning() && node != null)
  {
    node.close();
  }
}

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

@After
public void tearDown() throws Exception
{
  if (checkIfServerRunning() && node != null)
  {
    node.close();
  }
}

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

@After
public void tearDown()
{
  if (checkIfServerRunning() && node != null)
  {
    node.close();
  }
  tearDownInternal();
}

相关文章