FileDocCategorySizeDatePackage
SessionManager.javaAPI DocExample5834Tue May 29 16:56:46 BST 2007com.sun.xml.ws.runtime.util

SessionManager

public abstract class SessionManager extends Object
The SessionManager is used to obtain session information This can be implemented using persisitent storage mechanisms or using transient storage Even if it is implemented using persistent storage the implementation should take care of backing by a cache which will avoid the overhead of serialization and database operations

Additonally the SessionManager is responsible for managing the lifecycle events for the sessions. It exposes methods to create and terminate the session Periodically the SessionManager will check for sessions who have been inactive for a predefined amount of time and then will terminate those sessions

author
Bhakti Mehta
author
Mike Grogan

Fields Summary
private static SessionManager
manager
Constructors Summary
Methods Summary
public abstract SessioncreateSession(java.lang.String key, java.lang.Class clasz)
Creates a Session with the given key, using a new instance of the specified Class as a holder for user-defined data. The specified Class must have a default ctor.

param
key The Session key to be used.
returns
The new Session.. null if the given class cannot be instantiated.

public abstract SessioncreateSession(java.lang.String key, java.lang.Object obj)
Creates a Session with the given key, using the specified Object as a holder for user-defined data.

param
key The Session key to be used.
param
obj The object to use as a holder for user data in the session.
returns
The new Session.

public abstract SessioncreateSession(java.lang.String key)
Creates a Session with the given key, using an instance of java.util.Hashtable asa holder for user-defined data.

param
key The Session key to be used.
returns
The new Session.

public abstract java.util.SetgetKeys()
Returns the Set of valid Session keys.

returns
The Set of keys.

public abstract SessiongetSession(java.lang.String key)
Returns an existing session identified by the Key else null

param
key The Session key.
returns
The Session with the given key. null if none exists.

public static com.sun.xml.ws.runtime.util.SessionManagergetSessionManager()
Returns the single instance of SessionManager Use the usual services mechanism to find implementing class. If not found, use com.sun.xml.ws.runtime.util.SessionManager by default.

return
The value of the manager field.

         synchronized (SessionManager.class) {
             if (manager == null) {
                 ServiceFinder<SessionManager> finder = 
                         ServiceFinder.find(SessionManager.class);
                 if (finder != null && finder.toArray().length > 0) {
                    manager = finder.toArray()[0];
                 } else {
                    manager = new SessionManagerImpl();
                 }
             }
             return manager;
         }
     
public abstract voidsaveSession(java.lang.String key)
Saves the state of the Session with the given key.

param
key The key of the session to be saved

public abstract voidterminateSession(java.lang.String key)
Removed the Session with the given key.

param
key The key of the Session to be removed.