public final class HeartbeatScheduler extends Object
| Constructor and Description |
|---|
HeartbeatScheduler() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addTimer(ScheduledTimer timer) |
static void |
await(String name)
Waits until the given thread can be executed.
|
static boolean |
await(String name,
long time,
TimeUnit unit)
Waits until the given thread can be executed or the given timeout expires.
|
static Set<String> |
getThreadNames() |
static void |
removeTimer(ScheduledTimer timer) |
static void |
schedule(String threadName)
Schedules execution of a heartbeat for the given thread.
|
public static void addTimer(ScheduledTimer timer)
timer - a timer to add to the schedulerpublic static void removeTimer(ScheduledTimer timer)
timer - a timer to remove from the schedulerpublic static Set<String> getThreadNames()
public static void schedule(String threadName)
threadName - a name of the thread for which heartbeat is to be executedpublic static void await(String name) throws InterruptedException
name - a name of the thread to wait forInterruptedExceptionpublic static boolean await(String name, long time, TimeUnit unit) throws InterruptedException
name - a name of the thread to wait fortime - the maximum time to waitunit - the time unit of the time argumentfalse if the waiting time detectably elapsed before return from the method,
else trueInterruptedExceptionCopyright © 2015. All Rights Reserved.