- java.lang.Object
-
- java.lang.Thread
-
- org.tentackle.task.DefaultTaskDispatcher
-
- org.tentackle.session.SessionKeepAliveDaemon
-
- All Implemented Interfaces:
java.lang.Runnable,org.tentackle.daemon.Killable,org.tentackle.daemon.Supervisable,org.tentackle.daemon.Terminatable,org.tentackle.task.TaskDispatcher
public class SessionKeepAliveDaemon extends org.tentackle.task.DefaultTaskDispatcherA task dispatcher to keep sessions alive.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description SessionKeepAliveDaemon(long minAliveInterval)Creates the daemon.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanup()protected org.tentackle.task.TaskcreateAliveTask(Session session, long interval)Creates a keep alive task.protected java.util.concurrent.ExecutorServicecreateExecutorService()Creates the executor service.java.util.concurrent.ExecutorServicegetExecutorService()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 org.tentackle.task.DefaultTaskDispatcher
addTask, addTaskAndWait, addTaskListener, assertAlive, assertIntervalsInRange, assertNotAlive, assertNotKilled, createLock, executeTask, fireCompleted, fireStarted, getAllTasks, getDeadInterval, getQueueSize, getShutdownIdleTimeout, getSleepInterval, getTask, getTerminationCause, interrupt, isDead, isInstanceOfTaskPending, isKilled, isQueueEmpty, isTaskDispatcherThread, isTaskPending, isTerminationRequested, isUsingMutexLocking, kill, lock, lockInternal, nextTask, removeTask, removeTaskListener, requestTermination, setDead, setDeadInterval, setShutdownIdleTimeout, setSleepInterval, setUsingMutexLocking, sleepForInterval, startedAt, terminate, terminatedAt, toDiagnosticString, unlock, unlockInternal, waitForTask
-
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, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
cleanup
protected void cleanup()
- Overrides:
cleanupin classorg.tentackle.task.DefaultTaskDispatcher
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classorg.tentackle.task.DefaultTaskDispatcher
-
keepAliveIntervalChanged
public void keepAliveIntervalChanged(Session session)
Handles the change of a keep alive interval of a session.- Parameters:
session- the session
-
removeAliveTask
public void removeAliveTask(Session session)
Removes the task for given session.- Parameters:
session- the session
-
getExecutorService
public java.util.concurrent.ExecutorService getExecutorService()
Gets the executor service.- Returns:
- the executor service
-
createExecutorService
protected java.util.concurrent.ExecutorService createExecutorService()
Creates the executor service.- Returns:
- the executor service
-
createAliveTask
protected org.tentackle.task.Task createAliveTask(Session session, long interval)
Creates a keep alive task.- Parameters:
session- the sessioninterval- the keep-alive interval in milliseconds- Returns:
- the created task
-
-