java.lang.Object
org.apache.commons.lang3.time.StopWatch
io.aiven.commons.timing.Timer
public class Timer
extends org.apache.commons.lang3.time.StopWatch
Calculates elapsed time and flags when expired.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.lang3.time.StopWatch
create, createStarted, formatSplitTime, formatTime, getDuration, getMessage, getNanoTime, getSplitDuration, getSplitNanoTime, getSplitTime, getStartInstant, getStartTime, getStopInstant, getStopTime, getTime, getTime, isStarted, isStopped, isSuspended, resume, split, suspend, toSplitString, toString, unsplit
-
Constructor Details
-
Timer
Constructor.- Parameters:
duration- the length of time the timer should run.
-
-
Method Details
-
millisecondsRemaining
public long millisecondsRemaining()Gets the maximum duration for this timer.- Returns:
- the maximum duration for the timer.
-
isExpired
public boolean isExpired()Returnstrueif the timer has expired.- Returns:
trueif the timer has expired.
-
abort
public void abort()Aborts the timer. Timer will report that it has expired until reset is called. -
start
public void start()- Overrides:
startin classorg.apache.commons.lang3.time.StopWatch
-
stop
public void stop()- Overrides:
stopin classorg.apache.commons.lang3.time.StopWatch
-
reset
public void reset()- Overrides:
resetin classorg.apache.commons.lang3.time.StopWatch
-
getBackoffConfig
Gets a Backoff Config for this timer.- Returns:
- a backoff Configuration.
-