@Override public void close() { nativeClient.close(); } }
private void disposeClient() { if ( client != null ) { client.close(); } }
@Override public void close() { if (client != null) { client.close(); } client = null; }
/** * Reset the client instance */ public synchronized void releaseClient() { //reset our static variables if ( client != null ) { try { client.close(); } //if we fail for any reason, null it so the next request creates a new client finally { client = null; } } }
/** * 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; } }
@Override public void close() throws BackendException { if (node != null && !node.isClosed()) { node.close(); } client.close(); }
/** * Dispose of ElasticSearch client */ public void closeClient() { if (esClient.get() != null) { getLogger().info("Closing ElasticSearch Client"); esClient.get().close(); esClient.set(null); } }
/** * Dispose of ElasticSearch client */ public void closeClient() { Client client = esClient.get(); if (client != null) { getLogger().info("Closing ElasticSearch Client"); esClient.set(null); client.close(); } }
private void openLocalDiscoveryClient() { logger.info("Using ElasticSearch AutoDiscovery mode"); Node node = NodeBuilder.nodeBuilder().client(true).local(true).node(); if (client != null) { client.close(); } client = node.client(); }
/** * Open client to elaticsearch cluster * * @param clusterName */ private void openClient(String clusterName) { logger.info("Using ElasticSearch hostnames: {} ", Arrays.toString(serverAddresses)); Settings settings = ImmutableSettings.settingsBuilder() .put("cluster.name", clusterName).build(); TransportClient transportClient = new TransportClient(settings); for (InetSocketTransportAddress host : serverAddresses) { transportClient.addTransportAddress(host); } if (client != null) { client.close(); } client = transportClient; }
@AfterClass public static void closeClient() throws Exception { if (elasticSearchClient != null) { elasticSearchClient.close(); } embeddedElasticSearch.stop(); }
this.client.close();
@Override public void close() { if (client != null) { client.close(); } }
/** * 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; } }
/** * Tests that the Elasticsearch sink works properly. */ public void runElasticsearchSinkTest() throws Exception { final String index = "elasticsearch-sink-test-index"; final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction()); source.addSink(createElasticsearchSinkForEmbeddedNode( 1, CLUSTER_NAME, new SourceSinkDataTestKit.TestElasticsearchSinkFunction(index))); env.execute("Elasticsearch Sink Test"); // verify the results Client client = embeddedNodeEnv.getClient(); SourceSinkDataTestKit.verifyProducedSinkData(client, index); client.close(); }
/** * stops the elasticsearch node */ public void shutdown() { try { if (esNode != null) esNode.close(); esClient.close(); } catch (IOException e) { throw new RuntimeException("Error during elasticsearch server shutdown", e); } }
@Override public void close() { in().close(); }
@Override public void close() { if (this.client != null) { this.client.close(); this.client = null; } if (this.node != null && !this.node.isClosed()) { this.node.close(); this.node = null; } }
@Override public void stop() { for (Map.Entry<String, BulkProcessor> e : sourceBulkProcessor.entrySet()) { flush(e.getKey()); e.getValue().close(); } client.close(); }