protected static class AbstractADEPT2Service.ActiveSessions
extends java.lang.Object
| Constructor and Description |
|---|
ActiveSessions()
Constructor creating and initialising the fields.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout)
Waits the designated time in milliseconds (0 means waiting until
condition is true) until no sessions are active any more.
|
int |
getCurrentParentSessionCount()
Returns the number of currently active parent sessions; subsessions do
not count separately.
|
int |
getCurrentSessionCount()
Returns the total number of currently active sessions; subsessions are
counted separately.
|
void |
interruptActiveSessions(java.util.Set<java.lang.Thread> nonInterrupted)
Interrupts the threads that currently execute active sessions except the
designated one.
|
boolean |
isActive(SessionToken session)
Returns whether the designated session token (or a session token having
the same top-level session) is currently active or privileged.
|
void |
privilegeActiveSessions()
Privileges all currently active session to allow their normal termination
|
protected void |
privilegeSession(SessionToken session)
Privileges the designated session, that is the session may access the
service even when shutting down or initialising.
|
protected void |
sessionActive(SessionToken session)
Registers the designated session as active and also tracks the current
thread.
|
protected boolean |
sessionFinished(SessionToken session)
Deregisters the designated session and also removes the current thread.
|
public ActiveSessions()
protected void sessionActive(SessionToken session)
This method synchronises on this object. So be sure not to hold any locks or at least acquire the locks in a well-defined order.
session - The session token with which a method is called and
therefore active.protected boolean sessionFinished(SessionToken session)
This method synchronises on this object. So be sure not to hold any locks or at least acquire the locks in a well-defined order.
session - The session token with which a method has been executed
and which is not active any more in this service.public int getCurrentParentSessionCount()
public boolean isActive(SessionToken session)
session - The session to check its top-level session to be currently
active.public int getCurrentSessionCount()
protected void privilegeSession(SessionToken session)
session - The session which should be privileged.public boolean awaitTermination(long timeout)
throws java.lang.InterruptedException
timeout - The time in milliseconds to wait until no more sessions
are active.java.lang.InterruptedException - If the current thread is interrupted while
waiting for the termination, an
InterruptedException will be thrown.public void interruptActiveSessions(java.util.Set<java.lang.Thread> nonInterrupted)
nonInterrupted - The threads that are not to be interrupted.public void privilegeActiveSessions()