Package wt.util

Class CallRegistrar

java.lang.Object
wt.util.CallRegistrar

public final class CallRegistrar extends Object
This class allows one body of code to quickly register the entry and exit of significant calls or states and another body of code to easily monitor the number and total duration of such occurrences on both a per thread and per CallRegistrar instance basis.

A single instance of this class should generally be created and held in a static for an entire category of call statistic. For instance, a single instance is held and exposed by RMICallRegistrar to enable monitor of all RMI calls and their duration for the whole JVM.

Supported API: true

Extendable: false

  • Constructor Summary

    Constructors
    Constructor
    Description
    Public constructor

    Supported API: true
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    endCall(long startMillis)
    Deprecated.
    long
    endCallNanos(long startNanos)
    Registers the completion of an call and returns the elapsed time in nanoseconds.
    int
    Returns the number of active (in progress) registered calls.
    long
    Returns the total number of calls which have been registered as having started by the current thread.
    long
    Returns the total number of calls which have been registered as having started by the specified thread.
    long
    Returns the elapsed time in milliseconds of calls which have been registered as having started by the current thread.
    long
    Returns the elapsed time in milliseconds of calls which have been registered as having started by the specified thread.
    long
    Returns the elapsed time in nanoseconds of calls which have been registered as having started by the current thread.
    long
    Returns the elapsed time in nanoseconds of calls which have been registered as having started by the specified thread.
    long
    Deprecated.
    long
    Deprecated.
    long
    Returns the total number of calls (for all threads) which have been registered as having completed.
    long
    Returns the elapsed time in microseconds of calls (for all threads) which have been registered as having completed.
    long
    Returns the elapsed time in milliseconds of calls (for all threads) which have been registered as having completed.
    long
    Deprecated.
    boolean
    Returns whether the current thread is in a registered call.
    boolean
    isInCall(Thread thread)
    Returns whether the specified thread is in a registered call.
    long
    Deprecated.
    long
    Registers the start of an call and returns start time as per System.nanoTime().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CallRegistrar

      public CallRegistrar()
      Public constructor

      Supported API: true
  • Method Details

    • isInCall

      public boolean isInCall()
      Returns whether the current thread is in a registered call.

      Supported API: true
    • isInCall

      public boolean isInCall(Thread thread)
      Returns whether the specified thread is in a registered call.

      Supported API: true
    • getActiveCalls

      public int getActiveCalls()
      Returns the number of active (in progress) registered calls.

      Supported API: true
    • getTotalCalls

      public long getTotalCalls()
      Returns the total number of calls (for all threads) which have been registered as having completed.

      Supported API: true
    • getCallsForThread

      public long getCallsForThread()
      Returns the total number of calls which have been registered as having started by the current thread.

      Supported API: true
    • getCallsForThread

      public long getCallsForThread(Thread thread)
      Returns the total number of calls which have been registered as having started by the specified thread.

      Supported API: true
      Parameters:
      thread - the thread to get the call count for
    • getTotalElapsedTime

      @Deprecated public long getTotalElapsedTime()
      Deprecated.
      Synonym for getTotalElapsedMillis().

      While this method is maintained for backwards compatibility, it is advsiable to use the more explicit getTotalElapsedMillis() method.

      Supported API: true

    • getTotalElapsedMillis

      public long getTotalElapsedMillis()
      Returns the elapsed time in milliseconds of calls (for all threads) which have been registered as having completed.

      Supported API: true
    • getTotalElapsedMicros

      public long getTotalElapsedMicros()
      Returns the elapsed time in microseconds of calls (for all threads) which have been registered as having completed.

      Supported API: true
    • getElapsedTimeForThread

      @Deprecated public long getElapsedTimeForThread()
      Deprecated.
      Synonym for getElapsedMillisForThread().

      While this method is maintained for backwards compatibility, it is advsiable to use the more explicit getElapsedMillisForThread() method.

      Supported API: true

    • getElapsedTimeForThread

      @Deprecated public long getElapsedTimeForThread(Thread thread)
      Deprecated.
      Synonym for getElapsedMillisForThread(Thread).

      While this method is maintained for backwards compatibility, it is advsiable to use the more explicit getElapsedMillisForThread(Thread) method.

      Supported API: true

    • getElapsedMillisForThread

      public long getElapsedMillisForThread()
      Returns the elapsed time in milliseconds of calls which have been registered as having started by the current thread.

      Supported API: true
    • getElapsedMillisForThread

      public long getElapsedMillisForThread(Thread thread)
      Returns the elapsed time in milliseconds of calls which have been registered as having started by the specified thread.

      Supported API: true
      Parameters:
      thread - the thread to get the elapsed call time for
    • getElapsedNanosForThread

      public long getElapsedNanosForThread()
      Returns the elapsed time in nanoseconds of calls which have been registered as having started by the current thread.

      Supported API: true
    • getElapsedNanosForThread

      public long getElapsedNanosForThread(Thread thread)
      Returns the elapsed time in nanoseconds of calls which have been registered as having started by the specified thread.

      Supported API: true
      Parameters:
      thread - the thread to get the elapsed call time for
    • startCall

      @Deprecated public long startCall()
      Deprecated.
      Registers the start of an call and returns start time as per System.currentTimeMillis().

      This method is only retained for compatibility. startCallNanos() should be used instead.

      Supported API: true

      Returns:
      the start time in milliseconds; must be passed to endCall()
    • startCallNanos

      public long startCallNanos()
      Registers the start of an call and returns start time as per System.nanoTime().

      Supported API: true
      Returns:
      the start time in nanoseconds; must be passed to endCallNanos(long)
    • endCall

      @Deprecated public long endCall(long startMillis)
      Deprecated.
      Registers the completion of an call and returns the elapsed time in milliseconds.

      This method is only retained for compatibility. endCallNanos(long) should be used instead.

      Supported API: true

      Parameters:
      startMillis - the start time in milliseconds as returned by startCall()
      Returns:
      the elapsed time of the call in milliseconds
    • endCallNanos

      public long endCallNanos(long startNanos)
      Registers the completion of an call and returns the elapsed time in nanoseconds.

      Supported API: true
      Parameters:
      startNanos - the start time in nanoseconds as returned by startCallNanos()
      Returns:
      the elapsed time of the call in nanoseconds