|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.echomine.jabber.KeepAlive
public class KeepAlive
The class will run in the background as a thread that periodically "pings" the socket to make sure that the connection is not stale. If the connection is stale, then the session will be disconnected. This solves the problem where you have no idea when you were disconnected from the server and your client still think that it is.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
KeepAlive(JabberSession session,
int timeout)
Creates a keepalive thread that does NOT run as a daemon thread. |
|
KeepAlive(JabberSession session,
int timeout,
boolean isDaemon)
|
Method Summary | |
---|---|
void |
run()
|
void |
shutdown()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KeepAlive(JabberSession session, int timeout)
session
- the session that you want to do keep alive pingstimeout
- time interval between pings. Must be > 0public KeepAlive(JabberSession session, int timeout, boolean isDaemon)
session
- the session that you want to do keep alive pingstimeout
- time interval between pings. Must be > 0isDaemon
- daemon thread?Method Detail |
---|
public void shutdown()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |