|
EAF 7.6 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lutris.appserver.server.sessionEnhydra.PagedSessionHome
public abstract class PagedSessionHome
The StandardSessionManager uses PagedSessionHome to manage a collection of sessions that can be paged to disk.
PagedSessionHome will page sessions to disk as soon as a pre-configured threshold of sessions has been reached. Only sessions in the 'passive' state will be paged to disk. If all sessions are in the 'active' state and the threshold has been reached, then a request to create a new session will block until one of the 'active' sessions goes into the 'passive' state. At this point the session that just became 'passive' is paged to disk and a new session is created.
Sessions are paged to disk by serializing the all data (excluding the session manager) that is associated with a session. This requires that the session data and user associated with a session are serializable.
The following parameters can be used to configure
the PagedSessionHome. They should be grouped together in a section,
normally SessionManager.SessionHome
, which is specified to
the constructor.
PageThreshold: {int}
Specifies the maximum number of session that may reside in memory simultaneously. If set to zero the the paged session home acts as a write through cache. If set to -1, then the page threshold is assumed to be infinite and paging will never take place. If not set, defaults to -1.
PageTimeThreshold: {long}
Specifies the amount of time a session may remain in memory before it is paged out to disk. If this parameter is not set, or, it is set to -1, then the session will not be paged out unless the PageThreshold is reached.
PageWait: {int}
Specifies the maximum time (in milliseconds) that a thread will wait for a session to be created or retrieved. If the page threshold has been reached, then a thread has to wait for an existing session to be paged before a new session can be created or a pre-existing session (that has been paged to disk) can be activated. If not set, defaults to 1 minute. If this time is exceeded then an exception is thrown - this prevents a possible deadlock situation.
PageDir: {String}
The directory where sessions will be paged. This setting is required.
MaxSessions: {int}
Specifies the maximum number of in use concurrent sessions. If this value is exceeded then CreateSession() will throw a CreateSessionException. -1 indicates unlimited session. If MaxSessions is not set in the application's configuration then MaxSessions defaults to unlimited sessions.
StandardSession
,
StandardSessionManager
Field Summary | |
---|---|
protected java.lang.ClassLoader |
loader
The class loader to use when reading in paged data. |
protected StandardSessionManager |
sessionMgr
The session manager associated with the session home. |
Constructor Summary | |
---|---|
PagedSessionHome(StandardSessionManager sessionMgr,
com.lutris.util.Config config,
java.lang.ClassLoader loader)
|
Method Summary | |
---|---|
protected abstract boolean |
cleanupNewPagedSession()
Removes a session that is new and paged. |
boolean |
containsKey(java.lang.String sessionKey)
Specifies if a key is currently in use. |
com.lutris.appserver.server.sessionEnhydra.StandardSession |
createSession(java.lang.String sessionKey)
Creates a new session instance in the cache. |
protected void |
debug(int level,
java.lang.String msg)
Prints debug information under Logger.DEBUG. |
protected void |
debug(java.lang.String msg)
Prints debug information under Logger.DEBUG. |
protected abstract void |
deleteSession(java.lang.String sessionKey)
Deletes a paged session. |
protected abstract int |
getPagedSessionCount()
Returns the number of paged sessions. |
protected abstract java.util.Enumeration |
getPagedSessionKeys()
Returns an enumeration of the keys of all the sessions that have been paged out to persistent storage. |
com.lutris.appserver.server.sessionEnhydra.StandardSession |
getSession(java.lang.String sessionKey)
Returns the session associated with the session key. |
com.lutris.appserver.server.sessionEnhydra.StandardSession |
getSession(java.lang.Thread thread,
java.lang.String sessionKey)
Returns the session associated with the session key. |
java.util.Enumeration |
keys()
Returns an enumeration of keys for the cached sessions. |
protected abstract PagedSession |
newSession(StandardSessionManager mgr,
java.lang.String sessionKey)
Creates a new session object. |
protected abstract boolean |
pagedSessionKeyExists(java.lang.String sessionKey)
Returns true if the specified session key is in use by a session that has been paged out. |
int |
pagedSize()
Returns the current number of sessions that are paged to persistent store. |
protected abstract PagedSession |
pageIn(java.lang.String sessionKey)
Reads a paged session from disk. |
protected abstract void |
pageOut(PagedSession s)
Pages a session to disk. |
void |
passivateSession(java.lang.Thread thread,
java.lang.String sessionKey)
Puts an 'active' session into the 'passive' state. |
void |
removeSession(java.lang.String sessionKey)
Removes the session associated with the session key. |
void |
shutdown()
Shuts down the session home. |
int |
size()
Returns the current number of sessions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.ClassLoader loader
protected StandardSessionManager sessionMgr
Constructor Detail |
---|
public PagedSessionHome(StandardSessionManager sessionMgr, com.lutris.util.Config config, java.lang.ClassLoader loader) throws com.lutris.appserver.server.session.SessionException, com.lutris.util.ConfigException
sessionMgr
- The session manager associated with this session home.config
- Object parsed from configuration file. This should be
for the section containing the standard session home configuration.loader
- The class load to use when load objects from persistent store.
com.lutris.util.ConfigException
- signifies a problem in the configuration file.
com.lutris.appserver.server.session.SessionException
- if the initialization fails.Method Detail |
---|
public com.lutris.appserver.server.sessionEnhydra.StandardSession createSession(java.lang.String sessionKey) throws com.lutris.appserver.server.sessionEnhydra.CreateSessionException, com.lutris.appserver.server.sessionEnhydra.DuplicateKeyException, com.lutris.appserver.server.session.SessionException
createSession
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
sessionKey
- the key to associate with the session.
DuplicateKeyException
- if the session cannot
be created because the key is already in use.
CreateSessionException
- if the session could not be created.
com.lutris.appserver.server.session.SessionException
- any other internal error.protected abstract PagedSession newSession(StandardSessionManager mgr, java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
com.lutris.appserver.server.session.SessionException
- if an error occurs.protected abstract void deleteSession(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
sessionKey
- the key identifying the session
that should be deleted.
com.lutris.appserver.server.session.SessionException
public com.lutris.appserver.server.sessionEnhydra.StandardSession getSession(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
getSession
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
sessionKey
- the session key
com.lutris.appserver.server.session.SessionException
- if the session could not be retrieved.getSession(Thread, String)
public com.lutris.appserver.server.sessionEnhydra.StandardSession getSession(java.lang.Thread thread, java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
getSession
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
thread
- the thread to associate with the session.sessionKey
- the session key for the session
that will be made 'active' and returned. If the
session doesn't exist or it hasn't been
associated with this thread then null is returned.
com.lutris.appserver.server.session.SessionException
- if the session could not be retrieved.public void removeSession(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
removeSession
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
sessionKey
- the session key for the session
that will be made 'active' and returned.
com.lutris.appserver.server.session.SessionException
- if the session couldn't be removed.public void passivateSession(java.lang.Thread thread, java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
passivateSession
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
thread
- the thread associated with the session.sessionKey
- the session key for the session
that will be made persistent.
com.lutris.appserver.server.session.SessionException
- if the session coulnd not be put into the passive state.protected abstract void pageOut(PagedSession s) throws com.lutris.appserver.server.session.SessionException
session
- the session to page.
com.lutris.appserver.server.session.SessionException
- if the paged session could not be
paged out.protected abstract PagedSession pageIn(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
sessionKey
- the key identifying the session that should
be paged in.
com.lutris.appserver.server.session.SessionException
- if the paged session could not be
read in.protected abstract int getPagedSessionCount() throws com.lutris.appserver.server.session.SessionException
com.lutris.appserver.server.session.SessionException
public boolean containsKey(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
containsKey
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
sessionKey
- the session key to be tested.
com.lutris.appserver.server.session.SessionException
- if an error occurs.protected abstract boolean pagedSessionKeyExists(java.lang.String sessionKey) throws com.lutris.appserver.server.session.SessionException
sessionKey
- the session key to test.
com.lutris.appserver.server.session.SessionException
- if an error occurs.public int size() throws com.lutris.appserver.server.session.SessionException
size
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
com.lutris.appserver.server.session.SessionException
- if an error occurs.public int pagedSize() throws com.lutris.appserver.server.session.SessionException
pagedSize
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
com.lutris.appserver.server.session.SessionException
- if the size cannot be determinedpublic java.util.Enumeration keys() throws com.lutris.appserver.server.session.SessionException
keys
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
com.lutris.appserver.server.session.SessionException
- if an error occurs.protected abstract java.util.Enumeration getPagedSessionKeys() throws com.lutris.appserver.server.session.SessionException
com.lutris.appserver.server.session.SessionException
- if an error occurs.protected abstract boolean cleanupNewPagedSession() throws com.lutris.appserver.server.session.SessionException
com.lutris.appserver.server.session.SessionException
- if an error occurs.public void shutdown()
shutdown
in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionHome
protected void debug(java.lang.String msg)
msg
- the message to print.protected void debug(int level, java.lang.String msg)
level
- the debug level.msg
- the message to print.
|
EAF 7.6 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |