Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.lutris.appserver.server.session.persistent
Class PersistentSessionHome  view PersistentSessionHome download PersistentSessionHome.java

java.lang.Object
  extended bycom.lutris.appserver.server.session.PagedSessionHome
      extended bycom.lutris.appserver.server.session.persistent.PersistentSessionHome
All Implemented Interfaces:
com.lutris.appserver.server.session.StandardSessionHome

public class PersistentSessionHome
extends com.lutris.appserver.server.session.PagedSessionHome

PersistentSessionHome writes all passive sessions to a database. The sessions are written by serializing all the 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. PersistentSessionHome should be used by applications that want failover support or that want to run in a clustered environment.

The session data is written to a table in the database that is defined as (Informix):

     CREATE TABLE PersistentSession
     (
          sessionKey VARCHAR(64) NOT NULL,
          isNew CHAR(1) DEFAULT "1" NOT NULL,
          timeCreated DECIMAL(19,0),
          timeLastUsed DECIMAL(19,0),
          timeExpires DECIMAL(19,0),
          maxIdleTime DECIMAL(19,0),
          maxNoUserIdleTime INTEGER,
          userName VARCHAR(255),
          data BYTE,
          PRIMARY KEY(sessionKey)
     )
 
The configuration settings for PersistentSessionHome:

Version:
$Revision: 1.4.14.1 $

Field Summary
private static java.lang.String DB_NAME_KEY
          Configuration keys.
private static java.lang.String DB_TABLE_NAME_KEY
           
(package private) static java.lang.String dbName
          The name of the database that will be accessed.
(package private) static java.lang.String dbTableName
          The name of the database table where session information will be stored.
 
Fields inherited from class com.lutris.appserver.server.session.PagedSessionHome
loader, sessionMgr
 
Constructor Summary
PersistentSessionHome(com.lutris.appserver.server.session.StandardSessionManager sessionMgr, com.lutris.util.Config config, java.lang.ClassLoader loader)
           
 
Method Summary
protected  boolean cleanupNewPagedSession()
          Removes a session that is new and paged.
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  void deleteSession(java.lang.String sessionKey)
          Deletes a paged session.
 java.lang.String getDatabaseName()
          Returns the name of the database being accessed by this manager.
static java.lang.String getDatabaseName(com.lutris.util.Config config)
          Returns the name of the database that should be accessed.
protected  int getPagedSessionCount()
          Returns the number of paged sessions.
protected  java.util.Enumeration getPagedSessionKeys()
          Returns an enumeration of the keys of all the sessions that have been paged out to persistent storage.
protected  com.lutris.appserver.server.session.PagedSession newSession(com.lutris.appserver.server.session.StandardSessionManager mgr, java.lang.String sessionKey)
          Creates a new session object.
protected  boolean pagedSessionKeyExists(java.lang.String sessionKey)
          Returns true if the specified session key is in use by a session that has been paged out.
protected  com.lutris.appserver.server.session.PagedSession pageIn(java.lang.String sessionKey)
          Reads a paged session from disk.
protected  void pageOut(com.lutris.appserver.server.session.PagedSession s)
          Pages a session to disk.
 void shutdown()
          Shuts dows the session home.
 
Methods inherited from class com.lutris.appserver.server.session.PagedSessionHome
containsKey, createSession, getSession, getSession, keys, pagedSize, passivateSession, removeSession, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbName

static java.lang.String dbName
The name of the database that will be accessed.


dbTableName

static java.lang.String dbTableName
The name of the database table where session information will be stored.


DB_NAME_KEY

private static final java.lang.String DB_NAME_KEY
Configuration keys.

See Also:
Constant Field Values

DB_TABLE_NAME_KEY

private static final java.lang.String DB_TABLE_NAME_KEY
See Also:
Constant Field Values
Constructor Detail

PersistentSessionHome

public PersistentSessionHome(com.lutris.appserver.server.session.StandardSessionManager sessionMgr,
                             com.lutris.util.Config config,
                             java.lang.ClassLoader loader)
                      throws com.lutris.appserver.server.session.SessionException,
                             com.lutris.util.ConfigException
Method Detail

getDatabaseName

public java.lang.String getDatabaseName()
Returns the name of the database being accessed by this manager.


getDatabaseName

public static java.lang.String getDatabaseName(com.lutris.util.Config config)
                                        throws com.lutris.util.ConfigException
Returns the name of the database that should be accessed.


newSession

protected com.lutris.appserver.server.session.PagedSession newSession(com.lutris.appserver.server.session.StandardSessionManager mgr,
                                                                      java.lang.String sessionKey)
                                                               throws com.lutris.appserver.server.session.SessionException
Creates a new session object. This method is intended to be overriden by classes that extend PagedSessionHome.


deleteSession

protected void deleteSession(java.lang.String sessionKey)
                      throws com.lutris.appserver.server.session.SessionException
Deletes a paged session. If the session doesn't exist then this is a noop.


pageOut

protected void pageOut(com.lutris.appserver.server.session.PagedSession s)
                throws com.lutris.appserver.server.session.SessionException
Pages a session to disk.


pageIn

protected com.lutris.appserver.server.session.PagedSession pageIn(java.lang.String sessionKey)
                                                           throws com.lutris.appserver.server.session.SessionException
Reads a paged session from disk.


getPagedSessionCount

protected int getPagedSessionCount()
                            throws com.lutris.appserver.server.session.SessionException
Returns the number of paged sessions.


pagedSessionKeyExists

protected boolean pagedSessionKeyExists(java.lang.String sessionKey)
                                 throws com.lutris.appserver.server.session.SessionException
Returns true if the specified session key is in use by a session that has been paged out.


getPagedSessionKeys

protected java.util.Enumeration getPagedSessionKeys()
                                             throws com.lutris.appserver.server.session.SessionException
Returns an enumeration of the keys of all the sessions that have been paged out to persistent storage.


cleanupNewPagedSession

protected boolean cleanupNewPagedSession()
                                  throws com.lutris.appserver.server.session.SessionException
Removes a session that is new and paged.


shutdown

public void shutdown()
Shuts dows the session home.


debug

protected void debug(java.lang.String msg)
Prints debug information under Logger.DEBUG.


debug

protected void debug(int level,
                     java.lang.String msg)
Prints debug information under Logger.DEBUG.