Class SessionKeepAliveDaemon
java.lang.Object
java.lang.Thread
org.tentackle.task.DefaultTaskDispatcher
org.tentackle.session.SessionKeepAliveDaemon
- All Implemented Interfaces:
Runnable, Killable, Supervisable, Terminatable, TaskDispatcher
A task dispatcher to keep sessions alive.
- Author:
- harald
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class DefaultTaskDispatcher
INSTANCE_COUNTERFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanup()Does any necessary cleanup after dispatcher thread has been terminated.protected TaskcreateAliveTask(Session session, long interval) Creates a keep alive task.protected ExecutorServiceCreates the executor service.Gets the executor service.voidkeepAliveIntervalChanged(Session session) Handles the change of a keep alive interval of a session.voidremoveAliveTask(Session session) Removes the task for given session.voidrun()Methods inherited from class DefaultTaskDispatcher
addTask, addTaskAndWait, addTaskListener, assertAlive, assertIntervalsInRange, assertNotAlive, assertNotKilled, createLock, executeTask, fireCompleted, fireStarted, getAllTasks, getDeadInterval, getQueueSize, getShutdownIdleTimeout, getSleepInterval, getTask, getTerminationCause, getWaitInterval, interrupt, isDead, isInstanceOfTaskPending, isKilled, isQueueEmpty, isTaskDispatcherThread, isTaskPending, isTerminationRequested, isUsingMutexLocking, kill, lock, lockInternal, nextTask, removeTask, removeTaskListener, requestTermination, setDead, setDeadInterval, setShutdownIdleTimeout, setSleepInterval, setUsingMutexLocking, setWaitInterval, sleepForInterval, startedAt, terminate, terminatedAt, toDiagnosticString, unlock, unlockInternal, waitForTaskMethods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yieldMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Supervisable
getNameMethods inherited from interface TaskDispatcher
isAlive, start
-
Constructor Details
-
SessionKeepAliveDaemon
public SessionKeepAliveDaemon(long minAliveInterval) Creates the daemon.- Parameters:
minAliveInterval- the minimum alive interval
-
-
Method Details
-
cleanup
protected void cleanup()Description copied from class:DefaultTaskDispatcherDoes any necessary cleanup after dispatcher thread has been terminated.- Overrides:
cleanupin classDefaultTaskDispatcher
-
run
public void run()- Specified by:
runin interfaceRunnable- Overrides:
runin classDefaultTaskDispatcher
-
keepAliveIntervalChanged
Handles the change of a keep alive interval of a session.- Parameters:
session- the session
-
removeAliveTask
Removes the task for given session.- Parameters:
session- the session
-
getExecutorService
Gets the executor service.- Returns:
- the executor service
-
createExecutorService
Creates the executor service.- Returns:
- the executor service
-
createAliveTask
-