- java.lang.Object
-
- org.tentackle.task.AbstractTask
-
- org.tentackle.session.SessionKeepAliveTask
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<org.tentackle.task.Task>,java.lang.Runnable,org.tentackle.task.Task
public class SessionKeepAliveTask extends org.tentackle.task.AbstractTaskThe task to keep a session alive.
The task uses theExecutorServiceto spawn asynchroneous pings. This is necessary because a remote session may block on slow or bad communication lines which should not block the whole task dispatcher.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SessionKeepAliveTask(SessionKeepAliveDaemon daemon, Session session, long interval, long timeOut)Creates a keep alive task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.Callable<java.lang.Boolean>createAliveCallable()Creates the alive callable.protected java.util.concurrent.Callable<java.lang.Boolean>createCloseCallable()Creates the close callable.voidrun()java.lang.StringtoString()-
Methods inherited from class org.tentackle.task.AbstractTask
addTaskListener, compareTo, equals, fireCompleted, fireStarted, getCause, getCompleted, getDispatcher, getId, getRepeatInterval, getResult, getScheduledEpochalTime, getStarted, hashCode, isInterruptable, removeTaskListener, setCause, setCompleted, setDispatcher, setId, setRepeatInterval, setResult, setScheduledEpochalTime, setStarted
-
-
-
-
Constructor Detail
-
SessionKeepAliveTask
public SessionKeepAliveTask(SessionKeepAliveDaemon daemon, Session session, long interval, long timeOut)
Creates a keep alive task.- Parameters:
daemon- the keep alive daemonsession- the sessioninterval- the check interval in milliseconds, ≤ 0 to closetimeOut- the timeout interval in milliseconds
-
-
Method Detail
-
run
public void run()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
createAliveCallable
protected java.util.concurrent.Callable<java.lang.Boolean> createAliveCallable()
Creates the alive callable.- Returns:
- the callable
-
createCloseCallable
protected java.util.concurrent.Callable<java.lang.Boolean> createCloseCallable()
Creates the close callable.- Returns:
- the callable
-
-