@ThreadSafe public final class ScheduledTimer extends Object implements HeartbeatTimer
ScheduledTimerblocks on the
tick()method, waiting for someone to invoke the
schedule()method. The contract of this class is that the
schedule()method should only be called after the
tick()was called and that there is exactly one
schedule()method is not meant to be invoked directly. Instead, the
HeartbeatSchedulerclass should be used.
|Constructor and Description|
Creates a new instance of
|Modifier and Type||Method and Description|
Schedules execution of the heartbeat.
Waits until next heartbeat should be executed.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ScheduledTimer(String threadName, long intervalMs)
threadName- the thread name
intervalMs- the heartbeat interval (unused)
public String getThreadName()
protected void schedule()
public void tick() throws InterruptedException
InterruptedException- if the thread is interrupted while waiting
Copyright © 2023. All Rights Reserved.