本文整理汇总了Java中org.elasticsearch.common.unit.TimeValue.nanos方法的典型用法代码示例。如果您正苦于以下问题:Java TimeValue.nanos方法的具体用法?Java TimeValue.nanos怎么用?Java TimeValue.nanos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.unit.TimeValue
的用法示例。
在下文中一共展示了TimeValue.nanos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public void execute(Runnable command, final ScheduledExecutorService timer, final TimeValue timeout, final Runnable timeoutCallback) {
if (command instanceof PrioritizedRunnable) {
command = new TieBreakingPrioritizedRunnable((PrioritizedRunnable) command, insertionOrder.incrementAndGet());
} else if (!(command instanceof PrioritizedFutureTask)) { // it might be a callable wrapper...
command = new TieBreakingPrioritizedRunnable(command, Priority.NORMAL, insertionOrder.incrementAndGet());
}
super.execute(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");
}
}
}
示例2: execute
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public void execute(Runnable command, final ScheduledExecutorService timer, 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");
}
}
}
示例3: getValidThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
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;
}
示例4: processTasks
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
@Override
protected void processTasks(ListTasksRequest request, final Consumer<Task> operation) {
if (false == request.getWaitForCompletion()) {
super.processTasks(request, operation);
return;
}
// If we should wait for completion then we have to intercept every found task and wait for it to leave the manager.
TimeValue timeout = request.getTimeout();
if (timeout == null) {
timeout = DEFAULT_WAIT_FOR_COMPLETION_TIMEOUT;
}
final long timeoutTime = System.nanoTime() + timeout.nanos();
super.processTasks(request, new Consumer<Task>() {
@Override
public void accept(Task t) {
operation.accept(t);
while (System.nanoTime() - timeoutTime < 0) {
Task task = taskManager.getTask(t.getId());
if (task == null) {
return;
}
if (task.getAction().startsWith(ListTasksAction.NAME)) {
// It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting
// for itself of one of its child tasks
return;
}
try {
Thread.sleep(WAIT_FOR_COMPLETION_POLL.millis());
} catch (InterruptedException e) {
throw new ElasticsearchException("Interrupted waiting for completion of [{}]", e, t);
}
}
throw new ElasticsearchTimeoutException("Timed out waiting for completion of [{}]", t);
}
});
}
示例5: setQueryWarnThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setQueryWarnThreshold(TimeValue warnThreshold) {
this.queryWarnThreshold = warnThreshold.nanos();
}
示例6: setQueryInfoThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setQueryInfoThreshold(TimeValue infoThreshold) {
this.queryInfoThreshold = infoThreshold.nanos();
}
示例7: setQueryDebugThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setQueryDebugThreshold(TimeValue debugThreshold) {
this.queryDebugThreshold = debugThreshold.nanos();
}
示例8: setQueryTraceThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setQueryTraceThreshold(TimeValue traceThreshold) {
this.queryTraceThreshold = traceThreshold.nanos();
}
示例9: setFetchWarnThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setFetchWarnThreshold(TimeValue warnThreshold) {
this.fetchWarnThreshold = warnThreshold.nanos();
}
示例10: setFetchInfoThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setFetchInfoThreshold(TimeValue infoThreshold) {
this.fetchInfoThreshold = infoThreshold.nanos();
}
示例11: setFetchDebugThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setFetchDebugThreshold(TimeValue debugThreshold) {
this.fetchDebugThreshold = debugThreshold.nanos();
}
示例12: setFetchTraceThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setFetchTraceThreshold(TimeValue traceThreshold) {
this.fetchTraceThreshold = traceThreshold.nanos();
}
示例13: setWarnThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setWarnThreshold(TimeValue warnThreshold) {
this.indexWarnThreshold = warnThreshold.nanos();
}
示例14: setInfoThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setInfoThreshold(TimeValue infoThreshold) {
this.indexInfoThreshold = infoThreshold.nanos();
}
示例15: setDebugThreshold
import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
private void setDebugThreshold(TimeValue debugThreshold) {
this.indexDebugThreshold = debugThreshold.nanos();
}