ikrs.util.session
Class SynchronizedSessionManagerDelegation<K,V,U>

java.lang.Object
  extended by ikrs.util.session.AbstractSessionManager<K,V,U>
      extended by ikrs.util.session.SynchronizedSessionManagerDelegation<K,V,U>
All Implemented Interfaces:
SessionManager<K,V,U>

public class SynchronizedSessionManagerDelegation<K,V,U>
extends 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
SynchronizedSessionManagerDelegation(SessionManager<K,V,U> coreManager)
          Create a new SynchronizedSessionManagerDelegation.
 
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.
 
Methods inherited from class ikrs.util.session.AbstractSessionManager
getSessionFactory, getSessionIDMap, getSessionTimeout, getSessionUserMap, setSessionTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedSessionManagerDelegation

public SynchronizedSessionManagerDelegation(SessionManager<K,V,U> coreManager)
                                     throws java.lang.NullPointerException
Create a new SynchronizedSessionManagerDelegation.

Throws:
java.lang.NullPointerException
Method Detail

get

public Session<K,V,U> get(java.util.UUID sessionID)
Retrieve the session with the given SID. If the session cannot be found (does not exist or timed out) the method returns null.

Specified by:
get in interface SessionManager<K,V,U>
Overrides:
get in class AbstractSessionManager<K,V,U>
Parameters:
sessionID - The desired session's unique ID.
Returns:
The session with the given ID or null if no such session can be found.

destroy

public boolean destroy(java.util.UUID sessionID)
Thie methos destroys the session with the specified SID. That means that all session data will be removed and the session itself becomes invalid. It will not be accessible or retrievable any more using on of this interface's methods.

Specified by:
destroy in interface SessionManager<K,V,U>
Overrides:
destroy in class AbstractSessionManager<K,V,U>
Parameters:
sessionID - The unique ID of the session you want to destroy.
Returns:
True if the session was found (and so destroyed) or false otherwise.

bind

public Session<K,V,U> bind(U userID)
This method tries to create a new session for the given user (ID). If there is already a session for the given user no new session will be created but the existing one returned.

Specified by:
bind in interface SessionManager<K,V,U>
Overrides:
bind in class AbstractSessionManager<K,V,U>
Parameters:
userID - The user (ID) to create the new session for.