mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-12 13:23:26 +00:00
DATAES-314 - NodeClientFactoryBean doesn't shutdown ES on destroy life-cycle.
Original PR: #360
This commit is contained in:
parent
47d0104295
commit
2bb3fdfa8b
@ -57,7 +57,7 @@ public class NodeClientFactoryBean implements FactoryBean<Client>, InitializingB
|
||||
|
||||
public static class TestNode extends Node {
|
||||
|
||||
private static final String DEFAULT_NODE_NAME = "spring-data-elasticsearch-test-node";
|
||||
private static final String DEFAULT_NODE_NAME = "spring-data-elasticsearch-nodeclientfactorybean-test";
|
||||
|
||||
public TestNode(Settings preparedSettings, Collection<Class<? extends Plugin>> classpathPlugins) {
|
||||
|
||||
@ -151,13 +151,12 @@ public class NodeClientFactoryBean implements FactoryBean<Client>, InitializingB
|
||||
public void destroy() throws Exception {
|
||||
try {
|
||||
// NodeClient.close() is a noop, no need to call it here
|
||||
nodeClient = null;
|
||||
logger.info("Closing elasticSearch node");
|
||||
// closing the Node causes tests to fail in the pipeline build and on some
|
||||
// "mvn test" runs, there seem still to be tests relying on a running instance that
|
||||
// is not properly set up.
|
||||
// if (node != null) {
|
||||
// node.close();
|
||||
// }
|
||||
if (node != null) {
|
||||
node.close();
|
||||
node = null;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Error closing ElasticSearch client: ", e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user