Brooklyn

brooklyn.util.time
[Java] Class CountdownTimer

java.lang.Object
  brooklyn.util.time.CountdownTimer

public class CountdownTimer

Method Summary
Duration getDurationElapsed()

return how long the timer has been running (longer than limit if isExpired())

Duration getDurationRemaining()

returns how much time is left (negative if isExpired())

Duration getLimit()

how much total time this timer should run for

Stopwatch getStopwatch()

returns underlying stopwatch, which caller can inspect for more details or modify

boolean isExpired()

true iff the timer has been running for the given time

static CountdownTimer newInstancePaused(Duration duration)

static CountdownTimer newInstanceStarted(Duration duration)

CountdownTimer pause()

pauses the timer, if running; no-op if not running

CountdownTimer start()

starts the timer, either initially or if pause()d; no-op if already running

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

getDurationElapsed

public Duration getDurationElapsed()
return how long the timer has been running (longer than limit if isExpired())


getDurationRemaining

public Duration getDurationRemaining()
returns how much time is left (negative if isExpired())


getLimit

public Duration getLimit()
how much total time this timer should run for


getStopwatch

public Stopwatch getStopwatch()
returns underlying stopwatch, which caller can inspect for more details or modify


isExpired

public boolean isExpired()
true iff the timer has been running for the given time


newInstancePaused

public static CountdownTimer newInstancePaused(Duration duration)


newInstanceStarted

public static CountdownTimer newInstanceStarted(Duration duration)


pause

public CountdownTimer pause()
pauses the timer, if running; no-op if not running


start

public CountdownTimer start()
starts the timer, either initially or if pause()d; no-op if already running


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.