FileDocCategorySizeDatePackage
Manager.javaAPI DocGlassfish v2 API15213Fri May 04 22:31:52 BST 2007org.apache.catalina

Manager

public interface Manager
A Manager manages the pool of Sessions that are associated with a particular Container. Different Manager implementations may support value-added features such as the persistent storage of session data, as well as migrating sessions for distributable web applications.

In order for a Manager implementation to successfully operate with a Context implementation that implements reloading, it must obey the following constraints:

  • Must implement Lifecycle so that the Context can indicate that a restart is required.
  • Must allow a call to stop() to be followed by a call to start() on the same Manager instance.
author
Craig R. McClanahan
version
$Revision: 1.7 $ $Date: 2007/05/05 05:31:51 $

Fields Summary
Constructors Summary
Methods Summary
public voidadd(Session session)
Add this Session to the set of active Sessions for this Manager.

param
session Session to be added

public voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

param
listener The listener to add

public SessioncreateEmptySession()
Get a session from the recycled ones or create a new empty one. The PersistentManager manager does not need to create session data because it reads it from the Store.

public SessioncreateSession()
Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id will be assigned by this method, and available via the getId() method of the returned session. If a new session cannot be created for any reason, return null.

exception
IllegalStateException if a new session cannot be instantiated for any reason

public SessioncreateSession(java.lang.String sessionId)
Construct and return a new session object, based on the default settings specified by this Manager's properties, using the specified session id.

param
sessionId the session id to assign to the new session
exception
IllegalStateException if a new session cannot be instantiated for any reason
return
the new session, or null if a session with the requested id already exists

public SessionfindSession(java.lang.String id)
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.

param
id The session id for the session to be returned
exception
IllegalStateException if a new session cannot be instantiated for any reason
exception
IOException if an input/output error occurs while processing this request

public SessionfindSession(java.lang.String id, java.lang.String version)
Finds and returns the session with the given id that also satisfies the given version requirement. This overloaded version of findSession() will be invoked only if isSessionVersioningSupported() returns true. By default, this method delegates to the version of findSession() that does not take any session version number.

param
id The session id to match
param
version The session version requirement to satisfy
return
The session that matches the given id and also satisfies the given version requirement, or null if no such session could be found by this session manager
exception
IOException if an IO error occurred

public Session[]findSessions()
Return the set of active Sessions associated with this Manager. If this Manager has no active Sessions, a zero-length array is returned.

public intgetActiveSessions()
Gets the number of currently active sessions.

return
Number of currently active sessions

public ContainergetContainer()
Return the Container with which this Manager is associated.

public DefaultContextgetDefaultContext()
Return the DefaultContext with which this Manager is associated.

public booleangetDistributable()
Return the distributable flag for the sessions supported by this Manager.

public intgetExpiredSessions()
Gets the number of sessions that have expired.

return
Number of sessions that have expired

public java.lang.StringgetInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.

public intgetMaxActive()
Gets the maximum number of sessions that have been active at the same time.

return
Maximum number of sessions that have been active at the same time

public intgetMaxInactiveInterval()
Same as getMaxInactiveIntervalSeconds

public intgetMaxInactiveIntervalSeconds()
Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.

public intgetRejectedSessions()
Gets the number of sessions that were not created because the maximum number of active sessions was reached.

return
Number of rejected sessions

public intgetSessionAverageAliveTime()
Same as getSessionAverageAliveTimeSeconds

public intgetSessionAverageAliveTimeSeconds()
Gets the average time (in seconds) that expired sessions had been alive.

return
Average time (in seconds) that expired sessions had been alive.

public intgetSessionCount()
Returns the total number of sessions created by this manager.

return
Total number of sessions created by this manager.

public intgetSessionCounter()
Same as getSessionCount

public intgetSessionIdLength()
Gets the session id length (in bytes) of Sessions created by this Manager.

return
The session id length

public intgetSessionMaxAliveTime()
Same as getSessionMaxAliveTimeSeconds

public intgetSessionMaxAliveTimeSeconds()
Gets the longest time (in seconds) that an expired session had been alive.

return
Longest time (in seconds) that an expired session had been alive.

public booleanisSessionVersioningSupported()
Returns true if this session manager supports session versioning, false otherwise.

return
true if this session manager supports session versioning, false otherwise.

public voidload()
Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

exception
ClassNotFoundException if a serialized class cannot be found during the reload
exception
IOException if an input/output error occurs

public booleanlockSession(javax.servlet.ServletRequest request)

public voidpostRequestDispatcherProcess(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)

public voidpreRequestDispatcherProcess(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)

public voidremove(Session session)
Remove this Session from the active Sessions for this Manager.

param
session Session to be removed

public voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

param
listener The listener to remove

public voidsetContainer(Container container)
Set the Container with which this Manager is associated.

param
container The newly associated Container

public voidsetDefaultContext(DefaultContext defaultContext)
Set the DefaultContext with which this Manager is associated.

param
defaultContext The newly associated DefaultContext

public voidsetDistributable(boolean distributable)
Set the distributable flag for the sessions supported by this Manager. If this flag is set, all user data objects added to sessions associated with this manager must implement Serializable.

param
distributable The new distributable flag

public voidsetExpiredSessions(int expiredSessions)
Sets the number of sessions that have expired.

param
expiredSessions Number of sessions that have expired

public voidsetMaxActive(int maxActive)
(Re)sets the maximum number of sessions that have been active at the same time.

param
maxActive Maximum number of sessions that have been active at the same time.

public voidsetMaxInactiveInterval(int interval)
Same as setMaxInactiveIntervalSeconds

public voidsetMaxInactiveIntervalSeconds(int interval)
Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.

param
interval The new default value

public voidsetRejectedSessions(int rejectedSessions)
Sets the number of sessions that were not created because the maximum number of active sessions was reached.

param
rejectedSessions Number of rejected sessions

public voidsetSessionAverageAliveTime(int sessionAverageAliveTime)
Same as setSessionAverageAliveTimeSeconds

public voidsetSessionAverageAliveTimeSeconds(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

param
sessionAverageAliveTime Average time (in seconds) that expired sessions had been alive.

public voidsetSessionCount(int sessionCounter)
Sets the total number of sessions created by this manager.

param
sessionCounter Total number of sessions created by this manager.

public voidsetSessionCounter(int sessionCounter)
Same as setSessionCount

public voidsetSessionIDPrefix(java.lang.String prefix)
Allow the caller to add a prefix to the session id.

public voidsetSessionIdLength(int idLength)
Sets the session id length (in bytes) for Sessions created by this Manager.

param
sessionIdLength The session id length

public voidsetSessionMaxAliveTime(int sessionMaxAliveTime)
Same as setSessionMaxAliveTimeSeconds

public voidsetSessionMaxAliveTimeSeconds(int sessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

param
sessionMaxAliveTime Longest time (in seconds) that an expired session had been alive.

public voidunload()
Save any currently active sessions in the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

exception
IOException if an input/output error occurs

public voidunlockSession(javax.servlet.ServletRequest request)

public voidupdate(javax.servlet.http.HttpSession session)
Perform any operations when the request is finished.