Package org.simpleframework.http.core
Class Timer
- java.lang.Object
-
- org.simpleframework.http.core.Timer
-
class Timer extends java.lang.Object
TheTimer
object is used to set the time a specific event occurred at. The time can be set only once from that point on all attempts to set the time are ignored. This makes this timer useful when there is a desire to record when a certain scenario was first encountered, for example when a request is first read from the underlying transport.
-
-
Constructor Summary
Constructors Constructor Description Timer(java.util.concurrent.TimeUnit unit)
Constructor for theTimer
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
get()
This is used to get the time for a specific event.boolean
isSet()
This is used to determine if the timer has been set.void
set()
This is used to set the time for a specific event.
-
-
-
Method Detail
-
isSet
public boolean isSet()
This is used to determine if the timer has been set. If theset
method has been called on this instance before then this will return true, otherwise false.- Returns:
- this returns true if the timer has been set
-
set
public void set()
This is used to set the time for a specific event. Invoking this method multiple times will have no effect as the time is set for the first invocation only. Setting the time in this manner enables start times to be recorded effectively.
-
get
public long get()
This is used to get the time for a specific event. The time returned by this method is given in the time unit specified on construction of the instance.- Returns:
- this returns the time recorded by the timer
-
-