org.elasticsearch.common.unit.TimeValue.seconds()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.elasticsearch.common.unit.TimeValue.seconds()方法的一些代码示例,展示了TimeValue.seconds()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeValue.seconds()方法的具体详情如下:
包路径:org.elasticsearch.common.unit.TimeValue
类名称:TimeValue
方法名:seconds

TimeValue.seconds介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

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

代码示例来源:origin: org.elasticsearch/elasticsearch

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

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public long getSeconds() {
  return seconds();
}

代码示例来源:origin: org.elasticsearch/elasticsearch-core

public long getSeconds() {
  return seconds();
}

代码示例来源:origin: harbby/presto-connectors

public long getSeconds() {
  return seconds();
}

代码示例来源:origin: apache/servicemix-bundles

public long getSeconds() {
  return seconds();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

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

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

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

代码示例来源:origin: harbby/presto-connectors

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

代码示例来源:origin: YannBrrd/elasticsearch-entity-resolution

/**
 * . 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();
}

代码示例来源:origin: spinscale/elasticsearch-river-streaming-json

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

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

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

代码示例来源:origin: salyh/elasticsearch-imap

logger.info("Trigger interval is every {} seconds", interval.seconds());
      .withSchedule(simpleSchedule().withIntervalInSeconds((int) interval.seconds()).repeatForever()).build();
} else {

代码示例来源:origin: harbby/presto-connectors

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

代码示例来源:origin: NLPchina/elasticsearch-analysis-ansj

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

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

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

代码示例来源:origin: apache/servicemix-bundles

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

代码示例来源:origin: spinscale/elasticsearch-graphite-plugin

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

代码示例来源:origin: spinscale/elasticsearch-graphite-plugin

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

相关文章