|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.util.session.AbstractSessionManager<K,V,U>
public abstract class AbstractSessionManager<K,V,U>
The DefaultSessionManager is a very simple SessionManager implementation that uses a treemap to find sessions by their ID. The search for user IDs is linear! All methods are synchronized (this manager implementation acts like a monitor).
Constructor Summary | |
---|---|
protected |
AbstractSessionManager(SessionFactory<K,V,U> sessionFactory,
int sessionTimeout_seconds)
Create a new AbstractSessionManager (not thread safe). |
protected |
AbstractSessionManager(SessionFactory<K,V,U> sessionFactory,
int sessionTimeout_seconds,
boolean threadSafe)
Create a new AbstractSessionManager. |
Method Summary | |
---|---|
Session<K,V,U> |
bind(U userID)
This method tries to create a new session for the given user (ID). |
boolean |
destroy(java.util.UUID sessionID)
Thie methos destroys the session with the specified SID. |
Session<K,V,U> |
get(java.util.UUID sessionID)
Retrieve the session with the given SID. |
SessionFactory<K,V,U> |
getSessionFactory()
This method can be used to retrieve the manager's internal session factory. |
protected java.util.Map<java.util.UUID,Session<K,V,U>> |
getSessionIDMap()
Subclasses can use this method to gain direct access to the internal session-by-ID map. |
int |
getSessionTimeout()
This method returns the session timeout (seconds) currently set for this manager. |
protected java.util.Map<U,Session<K,V,U>> |
getSessionUserMap()
Subclasses can use this method to gain direct access to the internal session-by-userID map. |
void |
setSessionTimeout(int seconds)
This method sets the manager's session timeout to the new value (must be larger than 0). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractSessionManager(SessionFactory<K,V,U> sessionFactory, int sessionTimeout_seconds) throws java.lang.NullPointerException
sessionFactory
- The session factory to use (must not be null).sessionTimeout_seconds
- The session timeout to be used (seconds).
java.lang.NullPointerException
protected AbstractSessionManager(SessionFactory<K,V,U> sessionFactory, int sessionTimeout_seconds, boolean threadSafe) throws java.lang.NullPointerException
sessionFactory
- The session factory to use (must not be null).sessionTimeout_seconds
- The session timeout to be used (seconds).threadSafe
- If set to true the internal session map will be
synchronized (thread safe).
java.lang.NullPointerException
Method Detail |
---|
protected java.util.Map<java.util.UUID,Session<K,V,U>> getSessionIDMap()
protected java.util.Map<U,Session<K,V,U>> getSessionUserMap()
public SessionFactory<K,V,U> getSessionFactory()
getSessionFactory
in interface SessionManager<K,V,U>
public int getSessionTimeout()
getSessionTimeout
in interface SessionManager<K,V,U>
public void setSessionTimeout(int seconds) throws java.lang.IllegalArgumentException
setSessionTimeout
in interface SessionManager<K,V,U>
The
- number of seconds the manager's session will die after not being accessed.
java.lang.IllegalArgumentException
- If the passed timeout is less or equals zero.public Session<K,V,U> get(java.util.UUID sessionID)
get
in interface SessionManager<K,V,U>
sessionID
- The desired session's unique ID.
public boolean destroy(java.util.UUID sessionID)
destroy
in interface SessionManager<K,V,U>
sessionID
- The unique ID of the session you want to destroy.
public Session<K,V,U> bind(U userID)
bind
in interface SessionManager<K,V,U>
userID
- The user (ID) to create the new session for.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |