|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--keepalive.keepalive.KeepAlive | +--keepalive.keepalive.HeartbeatClient
Sends a "heartbeat" which is echoed by HeartbeatServer,
closing the socket if there is silence for a suspicious time period.
Combines ActiveKeepAlive (periodically sends a message)
with PassiveKeepAlive (listens for suspicious silence in
incoming data) and AreYouThere (expects a response to
its messages). Unlike PassiveKeepAlive, but like AreYouThere
it will automatically close the socket when the timeout period
passes with no incoming data.
For an alternate implementation, not as simple but more conservative of
bandwidth, see the JavaDocs for HeartbeatServer messageReceived(String s)
HeartbeatServer.messageReceived(String s)
Fields inherited from class keepalive.keepalive.KeepAlive |
ARE_YOU_THERE, endRequested, I_HEAR_YOU, TIME_BETWEEN_ACTIVE_PROBES |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
HeartbeatClient()
Create a new Keep-Alive. |
|
HeartbeatClient(Receiver receiver,
Sender sender)
Create a new Keep-Alive. |
Method Summary | |
void |
run()
Require the subclasses to implement run(), to prevent them from using the run() method in class Thread with a null body. |
Methods inherited from class keepalive.keepalive.KeepAlive |
end, endRequested, getDummyString, getReceiver, getSender, getSilentTimeForIncoming, setReceiver, setSender |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public HeartbeatClient(Receiver receiver, Sender sender)
receiver
- sender
- public HeartbeatClient()
Method Detail |
public void run()
KeepAlive
run
in class KeepAlive
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |