EAF 7.4 API

com.lutris.appserver.server.sessionEnhydra
Interface StandardSessionHome


public interface StandardSessionHome

StandardSessionManager uses StandardSessionHome to manage a collection of sessions. StandardSessionHome acts both as a session factory and as a session repository. The session manager gains access to instances of sessions via the home (StandardSessionHome) interface. The session manager dynamically loads the home interface. The implementation of the home interface that is loaded is specified in the applications configuration file:

StandardSessionHome manages the state of a session. A session exists in either of two states: 'active' or 'passive'. An 'active' session is one that is actively being referenced by a thread of execution (request). A 'passive' session is one that is not currently associated with any request (thread). A session in the 'passive' state may be written to persistent store until it becomes 'active'. When a session becomes active, if it isn't in memory then it can be read from persistent store.

Version:
$Revision: 1.1 $
Author:
Kyle Clark
See Also:
StandardSession, StandardSessionManager, BasicSessionHome, PagedSessionHome, com.lutris.appserver.server.sessionEnhydra.persistent.PersistentSessionHome

Method Summary
 boolean containsKey(java.lang.String sessionKey)
          Specifies if a key is currently bound to a session.
 StandardSession createSession(java.lang.String sessionKey)
          Creates and returns a new session instance.
 StandardSession getSession(java.lang.String sessionKey)
          Returns the session bound to the session key.
 StandardSession getSession(java.lang.Thread thread, java.lang.String sessionKey)
          Returns the session bound to the specified session key.
 java.util.Enumeration keys()
          Returns an enumeration of the keys for all the sessions.
 int pagedSize()
          Returns the current number of sessions that are paged to persistent store.
 void passivateSession(java.lang.Thread thread, java.lang.String sessionKey)
          Puts a session into the 'passive' state.
 void removeSession(java.lang.String sessionKey)
          Removes a session from the cache.
 void shutdown()
          Shuts dows the session home.
 int size()
          Returns the current number of sessions.
 

Method Detail

createSession

StandardSession createSession(java.lang.String sessionKey)
                              throws CreateSessionException,
                                     DuplicateKeyException,
                                     SessionException
Creates and returns a new session instance. The session is bound to the specified session key. The session is also associated with the current thread and is considered in the 'active' state. The session remains in the 'active' state until the thread puts the session into the 'passive' state.. Only this thread will be able to put the session into the 'passive' state.

Parameters:
sessionKey - the key to associate with the session.
Returns:
the newly created session.
Throws:
CreateSessionException - if the session cannot be created.
DuplicateKeyException - if the session cannot be created because the key is already in use.
SessionException - if the session cannot be created for some other reason.
See Also:
passivateSession(java.lang.Thread, java.lang.String)

getSession

StandardSession getSession(java.lang.String sessionKey)
                           throws SessionException
Returns the session bound to the session key. The session must already be in the 'active' state and associated with the current thread, otherwise null is returned.

Parameters:
sessionKey - the session key for the session. If the session doesn't exist or is not is not bound to the current thread then null is returned.
Returns:
the session.
Throws:
SessionException - if the session cannot be retrieved.
See Also:
getSession(Thread, String)

getSession

StandardSession getSession(java.lang.Thread thread,
                           java.lang.String sessionKey)
                           throws SessionException
Returns the session bound to the specified session key. The session is put into the 'active' state. The session is also associated with the specified thread. Only this thread will be able to put the session back into the 'passive' state once it is done with the session.

Parameters:
thread - the thread that should be associated with the session while it is in the active state. Only this thread can put the session back into the passive state.
sessionKey - the session key for the session that will be made 'active' and returned. If the session doesn't exist then null is returned.
Returns:
the session.
Throws:
SessionException - if the session cannot be retrieved.
See Also:
passivateSession(java.lang.Thread, java.lang.String)

removeSession

void removeSession(java.lang.String sessionKey)
                   throws SessionException
Removes a session from the cache. If the session doesn't exist the opration is ignored.

Parameters:
sessionKey - the session key associated with the session.
Throws:
SessionException - if the session cannot be retrieved.

passivateSession

void passivateSession(java.lang.Thread thread,
                      java.lang.String sessionKey)
                      throws SessionException
Puts a session into the 'passive' state. A 'passive' session may be made persistent. Only the thread that put the session into the 'active' state may put the session into the 'passive' state.

Parameters:
thread - the thread that is currently associated with the session.
sessionKey - the session key for the session that will be made passive.
Throws:
SessionException - if the session cannot be retrieved.

containsKey

boolean containsKey(java.lang.String sessionKey)
                    throws SessionException
Specifies if a key is currently bound to a session.

Parameters:
sessionKey - the session key to be tested.
Returns:
true if the session key is in use.
Throws:
SessionException - if the existence of the key cannot be determined.

size

int size()
         throws SessionException
Returns the current number of sessions.

Returns:
the 'active' session count.
Throws:
SessionException - if the size cannot be determined

pagedSize

int pagedSize()
              throws SessionException
Returns the current number of sessions that are paged to persistent store.

Returns:
the 'paged' session count.
Throws:
SessionException - if the size cannot be determined

keys

java.util.Enumeration keys()
                           throws SessionException
Returns an enumeration of the keys for all the sessions.

Returns:
the enumeration of session keys.
Throws:
SessionException - if the session enumeration cannot be retrieved.

shutdown

void shutdown()
Shuts dows the session home.


EAF 7.4 API