Java Code Examples for org.elasticsearch.common.unit.TimeValue#timeValueNanos()

The following examples show how to use org.elasticsearch.common.unit.TimeValue#timeValueNanos() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrioritizedEsThreadPoolExecutor.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the waiting time of the first task in the queue
 */
public TimeValue getMaxTaskWaitTime() {
    if (getQueue().size() == 0) {
        return NO_WAIT_TIME_VALUE;
    }

    long now = System.nanoTime();
    long oldestCreationDateInNanos = now;
    for (Runnable queuedRunnable : getQueue()) {
        if (queuedRunnable instanceof PrioritizedRunnable) {
            oldestCreationDateInNanos = Math.min(oldestCreationDateInNanos,
                    ((PrioritizedRunnable) queuedRunnable).getCreationDateInNanos());
        }
    }

    return TimeValue.timeValueNanos(now - oldestCreationDateInNanos);
}
 
Example 2
Source File: RecoveryState.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public synchronized TimeValue sourceThrottling() {
    return TimeValue.timeValueNanos(sourceThrottlingInNanos);
}
 
Example 3
Source File: RecoveryState.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public synchronized TimeValue targetThrottling() {
    return TimeValue.timeValueNanos(targetThrottleTimeInNanos);
}
 
Example 4
Source File: RecoveryStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
/**
 * Total time recoveries waited due to throttling
 */
public TimeValue throttleTime() {
    return TimeValue.timeValueNanos(throttleTimeInNanos.get());
}
 
Example 5
Source File: StoreStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public TimeValue throttleTime() {
    return TimeValue.timeValueNanos(throttleTimeInNanos);
}