- java.lang.Object
-
- com.pervasive.datarush.monitoring.AbstractIntervalTimerSupplier
-
- com.pervasive.datarush.monitoring.IntervalTimer
-
- All Implemented Interfaces:
IntervalTimerSupplier
,StatisticSupplier
public final class IntervalTimer extends AbstractIntervalTimerSupplier
Basic mutable implementation ofAccumulatedTimerSupplier
.
-
-
Constructor Summary
Constructors Constructor Description IntervalTimer()
Creates a new timer in theStatisticState.UNAVAILABLE
state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getEndTimeMillis()
Returns the end time if finished, the current time if running, or an undefined value if never started.long
getStartTimeMillis()
This will return the start time or an undefined value if never started.StatisticState
getState()
Returns the current state of the supplier.IntervalTimerSnapshot
snapshot()
Creates a snapshot of this timer.void
start()
Starts the timer; time will begin to accumulatevoid
stop()
Stops the timer.-
Methods inherited from class com.pervasive.datarush.monitoring.AbstractIntervalTimerSupplier
getTimeIntervalMillis
-
-
-
-
Constructor Detail
-
IntervalTimer
public IntervalTimer()
Creates a new timer in theStatisticState.UNAVAILABLE
state.
-
-
Method Detail
-
getState
public StatisticState getState()
Description copied from interface:StatisticSupplier
Returns 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 afinally
block.
-
snapshot
public IntervalTimerSnapshot snapshot()
Description copied from interface:IntervalTimerSupplier
Creates 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:IntervalTimerSupplier
This 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:IntervalTimerSupplier
Returns 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.ACTIVE
state, 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
-
-