Package org.zeromq
Class ZTimer
- java.lang.Object
-
- org.zeromq.ZTimer
-
@Deprecated public final class ZTimer extends java.lang.Object
Deprecated.scheduled for removal in future release. Please useZTimer
insteadManages set of timers. Timers can be added with a given interval, when the interval of time expires after addition, handler method is executed with given arguments. Timer is repetitive and will be executed over time until canceled. This is a DRAFT class, and may change without notice.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ZTimer.Handler
Deprecated.useTimerHandler
insteadstatic class
ZTimer.Timer
Deprecated.useZTimer.Timer
instead
-
Constructor Summary
Constructors Constructor Description ZTimer()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ZTimer.Timer
add(long interval, ZTimer.Handler handler, java.lang.Object... args)
Deprecated.Add timer to the set, timer repeats forever, or until cancel is called.boolean
cancel(ZTimer.Timer timer)
Deprecated.useZTimer.Timer.cancel()
insteadint
execute()
Deprecated.Execute the timers.boolean
reset(ZTimer.Timer timer)
Deprecated.useZTimer.Timer.reset()
insteadboolean
setInterval(ZTimer.Timer timer, long interval)
Deprecated.useZTimer.Timer.setInterval(long)
insteadint
sleepAndExecute()
Deprecated.Sleeps until at least one timer can be executed and execute the timers.long
timeout()
Deprecated.Returns the time in millisecond until the next timer.
-
-
-
Field Detail
-
timer
private final ZTimer timer
Deprecated.
-
-
Method Detail
-
add
public ZTimer.Timer add(long interval, ZTimer.Handler handler, java.lang.Object... args)
Deprecated.Add timer to the set, timer repeats forever, or until cancel is called.- Parameters:
interval
- the interval of repetition in milliseconds.handler
- the callback called at the expiration of the timer.args
- the optional arguments for the handler.- Returns:
- an opaque handle for further cancel.
-
setInterval
@Deprecated public boolean setInterval(ZTimer.Timer timer, long interval)
Deprecated.useZTimer.Timer.setInterval(long)
insteadChanges the interval of the timer. This method is slow, canceling existing and adding a new timer yield better performance.- Parameters:
timer
- the timer to change the interval to.- Returns:
- true if set, otherwise false.
-
reset
@Deprecated public boolean reset(ZTimer.Timer timer)
Deprecated.useZTimer.Timer.reset()
insteadReset the timer. This method is slow, canceling existing and adding a new timer yield better performance.- Parameters:
timer
- the timer to reset.- Returns:
- true if reset, otherwise false.
-
cancel
@Deprecated public boolean cancel(ZTimer.Timer timer)
Deprecated.useZTimer.Timer.cancel()
insteadCancel a timer.- Parameters:
timer
- the timer to cancel.- Returns:
- true if cancelled, otherwise false.
-
timeout
public long timeout()
Deprecated.Returns the time in millisecond until the next timer.- Returns:
- the time in millisecond until the next timer.
-
execute
public int execute()
Deprecated.Execute the timers.- Returns:
- the number of timers triggered.
-
sleepAndExecute
public int sleepAndExecute()
Deprecated.Sleeps until at least one timer can be executed and execute the timers.- Returns:
- the number of timers triggered.
-
-