|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.sessions.impl.SessionTerminator
A session listener that starts an expiry timer whenever the session has no participants.
If the expiry time is reached, the session is automatically terminated and any subsequent attempts to join the session will result in a "no such session" error. If the expiry timer is running an a participant joins the session, the expiry timer will be cancelled, and a new timer will be created only when the session has no participants again. In other words, a session will not expire as long as it has one or more participants.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
private static DAILogger |
LOG
|
private SessionManager |
mManager
|
private boolean |
mSessionAlive
|
private java.util.TimerTask |
mTerminatorTask
|
private java.util.Timer |
mTimer
|
Constructor Summary | |
SessionTerminator(SessionManager manager)
Constructs a SessionTerminator that uses the specified
session manager. |
Method Summary | |
private java.util.TimerTask |
createTimerTask(InternalSession session)
Creates a TimerTask that will terminate a
session. |
void |
sessionCleanedUp(SessionEvent event)
Invoked when a session is cleaned up during its termination. |
void |
sessionJoined(SessionEvent event)
Invoked when a session participant joins a session. |
void |
sessionLeft(SessionEvent event)
Invoked when a session participant leaves a session. |
private void |
terminateSession(InternalSession session)
Terminates the specified session and logs an error if one occurs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
private final java.util.Timer mTimer
private java.util.TimerTask mTerminatorTask
private final SessionManager mManager
private boolean mSessionAlive
Constructor Detail |
public SessionTerminator(SessionManager manager)
SessionTerminator
that uses the specified
session manager.
manager
- The session manager to use for terminating the session when
expiry occurs.Method Detail |
public void sessionJoined(SessionEvent event)
SessionListener
sessionJoined
in interface SessionListener
event
- Describes the details of the event.public void sessionLeft(SessionEvent event)
SessionListener
sessionLeft
in interface SessionListener
event
- Describes the details of the event.public void sessionCleanedUp(SessionEvent event)
SessionListener
sessionCleanedUp
in interface SessionListener
event
- Describes the details of the event.private java.util.TimerTask createTimerTask(InternalSession session)
TimerTask
that will terminate a
session.
session
- The session that the TimerTask
will
terminate.
TimerTask
.private void terminateSession(InternalSession session)
session
- The session to terminate.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |