Package net.schmizz.keepalive
Class KeepAlive
java.lang.Object
java.lang.Thread
net.schmizz.keepalive.KeepAlive
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
Heartbeater
,KeepAliveRunner
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConnectionImpl
protected int
protected final org.slf4j.Logger
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
int
Get KeepAlive interval in secondsboolean
KeepAlive enabled based on KeepAlive intervalvoid
run()
void
setKeepAliveInterval
(int keepAliveInterval) Set KeepAlive interval in secondsMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
log
protected final org.slf4j.Logger log -
conn
-
keepAliveInterval
protected int keepAliveInterval
-
-
Constructor Details
-
KeepAlive
-
-
Method Details
-
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() -
doKeepAlive
-