|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.common.MCRSessionMgr
public class MCRSessionMgr
Manages sessions for a MyCoRe system. This class is backed by a ThreadLocal
variable, so every Thread is guaranteed to get a unique instance of
MCRSession. Care must be taken when using an environment utilizing a Thread
pool, such as many Servlet engines. In this case it is possible for the
session object to stay attached to a thread where it should not be. Use the
releaseCurrentSession()method to reset the session object for a
Thread to its default values.
The basic idea for the implementation of this class is taken from an apache
project, namely the class org.apache.common.latka.LatkaProperties.java
written by Morgan Delagrange. Please see
| Constructor Summary | |
|---|---|
MCRSessionMgr()
|
|
| Method Summary | |
|---|---|
(package private) static void |
addSession(MCRSession session)
Add MCRSession to a static Map that manages all sessions. |
static void |
addSessionListener(MCRSessionListener listener)
Add a MCRSessionListener, that gets infomed about MCRSessionEvents. |
static void |
close()
|
static Map<String,MCRSession> |
getAllSessions()
|
static MCRSession |
getCurrentSession()
This method returns the unique MyCoRe session object for the current Thread. |
(package private) static List<MCRSessionListener> |
getListeners()
Allows access to all MCRSessionListener instances. |
(package private) static ReentrantReadWriteLock |
getListenersLock()
Allows to lock out access to list of MCESessionListener instances. |
static MCRSession |
getSession(String sessionID)
Returns the MCRSession for the given sessionID. |
static void |
releaseCurrentSession()
Releases the MyCoRe session from its current thread. |
(package private) static void |
removeSession(MCRSession session)
Remove MCRSession from a static Map that manages all sessions. |
static void |
removeSessionListener(MCRSessionListener listener)
Removes a MCRSessionListener from the list. |
static void |
setCurrentSession(MCRSession theSession)
This method sets a MyCoRe session object for the current Thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MCRSessionMgr()
| Method Detail |
|---|
public static MCRSession getCurrentSession()
public static void setCurrentSession(MCRSession theSession)
MCRSessionEvent.Type.activatedpublic static void releaseCurrentSession()
MCRSessionEvent.Type.passivatedpublic static MCRSession getSession(String sessionID)
static void addSession(MCRSession session)
MCRSession.MCRSession(),
MCRSessionEvent.Type.createdstatic void removeSession(MCRSession session)
MCRSession.close(),
MCRSessionEvent.Type.destroyedpublic static void addSessionListener(MCRSessionListener listener)
removeSessionListener(MCRSessionListener)public static void removeSessionListener(MCRSessionListener listener)
addSessionListener(MCRSessionListener)static List<MCRSessionListener> getListeners()
static ReentrantReadWriteLock getListenersLock()
ReentrantReadWriteLock.readLock();,
ReentrantReadWriteLock.writeLock();public static void close()
public static Map<String,MCRSession> getAllSessions()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||