Codota Logo
SystemTimer
Code IndexAdd Codota to your IDE (free)

How to use
SystemTimer
in
com.yahoo.concurrent

Best Java code snippets using com.yahoo.concurrent.SystemTimer (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: com.yahoo.vespa/messagebus

/**
 * Constructs a new instance of this class to maintain sending of a single message.
 *
 * @param mbus     The message bus that owns this.
 * @param net      The network layer to transmit through.
 * @param resender The resender to use.
 */
public SendProxy(MessageBus mbus, Network net, Resender resender) {
  this.mbus = mbus;
  this.net = net;
  this.resender = resender;
  sendTime = SystemTimer.INSTANCE.milliTime();
}
origin: com.yahoo.vespa/messagebus

/**
 * <p>Returns the number of milliseconds that remain right now before this message times out. This is a function of
 * {@link #getTimeReceived()}, {@link #getTimeRemaining()} and current time. Whenever a message is transmitted by
 * message bus, a new remaining time is calculated and serialized as <code>timeRemaining = timeRemaining -
 * (currentTime - timeReceived)</code>. This means that we are doing an over-estimate of remaining time, as we are
 * only factoring in the time used by the application above message bus.</p>
 *
 * @return The remaining time in milliseconds.
 */
public long getTimeRemainingNow() {
  return timeRemaining - (SystemTimer.INSTANCE.milliTime() - timeReceived);
}
origin: com.yahoo.vespa/messagebus

public void register(SendBlockedMessages sender) {
  blockedSenders.put(sender, SystemTimer.INSTANCE.milliTime());
}
origin: com.yahoo.vespa/messagebus

/**
 * <p>This is a convenience method to call {@link #setTimeReceived(long)} passing the current time as argument.</p>
 *
 * @return This, to allow chaining.
 */
public Message setTimeReceivedNow() {
  return setTimeReceived(SystemTimer.INSTANCE.milliTime());
}
origin: com.yahoo.vespa/messagebus

/**
 * Invokes {@link RoutingNode#send()} on all routing nodes that are applicable for sending at the current time.
 */
public void resendScheduled() {
  if (queue.isEmpty()) return;
  List<RoutingNode> sendList = new LinkedList<RoutingNode>();
  long now = SystemTimer.INSTANCE.milliTime();
  while (!queue.isEmpty() && queue.peek().time <= now) {
    sendList.add(queue.poll().node);
  }
  for (RoutingNode node : sendList) {
    node.getTrace().trace(TraceLevel.COMPONENT, "Resender resending message.");
    node.send();
  }
}
origin: com.yahoo.vespa/docproc

/**
 * Call the DocumentProcessor of this call.
 *
 * @param processing the Processing object to use
 * @return the progress of the DocumentProcessor that was called
 */
public DocumentProcessor.Progress call(Processing processing) {
  try {
    int numDocs = processing.getDocumentOperations().size();
    schemaMapProcessing(processing);
    long startTime = SystemTimer.INSTANCE.milliTime();
    DocumentProcessor.Progress retval = processor.process(processing);
    incrementProcTime(SystemTimer.INSTANCE.milliTime() - startTime);
    incrementDocs(numDocs);
    return retval;
  } finally {
    unwrapSchemaMapping(processing);
  }
}
origin: com.yahoo.vespa/container-search

long startTime = SystemTimer.INSTANCE.milliTime();
long timeLeft  = timeout;
    timeLeft = timeout - (SystemTimer.INSTANCE.milliTime() - startTime);
origin: com.yahoo.vespa/messagebus

/**
 * Schedules the given node for resending, if enabled. This will invoke {@link com.yahoo.messagebus.routing.RoutingNode#prepareForRetry()}
 * if the node was queued. This method is NOT thread-safe, and should only be called by the messenger thread.
 *
 * @param node  The node to resend.
 * @return True if the node was queued.
 */
public boolean scheduleRetry(RoutingNode node) {
  Message msg = node.getMessage();
  if (!msg.getRetryEnabled()) {
    return false;
  }
  int retry = msg.getRetry() + 1;
  double delay = node.getReply().getRetryDelay();
  if (delay < 0) {
    delay = retryPolicy.getRetryDelay(retry);
  }
  if (msg.getTimeRemainingNow() * 0.001 - delay <= 0) {
    node.addError(ErrorCode.TIMEOUT, "Timeout exceeded by resender, giving up.");
    return false;
  }
  node.prepareForRetry(); // consumes the reply
  node.getTrace().trace(TraceLevel.COMPONENT,
             "Message scheduled for retry " + retry + " in " + delay + " seconds.");
  msg.setRetry(retry);
  queue.add(new Entry(node, SystemTimer.INSTANCE.milliTime() + (long)(delay * 1000)));
  return true;
}
com.yahoo.concurrentSystemTimer

Javadoc

This is an implementation of Timer that is backed by an actual system timer.

Most used methods

  • milliTime

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now