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

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

本文整理了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

  1. AsyncDeleteByQueryAction(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
  2. this.request = request;
  3. this.listener = listener;
  4. this.startTime = threadPool.estimatedTimeInMillis();
  5. this.timedOut = new AtomicBoolean(false);
  6. this.total = new AtomicLong(0L);
  7. this.shardFailures = ShardSearchFailure.EMPTY_ARRAY;
  8. this.results = new HashMap<>();
  9. }

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

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

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

  1. protected DeleteByQueryResponse buildResponse() {
  2. long took = threadPool.estimatedTimeInMillis() - startTime;
  3. long deleted = 0;
  4. long missing = 0;
  5. long failed = 0;
  6. // Calculates the total number deleted/failed/missing documents
  7. for (IndexDeleteByQueryResponse result : results.values()) {
  8. deleted = deleted + result.getDeleted();
  9. missing = missing + result.getMissing();
  10. failed = failed + result.getFailed();
  11. }
  12. IndexDeleteByQueryResponse[] indices = results.values().toArray(new IndexDeleteByQueryResponse[results.size()]);
  13. return new DeleteByQueryResponse(took, timedOut.get(), total.get(), deleted, missing, failed, indices, shardFailures);
  14. }
  15. }

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

  1. @Override
  2. protected void doRun() throws Exception {
  3. try {
  4. indexShard.flush(new FlushRequest());
  5. } catch (IllegalIndexShardStateException e) {
  6. // we are being closed, or in created state, ignore
  7. } catch (FlushNotAllowedEngineException e) {
  8. // ignore this exception, we are not allowed to perform flush
  9. }
  10. lastFlushTime = threadPool.estimatedTimeInMillis();
  11. reschedule();
  12. }
  13. });

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

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

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

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

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

  1. private void pruneDeletedTombstones() {
  2. long timeMSec = engineConfig.getThreadPool().estimatedTimeInMillis();
  3. // TODO: not good that we reach into LiveVersionMap here; can we move this inside VersionMap instead? problem is the dirtyLock...
  4. // we only need to prune the deletes map; the current/old version maps are cleared on refresh:
  5. for (Map.Entry<BytesRef, VersionValue> entry : versionMap.getAllTombstones()) {
  6. BytesRef uid = entry.getKey();
  7. 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
  8. // per set?
  9. // Must re-get it here, vs using entry.getValue(), in case the uid was indexed/deleted since we pulled the iterator:
  10. VersionValue versionValue = versionMap.getTombstoneUnderLock(uid);
  11. if (versionValue != null) {
  12. if (timeMSec - versionValue.time() > engineConfig.getGcDeletesInMillis()) {
  13. versionMap.removeTombstoneUnderLock(uid);
  14. }
  15. }
  16. }
  17. }
  18. lastDeleteVersionPruneTimeMSec = timeMSec;
  19. }

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

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

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

  1. boolean success = false;
  2. try {
  3. this.lastDeleteVersionPruneTimeMSec = engineConfig.getThreadPool().estimatedTimeInMillis();
  4. this.indexingService = engineConfig.getIndexingService();
  5. this.warmer = engineConfig.getWarmer();

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

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

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

  1. private void innerCreate(Create create) throws IOException {
  2. if (engineConfig.isOptimizeAutoGenerateId() && create.autoGeneratedId() && !create.canHaveDuplicates()) {
  3. // We don't need to lock because this ID cannot be concurrently updated:
  4. innerCreateNoLock(create, Versions.NOT_FOUND, null);
  5. } else {
  6. try (Releasable ignored = acquireLock(create.uid())) {
  7. final long currentVersion;
  8. final VersionValue versionValue;
  9. versionValue = versionMap.getUnderLock(create.uid().bytes());
  10. if (versionValue == null) {
  11. currentVersion = loadCurrentVersionFromIndex(create.uid());
  12. } else {
  13. if (engineConfig.isEnableGcDeletes() && versionValue.delete() && (engineConfig.getThreadPool().estimatedTimeInMillis
  14. () - versionValue.time()) > engineConfig.getGcDeletesInMillis()) {
  15. currentVersion = Versions.NOT_FOUND; // deleted, and GC
  16. } else {
  17. currentVersion = versionValue.version();
  18. }
  19. }
  20. innerCreateNoLock(create, currentVersion, versionValue);
  21. }
  22. }
  23. }

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

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

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

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

相关文章