public void terminate() {
if (monitor != null) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("Shutting down server");
monitor.interrupt();
<BUG>monitor = null;
elasticsearch.terminate();
server.terminate();
}</BUG>
}

public void terminate() {
if (monitor != null) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("Shutting down server");
monitor.interrupt();
monitor = null;
if (elasticsearch != null) {
elasticsearch.terminate();
}
if (server != null) {
server.terminate();
}
}
}
