mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-12 21:33:27 +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 {
|
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) {
|
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 {
|
public void destroy() throws Exception {
|
||||||
try {
|
try {
|
||||||
// NodeClient.close() is a noop, no need to call it here
|
// NodeClient.close() is a noop, no need to call it here
|
||||||
|
nodeClient = null;
|
||||||
logger.info("Closing elasticSearch node");
|
logger.info("Closing elasticSearch node");
|
||||||
// closing the Node causes tests to fail in the pipeline build and on some
|
if (node != null) {
|
||||||
// "mvn test" runs, there seem still to be tests relying on a running instance that
|
node.close();
|
||||||
// is not properly set up.
|
node = null;
|
||||||
// if (node != null) {
|
}
|
||||||
// node.close();
|
|
||||||
// }
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Error closing ElasticSearch client: ", e);
|
logger.error("Error closing ElasticSearch client: ", e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user