當前位置: 首頁>>代碼示例>>Java>>正文


Java TimeValue.nanos方法代碼示例

本文整理匯總了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");
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:18,代碼來源:PrioritizedEsThreadPoolExecutor.java

示例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");
        }
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:14,代碼來源:PrioritizedEsThreadPoolExecutor.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:11,代碼來源:JvmGcMonitorService.java

示例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);
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:37,代碼來源:TransportListTasksAction.java

示例5: setQueryWarnThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setQueryWarnThreshold(TimeValue warnThreshold) {
    this.queryWarnThreshold = warnThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例6: setQueryInfoThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setQueryInfoThreshold(TimeValue infoThreshold) {
    this.queryInfoThreshold = infoThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例7: setQueryDebugThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setQueryDebugThreshold(TimeValue debugThreshold) {
    this.queryDebugThreshold = debugThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例8: setQueryTraceThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setQueryTraceThreshold(TimeValue traceThreshold) {
    this.queryTraceThreshold = traceThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例9: setFetchWarnThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setFetchWarnThreshold(TimeValue warnThreshold) {
    this.fetchWarnThreshold = warnThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例10: setFetchInfoThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setFetchInfoThreshold(TimeValue infoThreshold) {
    this.fetchInfoThreshold = infoThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例11: setFetchDebugThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setFetchDebugThreshold(TimeValue debugThreshold) {
    this.fetchDebugThreshold = debugThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例12: setFetchTraceThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setFetchTraceThreshold(TimeValue traceThreshold) {
    this.fetchTraceThreshold = traceThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:SearchSlowLog.java

示例13: setWarnThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setWarnThreshold(TimeValue warnThreshold) {
    this.indexWarnThreshold = warnThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:IndexingSlowLog.java

示例14: setInfoThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setInfoThreshold(TimeValue infoThreshold) {
    this.indexInfoThreshold = infoThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:IndexingSlowLog.java

示例15: setDebugThreshold

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
private void setDebugThreshold(TimeValue debugThreshold) {
    this.indexDebugThreshold = debugThreshold.nanos();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:IndexingSlowLog.java


注:本文中的org.elasticsearch.common.unit.TimeValue.nanos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。