@Override public long getTime() { return Time.monotonicNow(); } }
/** * Set a new time for the renewal. * It can only be called when the action is not in the queue or any * collection because the hashCode may change * @param newTime the new time */ private void updateRenewalTime(long delay) { renewalTime = Time.now() + delay - delay/10; }
/** * Same as {@link #monotonicNow()} but returns its result in nanoseconds. * Note that this is subject to the same resolution constraints as * {@link System#nanoTime()}. * @return a monotonic clock that counts in nanoseconds. */ public long monotonicNowNanos() { return Time.monotonicNowNanos(); } }
private void updateInternalLeaseHolder() { this.lastHolderUpdateTime = Time.monotonicNow(); this.internalLeaseHolder = HdfsServerConstants.NAMENODE_LEASE_HOLDER + "-" + Time.formatTime(Time.now()); }
/** * process datanode heartbeat or stats initialization. */ public void updateHeartbeatState(StorageReport[] reports, long cacheCapacity, long cacheUsed, int xceiverCount, int volFailures, VolumeFailureSummary volumeFailureSummary) { updateStorageStats(reports, cacheCapacity, cacheUsed, xceiverCount, volFailures, volumeFailureSummary); setLastUpdate(Time.now()); setLastUpdateMonotonic(Time.monotonicNow()); rollBlocksScheduled(getLastUpdateMonotonic()); }
/** * Find the DelegationTokenInformation for the given token id, and verify that * if the token is expired. Note that this method should be called with * acquiring the secret manager's monitor. */ protected DelegationTokenInformation checkToken(TokenIdent identifier) throws InvalidToken { assert Thread.holdsLock(this); DelegationTokenInformation info = getTokenInfo(identifier); if (info == null) { throw new InvalidToken("token " + formatTokenId(identifier) + " can't be found in cache"); } long now = Time.now(); if (info.getRenewDate() < now) { throw new InvalidToken("token " + formatTokenId(identifier) + " is " + "expired, current time: " + Time.formatTime(now) + " expected renewal time: " + Time.formatTime(info.getRenewDate())); } return info; }
+ "; total currentTokens " + currentTokens.size()); long now = Time.now(); if (id.getMaxDate() < now) { throw new InvalidToken(renewer + " tried to renew an expired token " + formatTokenId(id) + " max expiration date: " + Time.formatTime(id.getMaxDate()) + " currentTime: " + Time.formatTime(now));
RetryInfo(long delay, RetryAction action, long expectedFailoverCount, Exception failException) { this.delay = delay; this.retryTime = Time.monotonicNow() + delay; this.action = action; this.expectedFailoverCount = expectedFailoverCount; this.failException = failException; }
Call(int id, int retryCount, RPC.RpcKind kind, byte[] clientId, TraceScope traceScope, CallerContext callerContext) { this.callId = id; this.retryCount = retryCount; this.timestamp = Time.now(); this.rpcKind = kind; this.clientId = clientId; this.traceScope = traceScope; this.callerContext = callerContext; }
/** * Current time from some arbitrary time base in the past, counting in * milliseconds, and not affected by settimeofday or similar system clock * changes. This is appropriate to use when computing how much longer to * wait for an interval to expire. * @return a monotonic clock that counts in milliseconds. */ public long monotonicNow() { return Time.monotonicNow(); }
/** * Current system time. Do not use this to calculate a duration or interval * to sleep, because it will be broken by settimeofday. Instead, use * monotonicNow. * @return current time in msec. */ public long now() { return Time.now(); }
public LoadBalancingKMSClientProvider(URI providerUri, KMSClientProvider[] providers, Configuration conf) { this(providerUri, providers, Time.monotonicNow(), conf); }
/** * This is the constructor with the signature needed by * {@link FileSystem#createFileSystem(URI, Configuration)} * * After this constructor is called initialize() is called. * @throws IOException */ public ViewFileSystem() throws IOException { ugi = UserGroupInformation.getCurrentUser(); creationTime = Time.now(); }
synchronized private boolean isExpired() { return Time.monotonicNow() - lastUpdateTime > timeout; }
/** Get the delay until this event should happen. */ @Override public long getDelay(final TimeUnit unit) { final long millisLeft = renewalTime - Time.now(); return unit.convert(millisLeft, TimeUnit.MILLISECONDS); }
@VisibleForTesting long now() { return Time.monotonicNow(); }
/** Update lastActivity with the current time. */ private void touch() { lastActivity.set(Time.now()); }
/** Is the queue empty for more than the given time in millisecond? */ boolean isEmpty(long time) { return Time.monotonicNow() - emptyStartTime.get() > time && queue.isEmpty(); }
/** * Cause the current thread to sleep as close as possible to the provided * number of milliseconds. This method will log and ignore any * {@link InterruptedException} encountered. * * @param millis the number of milliseconds for the current thread to sleep */ public static void sleepAtLeastIgnoreInterrupts(long millis) { long start = Time.now(); while (Time.now() - start < millis) { long timeToSleep = millis - (Time.now() - start); try { Thread.sleep(timeToSleep); } catch (InterruptedException ie) { LOG.warn("interrupted while sleeping", ie); } } }
void checkEmpty() { if (queue.isEmpty()) { emptyStartTime.set(Time.monotonicNow()); } } }