@Override protected void doStop() { ExecutorService indicesStopExecutor = Executors.newFixedThreadPool(5, EsExecutors.daemonThreadFactory(settings, "indices_shutdown")); // Copy indices because we modify it asynchronously in the body of the loop final Set<Index> indices = this.indices.values().stream().map(s -> s.index()).collect(Collectors.toSet()); final CountDownLatch latch = new CountDownLatch(indices.size()); for (final Index index : indices) { indicesStopExecutor.execute(() -> { try { removeIndex(index, IndexRemovalReason.NO_LONGER_ASSIGNED, "shutdown"); } finally { latch.countDown(); } }); } try { if (latch.await(shardsClosedTimeout.seconds(), TimeUnit.SECONDS) == false) { logger.warn("Not all shards are closed yet, waited {}sec - stopping service", shardsClosedTimeout.seconds()); } } catch (InterruptedException e) { // ignore } finally { indicesStopExecutor.shutdown(); } }
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
public long getSeconds() { return seconds(); }
public long getSeconds() { return seconds(); }
public long getSeconds() { return seconds(); }
public long getSeconds() { return seconds(); }
@Override protected void doStop() { ExecutorService indicesStopExecutor = Executors.newFixedThreadPool(5, EsExecutors.daemonThreadFactory(settings, "indices_shutdown")); // Copy indices because we modify it asynchronously in the body of the loop final Set<Index> indices = this.indices.values().stream().map(s -> s.index()).collect(Collectors.toSet()); final CountDownLatch latch = new CountDownLatch(indices.size()); for (final Index index : indices) { indicesStopExecutor.execute(() -> { try { removeIndex(index, IndexRemovalReason.NO_LONGER_ASSIGNED, "shutdown"); } finally { latch.countDown(); } }); } try { if (latch.await(shardsClosedTimeout.seconds(), TimeUnit.SECONDS) == false) { logger.warn("Not all shards are closed yet, waited {}sec - stopping service", shardsClosedTimeout.seconds()); } } catch (InterruptedException e) { // ignore } finally { indicesStopExecutor.shutdown(); } }
@Override protected void doStop() { ExecutorService indicesStopExecutor = Executors.newFixedThreadPool(5, EsExecutors.daemonThreadFactory("indices_shutdown")); // Copy indices because we modify it asynchronously in the body of the loop final Set<Index> indices = this.indices.values().stream().map(s -> s.index()).collect(Collectors.toSet()); final CountDownLatch latch = new CountDownLatch(indices.size()); for (final Index index : indices) { indicesStopExecutor.execute(() -> { try { removeIndex(index, IndexRemovalReason.NO_LONGER_ASSIGNED, "shutdown"); } finally { latch.countDown(); } }); } try { if (latch.await(shardsClosedTimeout.seconds(), TimeUnit.SECONDS) == false) { logger.warn("Not all shards are closed yet, waited {}sec - stopping service", shardsClosedTimeout.seconds()); } } catch (InterruptedException e) { // ignore } finally { indicesStopExecutor.shutdown(); } }
@Override protected void doStop() { ImmutableSet<String> indices = ImmutableSet.copyOf(this.indices.keySet()); final CountDownLatch latch = new CountDownLatch(indices.size()); final ExecutorService indicesStopExecutor = Executors.newFixedThreadPool(5, EsExecutors.daemonThreadFactory("indices_shutdown")); for (final String index : indices) { indicesStopExecutor.execute(new Runnable() { @Override public void run() { try { removeIndex(index, "shutdown", false); } catch (Throwable e) { logger.warn("failed to remove index on stop [" + index + "]", e); } finally { latch.countDown(); } } }); } try { if (latch.await(shardsClosedTimeout.seconds(), TimeUnit.SECONDS) == false) { logger.warn("Not all shards are closed yet, waited {}sec - stopping service", shardsClosedTimeout.seconds()); } } catch (InterruptedException e) { // ignore } finally { indicesStopExecutor.shutdown(); } }
/** * . This constructor will be called by guice during initialization * * @param aNode node reference injecting the reference to current node to * get access to node's client * @param settings cluster settings */ @SuppressWarnings("unchecked") @Inject public Factory(final Node aNode, final Settings settings) { super(settings); // Node is not fully initialized here // All we can do is save a reference to it for future use this.node = aNode; TimeValue expire = settings.getAsTime("entity-resolution.cache.expire", new TimeValue(1L, TimeUnit.HOURS)); ByteSizeValue size = settings.getAsBytesSize( "entity-resolution.cache.size", null); CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder(); cacheBuilder.expireAfterAccess(expire.seconds(), TimeUnit.SECONDS); if (size != null) { cacheBuilder.maximumSize(size.bytes()); } cache = cacheBuilder.build(); }
private void logStatistics() { long totalDocuments = deletedDocuments + insertedDocuments; long totalTimeInSeconds = sw.stop().totalTime().seconds(); long totalDocumentsPerSecond = (totalTimeInSeconds == 0) ? totalDocuments : totalDocuments / totalTimeInSeconds; logger.info("INDEXED {} documents, {} insertions/updates, {} deletions, {} documents per second", totalDocuments, insertedDocuments, deletedDocuments, totalDocumentsPerSecond); logger.info("Indexed {} documents, {} insertions/updates, {} deletions, {} documents per second", totalDocuments, insertedDocuments, deletedDocuments, totalDocumentsPerSecond); } }
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
return Long.toString(v.millis()); } else if ("s".equals(resolution)) { return Long.toString(v.seconds()); } else if ("m".equals(resolution)) { return Long.toString(v.minutes());
private void sendNodeProcessStats(ProcessStats processStats) { String type = buildMetricName("node.process"); sendInt(type, "openFileDescriptors", processStats.openFileDescriptors()); if (processStats.cpu() != null) { sendInt(type + ".cpu", "percent", processStats.cpu().percent()); sendInt(type + ".cpu", "sysSeconds", processStats.cpu().sys().seconds()); sendInt(type + ".cpu", "totalSeconds", processStats.cpu().total().seconds()); sendInt(type + ".cpu", "userSeconds", processStats.cpu().user().seconds()); } if (processStats.mem() != null) { sendInt(type + ".mem", "totalVirtual", processStats.mem().totalVirtual().bytes()); sendInt(type + ".mem", "resident", processStats.mem().resident().bytes()); sendInt(type + ".mem", "share", processStats.mem().share().bytes()); } }
private void sendNodeJvmStats(JvmStats jvmStats) { String type = buildMetricName("node.jvm"); sendInt(type, "uptime", jvmStats.uptime().seconds()); String id = type + ".gc." + collector.name(); sendInt(id, "collectionCount", collector.collectionCount()); sendInt(id, "collectionTimeSeconds", collector.collectionTime().seconds()); sendInt(lastGcType, "beforeUsed", lastGc.beforeUsed().bytes()); sendInt(lastGcType, "afterUsed", lastGc.afterUsed().bytes()); sendInt(lastGcType, "durationSeconds", lastGc.duration().seconds());