public class HeartbeatJinn extends Thread implements Connection.Listener
ConnectionSpec.getHeartbeat() heartbeat interval.
HeartbeatJinns are Connection.Listeners, and rely
on Connection event propagation to synchronize their activity
with the associated connection.
The connection must only call Thread.start() when it has
established its connectivity.
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
HeartbeatJinn(Connection conn,
int periodInSecs,
String name)
Instantiate and initialize the HeartbeatJinn.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onEvent(Connection.Event event) |
void |
run()
Your basic infinite loop with branchings on connection state and modality
|
void |
shutdown() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic HeartbeatJinn(Connection conn, int periodInSecs, String name)
conn - associated with this instnaceperiodInSecs - a reasonable value is 1. Internally converted to millisecs.name - associated with this (heartbeat) thread.public void shutdown()
public void run()
TODO: run loop should be a proper state machine. TODO: delouse this baby ..
run in interface Runnablerun in class ThreadThread.run()public void onEvent(Connection.Event event)
onEvent in interface Connection.ListenerConnection.Listener.onEvent(org.jredis.connector.Connection.Event)Copyright © 2009–2021. All rights reserved.