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

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

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

TimeValue.nanos介绍

暂无

代码示例

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

private void setFetchInfoThreshold(TimeValue infoThreshold) {
  this.fetchInfoThreshold = infoThreshold.nanos();
}

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

private void setInfoThreshold(TimeValue infoThreshold) {
  this.indexInfoThreshold = infoThreshold.nanos();
}

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

private void setTraceThreshold(TimeValue traceThreshold) {
  this.indexTraceThreshold = traceThreshold.nanos();
}

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

private void setQueryDebugThreshold(TimeValue debugThreshold) {
  this.queryDebugThreshold = debugThreshold.nanos();
}

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

private void setFetchTraceThreshold(TimeValue traceThreshold) {
  this.fetchTraceThreshold = traceThreshold.nanos();
}

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

private void setQueryInfoThreshold(TimeValue infoThreshold) {
  this.queryInfoThreshold = infoThreshold.nanos();
}

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

private void setFetchWarnThreshold(TimeValue warnThreshold) {
  this.fetchWarnThreshold = warnThreshold.nanos();
}

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

private void setWarnThreshold(TimeValue warnThreshold) {
  this.indexWarnThreshold = warnThreshold.nanos();
}

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

private void setDebugThreshold(TimeValue debugThreshold) {
  this.indexDebugThreshold = debugThreshold.nanos();
}

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

private void setQueryTraceThreshold(TimeValue traceThreshold) {
  this.queryTraceThreshold = traceThreshold.nanos();
}

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

public long scheduledTimeToRunInNanos() {
  return baseTimestampNanos + nextDelay.nanos();
}

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

public static long waitForCompletionTimeout(TimeValue timeout) {
  if (timeout == null) {
    timeout = DEFAULT_WAIT_FOR_COMPLETION_TIMEOUT;
  }
  return System.nanoTime() + timeout.nanos();
}

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

public TimeValue throttleWaitTime(TimeValue lastBatchStartTime, TimeValue now, int lastBatchSize) {
  long earliestNextBatchStartTime = now.nanos() + (long) perfectlyThrottledBatchTime(lastBatchSize);
  long waitTime = min(MAX_THROTTLE_WAIT_TIME.nanos(), max(0, earliestNextBatchStartTime - System.nanoTime()));
  return timeValueNanos(waitTime);
}

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

/**
 * Calculates the delay left based on current time (in nanoseconds) and the delay defined by the index settings.
 * Only relevant if shard is effectively delayed (see {@link #isDelayed()})
 * Returns 0 if delay is negative
 *
 * @return calculated delay in nanoseconds
 */
public long getRemainingDelay(final long nanoTimeNow, final Settings indexSettings) {
  long delayTimeoutNanos = INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(indexSettings).nanos();
  assert nanoTimeNow >= unassignedTimeNanos;
  return Math.max(0L, delayTimeoutNanos - (nanoTimeNow - unassignedTimeNanos));
}

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

DelayedPrepareBulkRequest(ThreadPool threadPool, float requestsPerSecond, TimeValue delay, Runnable command) {
  this.threadPool = threadPool;
  this.requestsPerSecond = requestsPerSecond;
  this.command = command;
  this.future = threadPool.schedule(delay, ThreadPool.Names.GENERIC, () -> {
    throttledNanos.addAndGet(delay.nanos());
    command.run();
  });
}

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

public void addTotals(RecoveryStats recoveryStats) {
  if (recoveryStats != null) {
    this.throttleTimeInNanos.addAndGet(recoveryStats.throttleTime().nanos());
  }
}

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

private static TimeValue getValidThreshold(Settings settings, String key, String level) {
  TimeValue threshold = settings.getAsTime(level, null);
  if (threshold == null) {
    throw new IllegalArgumentException("missing gc_threshold for [" + getThresholdName(key, level) + "]");
  }
  if (threshold.nanos() <= 0) {
    throw new IllegalArgumentException("invalid gc_threshold [" + threshold + "] for [" + getThresholdName(key, level) + "]");
  }
  return threshold;
}

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

public void execute(Runnable command, final TimeValue timeout, final Runnable timeoutCallback) {
  command = wrapRunnable(command);
  doExecute(command);
  if (timeout.nanos() >= 0) {
    if (command instanceof TieBreakingPrioritizedRunnable) {
      ((TieBreakingPrioritizedRunnable) command).scheduleTimeout(timer, timeoutCallback, timeout);
    } else {
      // We really shouldn't be here. The only way we can get here if somebody created PrioritizedFutureTask
      // and passed it to execute, which doesn't make much sense
      throw new UnsupportedOperationException("Execute with timeout is not supported for future tasks");
    }
  }
}

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

/**
 * This configures the maximum script compilations per five minute window.
 *
 * @param newRate the new expected maximum number of compilations per five minute window
 */
void setMaxCompilationRate(Tuple<Integer, TimeValue> newRate) {
  this.rate = newRate;
  // Reset the counter to allow new compilations
  this.scriptsPerTimeWindow = rate.v1();
  this.compilesAllowedPerNano = ((double) rate.v1()) / newRate.v2().nanos();
}

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

@Override
protected void doStartNextScroll(String scrollId, TimeValue extraKeepAlive, Consumer<? super Response> onResponse) {
  searchWithRetry(listener -> {
    SearchScrollRequest request = new SearchScrollRequest();
    // Add the wait time into the scroll timeout so it won't timeout while we wait for throttling
    request.scrollId(scrollId).scroll(timeValueNanos(firstSearchRequest.scroll().keepAlive().nanos() + extraKeepAlive.nanos()));
    client.searchScroll(request, listener);
  }, r -> consume(r, onResponse));
}

相关文章