- java.lang.Object
-
- com.pervasive.datarush.monitoring.AccumulatedTimer
-
- All Implemented Interfaces:
AccumulatedTimerSupplier
,StatisticSupplier
public final class AccumulatedTimer extends Object implements AccumulatedTimerSupplier
Basic mutable implementation ofAccumulatedTimerSupplier
.
-
-
Constructor Summary
Constructors Constructor Description AccumulatedTimer()
Creates a new timer in theStatisticState.UNAVAILABLE
state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAccumulatedTimeMillis()
The accumulated time so far.StatisticState
getState()
Returns the current state of the supplier.void
pause()
Pauses the timer; time will not accumulate until the next call tostart()
.AccumulatedTimerSupplier
snapshot()
Creates a snapshot of this timer.void
start()
Starts the timer; time will begin to accumulatevoid
stop()
Stops the timer.
-
-
-
Constructor Detail
-
AccumulatedTimer
public AccumulatedTimer()
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.- Specified by:
getState
in interfaceStatisticSupplier
- 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
-
pause
public void pause()
Pauses the timer; time will not accumulate until the next call tostart()
.
-
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.
-
getAccumulatedTimeMillis
public long getAccumulatedTimeMillis()
Description copied from interface:AccumulatedTimerSupplier
The accumulated time so far. For aggregations, this is the sum over all partitions of the to be the sum over all partitions of the partition'sAccumulatedTimerSupplier.getAccumulatedTimeMillis()
. This value is undefined if the timer isStatisticState.UNAVAILABLE
.- Specified by:
getAccumulatedTimeMillis
in interfaceAccumulatedTimerSupplier
- Returns:
- the accumulated time in milliseconds.
-
snapshot
public AccumulatedTimerSupplier snapshot()
Description copied from interface:AccumulatedTimerSupplier
Creates a snapshot of this timer. If the timer is in theStatisticState.ACTIVE
- Specified by:
snapshot
in interfaceAccumulatedTimerSupplier
- Specified by:
snapshot
in interfaceStatisticSupplier
- Returns:
- a snapshot of this statistic.
-
-