From fd31d6afdf8cc0afc35828566c19134e5c3f415d Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 20 Jan 2016 15:46:48 +0100 Subject: [PATCH] Let NodeService implement closable and let NodeService delegate to IngestService --- core/src/main/java/org/elasticsearch/node/Node.java | 6 +++--- .../java/org/elasticsearch/node/service/NodeService.java | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 4cc338fb837..7ca0f5e76a7 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -355,11 +355,11 @@ public class Node implements Releasable { StopWatch stopWatch = new StopWatch("node_close"); stopWatch.start("tribe"); injector.getInstance(TribeService.class).close(); - stopWatch.stop().start("ingest_service"); + stopWatch.stop().start("node_service"); try { - injector.getInstance(NodeService.class).getIngestService().close(); + injector.getInstance(NodeService.class).close(); } catch (IOException e) { - logger.warn("IngestService close failed", e); + logger.warn("NodeService close failed", e); } stopWatch.stop().start("http"); if (settings.getAsBoolean("http.enabled", true)) { diff --git a/core/src/main/java/org/elasticsearch/node/service/NodeService.java b/core/src/main/java/org/elasticsearch/node/service/NodeService.java index 15352eeadd2..32035dad606 100644 --- a/core/src/main/java/org/elasticsearch/node/service/NodeService.java +++ b/core/src/main/java/org/elasticsearch/node/service/NodeService.java @@ -42,6 +42,7 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -51,7 +52,7 @@ import static java.util.Collections.unmodifiableMap; /** */ -public class NodeService extends AbstractComponent { +public class NodeService extends AbstractComponent implements Closeable { private final ThreadPool threadPool; private final MonitorService monitorService; @@ -187,4 +188,9 @@ public class NodeService extends AbstractComponent { public IngestService getIngestService() { return ingestService; } + + @Override + public void close() throws IOException { + indicesService.close(); + } }