Tabnine Logo
Time
Code IndexAdd Tabnine to your IDE (free)

How to use
Time
in
org.apache.hadoop.util

Best Java code snippets using org.apache.hadoop.util.Time (Showing top 20 results out of 468)

origin: apache/hive

 @Override
 public long getTime() {
  return Time.monotonicNow();
 }
}
origin: org.apache.hadoop/hadoop-common

/**
 * 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;
}
origin: org.apache.hadoop/hadoop-common

 /**
  * 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();
 }
}
origin: org.apache.hadoop/hadoop-hdfs

private void updateInternalLeaseHolder() {
 this.lastHolderUpdateTime = Time.monotonicNow();
 this.internalLeaseHolder = HdfsServerConstants.NAMENODE_LEASE_HOLDER +
   "-" + Time.formatTime(Time.now());
}
origin: org.apache.hadoop/hadoop-hdfs

/**
 * 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());
}
origin: org.apache.hadoop/hadoop-common

/**
 * 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;
}

origin: org.apache.hadoop/hadoop-common

  + "; 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));
origin: org.apache.hadoop/hadoop-common

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;
}
origin: org.apache.hadoop/hadoop-common

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;
}
origin: org.apache.hadoop/hadoop-common

/**
 * 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(); }
origin: org.apache.hadoop/hadoop-common

/**
 * 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();
}
origin: org.apache.hadoop/hadoop-common

public LoadBalancingKMSClientProvider(URI providerUri,
  KMSClientProvider[] providers, Configuration conf) {
 this(providerUri, providers, Time.monotonicNow(), conf);
}
origin: org.apache.hadoop/hadoop-common

/**
 * 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();
}
origin: org.apache.hadoop/hadoop-common

synchronized private boolean isExpired() {
 return Time.monotonicNow() - lastUpdateTime > timeout;
}
origin: org.apache.hadoop/hadoop-common

/** 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);
}
origin: org.apache.hadoop/hadoop-common

@VisibleForTesting
long now() {
 return Time.monotonicNow();
}
origin: org.apache.hadoop/hadoop-common

/** Update lastActivity with the current time. */
private void touch() {
 lastActivity.set(Time.now());
}
origin: org.apache.hadoop/hadoop-common

/** Is the queue empty for more than the given time in millisecond? */
boolean isEmpty(long time) {
 return Time.monotonicNow() - emptyStartTime.get() > time
   && queue.isEmpty();
}
origin: org.apache.hadoop/hadoop-common

/**
 * 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);
  }
 }
}
origin: org.apache.hadoop/hadoop-common

 void checkEmpty() {
  if (queue.isEmpty()) {
   emptyStartTime.set(Time.monotonicNow());
  }
 }
}
org.apache.hadoop.utilTime

Javadoc

Utility methods for getting the time and computing intervals.

Most used methods

  • monotonicNow
  • now
    Current system time. Do not use this to calculate a duration or interval to sleep, because it will b
  • monotonicNowNanos
    Same as #monotonicNow() but returns its result in nanoseconds. Note that this is subject to the same
  • formatTime
    Convert time in millisecond to human readable format.

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JList (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now