@Override public synchronized void shutdown() { try { if (bulkProcessor != null) { logger.debug("closing bulk processor..."); bulkProcessor.close(); } if (metric != null && metric.indices() != null && !metric.indices().isEmpty()) { logger.debug("stopping bulk mode for indices {}...", metric.indices()); for (String index : ImmutableSet.copyOf(metric.indices())) { stopBulk(index); } } logger.debug("shutting down..."); client.close(); logger.debug("shutting down completed"); } catch (Exception e) { logger.error(e.getMessage(), e); } }