public class HeartbeatJinn extends Thread implements Connection.Listener
ConnectionSpec.getHeartbeat()
heartbeat interval.
HeartbeatJinn
s are Connection.Listener
s, 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.UncaughtExceptionHandler
MAX_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, yield
public 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 Runnable
run
in class Thread
Thread.run()
public void onEvent(Connection.Event event)
onEvent
in interface Connection.Listener
Connection.Listener.onEvent(org.jredis.connector.Connection.Event)
Copyright © 2009–2015. All rights reserved.