org.elasticsearch.threadpool.ThreadPool.estimatedTimeInMillis()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(95)

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

ThreadPool.estimatedTimeInMillis介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch.plugin/delete-by-query

AsyncDeleteByQueryAction(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
  this.request = request;
  this.listener = listener;
  this.startTime = threadPool.estimatedTimeInMillis();
  this.timedOut = new AtomicBoolean(false);
  this.total = new AtomicLong(0L);
  this.shardFailures = ShardSearchFailure.EMPTY_ARRAY;
  this.results = new HashMap<>();
}

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

private void contextProcessedSuccessfully(SearchContext context) {
  context.accessed(threadPool.estimatedTimeInMillis());
}

代码示例来源:origin: org.elasticsearch.plugin/delete-by-query

protected DeleteByQueryResponse buildResponse() {
    long took = threadPool.estimatedTimeInMillis() - startTime;
    long deleted = 0;
    long missing = 0;
    long failed = 0;
    // Calculates the total number  deleted/failed/missing documents
    for (IndexDeleteByQueryResponse result : results.values()) {
      deleted = deleted + result.getDeleted();
      missing = missing + result.getMissing();
      failed = failed + result.getFailed();
    }
    IndexDeleteByQueryResponse[] indices = results.values().toArray(new IndexDeleteByQueryResponse[results.size()]);
    return new DeleteByQueryResponse(took, timedOut.get(), total.get(), deleted, missing, failed, indices, shardFailures);
  }
}

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

@Override
  protected void doRun() throws Exception {
    try {
      indexShard.flush(new FlushRequest());
    } catch (IllegalIndexShardStateException e) {
      // we are being closed, or in created state, ignore
    } catch (FlushNotAllowedEngineException e) {
      // ignore this exception, we are not allowed to perform flush
    }
    lastFlushTime = threadPool.estimatedTimeInMillis();
    reschedule();
  }
});

代码示例来源:origin: org.elasticsearch.plugin/delete-by-query

boolean hasTimedOut() {
  return request.timeout() != null && (threadPool.estimatedTimeInMillis() >= (startTime + request.timeout().millis()));
}

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

private void maybePruneDeletedTombstones() {
  // It's expensive to prune because we walk the deletes map acquiring dirtyLock for each uid so we only do it
  // every 1/4 of gcDeletesInMillis:
  if (engineConfig.isEnableGcDeletes() && engineConfig.getThreadPool().estimatedTimeInMillis() - lastDeleteVersionPruneTimeMSec >
      engineConfig.getGcDeletesInMillis() * 0.25) {
    pruneDeletedTombstones();
  }
}

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

private void pruneDeletedTombstones() {
  long timeMSec = engineConfig.getThreadPool().estimatedTimeInMillis();
  // TODO: not good that we reach into LiveVersionMap here; can we move this inside VersionMap instead?  problem is the dirtyLock...
  // we only need to prune the deletes map; the current/old version maps are cleared on refresh:
  for (Map.Entry<BytesRef, VersionValue> entry : versionMap.getAllTombstones()) {
    BytesRef uid = entry.getKey();
    try (Releasable ignored = acquireLock(uid)) { // can we do it without this lock on each value? maybe batch to a set and get the lock once
      // per set?
      // Must re-get it here, vs using entry.getValue(), in case the uid was indexed/deleted since we pulled the iterator:
      VersionValue versionValue = versionMap.getTombstoneUnderLock(uid);
      if (versionValue != null) {
        if (timeMSec - versionValue.time() > engineConfig.getGcDeletesInMillis()) {
          versionMap.removeTombstoneUnderLock(uid);
        }
      }
    }
  }
  lastDeleteVersionPruneTimeMSec = timeMSec;
}

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

@Override
  public void run() {
    final long time = threadPool.estimatedTimeInMillis();
    for (SearchContext context : activeContexts.values()) {
      // Use the same value for both checks since lastAccessTime can
      // be modified by another thread between checks!
      final long lastAccessTime = context.lastAccessTime();
      if (lastAccessTime == -1l) { // its being processed or timeout is disabled
        continue;
      }
      if ((time - lastAccessTime > context.keepAlive())) {
        logger.debug("freeing search context [{}], time [{}], lastAccessTime [{}], keepAlive [{}]", context.id(), time, lastAccessTime, context.keepAlive());
        freeContext(context.id());
      }
    }
  }
}

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

boolean success = false;
try {
  this.lastDeleteVersionPruneTimeMSec = engineConfig.getThreadPool().estimatedTimeInMillis();
  this.indexingService = engineConfig.getIndexingService();
  this.warmer = engineConfig.getWarmer();

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

currentVersion = loadCurrentVersionFromIndex(index.uid());
} else {
  if (engineConfig.isEnableGcDeletes() && versionValue.delete() && (engineConfig.getThreadPool().estimatedTimeInMillis() -
      versionValue.time()) > engineConfig.getGcDeletesInMillis()) {

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

private void innerCreate(Create create) throws IOException {
  if (engineConfig.isOptimizeAutoGenerateId() && create.autoGeneratedId() && !create.canHaveDuplicates()) {
    // We don't need to lock because this ID cannot be concurrently updated:
    innerCreateNoLock(create, Versions.NOT_FOUND, null);
  } else {
    try (Releasable ignored = acquireLock(create.uid())) {
      final long currentVersion;
      final VersionValue versionValue;
      versionValue = versionMap.getUnderLock(create.uid().bytes());
      if (versionValue == null) {
        currentVersion = loadCurrentVersionFromIndex(create.uid());
      } else {
        if (engineConfig.isEnableGcDeletes() && versionValue.delete() && (engineConfig.getThreadPool().estimatedTimeInMillis
            () - versionValue.time()) > engineConfig.getGcDeletesInMillis()) {
          currentVersion = Versions.NOT_FOUND; // deleted, and GC
        } else {
          currentVersion = versionValue.version();
        }
      }
      innerCreateNoLock(create, currentVersion, versionValue);
    }
  }
}

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

currentVersion = loadCurrentVersionFromIndex(delete.uid());
} else {
  if (engineConfig.isEnableGcDeletes() && versionValue.delete() && (engineConfig.getThreadPool().estimatedTimeInMillis() -
      versionValue.time()) > engineConfig.getGcDeletesInMillis()) {
Translog.Location translogLocation = translog.add(new Translog.Delete(delete));
versionMap.putUnderLock(delete.uid().bytes(), new DeleteVersionValue(updatedVersion, engineConfig.getThreadPool()
    .estimatedTimeInMillis(), translogLocation));
delete.setTranslogLocation(translogLocation);
indexingService.postDeleteUnderLock(delete);

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

if ((threadPool.estimatedTimeInMillis() - lastFlushTime) > flushThresholdPeriod.millis()) {
  logger.trace("flushing translog, last_flush_time [{}], breached [{}]", lastFlushTime, flushThresholdPeriod);
  asyncFlushAndReschedule();

相关文章