Package net.schmizz.keepalive
Class KeepAlive
- java.lang.Object
-
- java.lang.Thread
-
- net.schmizz.keepalive.KeepAlive
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
KeepAliveRunner
public abstract class KeepAlive extends java.lang.Thread
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionImplconnprotected intkeepAliveIntervalprotected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Modifier Constructor Description protectedKeepAlive(ConnectionImpl conn, java.lang.String name)
-
Method Summary
Modifier and Type Method Description protected abstract voiddoKeepAlive()intgetKeepAliveInterval()Get KeepAlive interval in secondsbooleanisEnabled()KeepAlive enabled based on KeepAlive intervalvoidrun()voidsetKeepAliveInterval(int keepAliveInterval)Set KeepAlive interval in seconds-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
conn
protected final ConnectionImpl conn
-
keepAliveInterval
protected int keepAliveInterval
-
-
Constructor Detail
-
KeepAlive
protected KeepAlive(ConnectionImpl conn, java.lang.String name)
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
KeepAlive enabled based on KeepAlive interval- Returns:
- Enabled when KeepInterval is greater than 0
-
getKeepAliveInterval
public int getKeepAliveInterval()
Get KeepAlive interval in seconds- Returns:
- KeepAlive interval in seconds defaults to 0
-
setKeepAliveInterval
public void setKeepAliveInterval(int keepAliveInterval)
Set KeepAlive interval in seconds- Parameters:
keepAliveInterval- KeepAlive interval in seconds
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
doKeepAlive
protected abstract void doKeepAlive() throws TransportException, ConnectionException
-
-