Let NodeService implement closable and let NodeService delegate to IngestService

This commit is contained in:
Martijn van Groningen 2016-01-20 15:46:48 +01:00
parent 977bbaba02
commit fd31d6afdf
2 changed files with 10 additions and 4 deletions

View File

@ -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)) {

View File

@ -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();
}
}