java.lang.Object
com.pervasive.datarush.monitoring.AbstractIntervalTimerSupplier
com.pervasive.datarush.monitoring.IntervalTimer
- All Implemented Interfaces:
IntervalTimerSupplier,StatisticSupplier
Basic mutable implementation of
AccumulatedTimerSupplier.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the end time if finished, the current time if running, or an undefined value if never started.longThis will return the start time or an undefined value if never started.getState()Returns the current state of the supplier.snapshot()Creates a snapshot of this timer.voidstart()Starts the timer; time will begin to accumulatevoidstop()Stops the timer.Methods inherited from class com.pervasive.datarush.monitoring.AbstractIntervalTimerSupplier
getTimeIntervalMillis
-
Constructor Details
-
IntervalTimer
public IntervalTimer()Creates a new timer in theStatisticState.UNAVAILABLEstate.
-
-
Method Details
-
getState
Description copied from interface:StatisticSupplierReturns the current state of the supplier.- Returns:
- the state of the supplier
-
start
public void start()Starts the timer; time will begin to accumulate- Throws:
IllegalStateException- if the timer is already started or has finished
-
stop
public void stop()Stops the timer. This method can be called while in any state and thus is safe to call within afinallyblock. -
snapshot
Description copied from interface:IntervalTimerSupplierCreates a snapshot of this timer. If the timer is in theStatisticState.ACTIVE- Returns:
- a snapshot of this statistic.
-
getStartTimeMillis
public long getStartTimeMillis()Description copied from interface:IntervalTimerSupplierThis will return the start time or an undefined value if never started.- Returns:
- the start time or an undefined value if never started.
-
getEndTimeMillis
public long getEndTimeMillis()Description copied from interface:IntervalTimerSupplierReturns the end time if finished, the current time if running, or an undefined value if never started. If this timer corresponds to a snapshot of a timer that is in theStatisticState.ACTIVEstate, then this value will reflect the time at which the snapshot was taken.- Returns:
- the end time if finished, the current time if running, or an undefined value if never started
-