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:
Heartbeater
,KeepAliveRunner
public abstract class KeepAlive extends java.lang.Thread
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionImpl
conn
protected int
keepAliveInterval
protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Modifier Constructor Description protected
KeepAlive(ConnectionImpl conn, java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
doKeepAlive()
int
getKeepAliveInterval()
Get KeepAlive interval in secondsboolean
isEnabled()
KeepAlive enabled based on KeepAlive intervalvoid
run()
void
setKeepAliveInterval(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:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
doKeepAlive
protected abstract void doKeepAlive() throws TransportException, ConnectionException
-
-