Package org.jboss.as.server
Class ElapsedTime
java.lang.Object
org.jboss.as.server.ElapsedTime
Tracks elapsed time since either JVM start or a moment of initialization. The start point
for the calculation can be 'reset', allowing the calculation provided by an instance to
account for a conceptual 'restart'.
-
Method Summary
Modifier and TypeMethodDescriptionCreate an ElapsedTime that tracks elapsed time from the current time, but whose starting point will automatically beresetif this object is reset.longGet the elapsed time in milliseconds since this tracker's start point.longGets the tracker's start point.voidreset()Reset this tracker to begin tracking from theJVM start time.static ElapsedTimeCreates a tracker that tracks elapsed time since JVM start.static ElapsedTimeCreates a tracker that tracks elapsed time since the invocation of this method.
-
Method Details
-
startingFromJvmStart
Creates a tracker that tracks elapsed time since JVM start.- Returns:
- the tracker. Will not return
null.
-
startingFromNow
Creates a tracker that tracks elapsed time since the invocation of this method.- Returns:
- the tracker. Will not return
null.
-
getStartTime
public long getStartTime()Gets the tracker's start point.- Returns:
- the start point for this tracker, in milliseconds since the epoch.
-
getElapsedTime
public long getElapsedTime()Get the elapsed time in milliseconds since this tracker's start point.- Returns:
- the elapsed time
-
reset
public void reset()Reset this tracker to begin tracking from theJVM start time. Any ElapsedTime objects that were returned from this object'scheckpoint()method will also be reset. Meant for cases where the 'origin' moment may have changed and this tracker should be updated accordingly -- for example, in a 'restored' JVM that supports some form of checkpoint and restore behavior. -
checkpoint
Create an ElapsedTime that tracks elapsed time from the current time, but whose starting point will automatically beresetif this object is reset.
-