org.apache.catalina

Interface 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:

Version: $Revision: 892545 $ $Date: 2009-12-20 02:04:17 +0100 (Sun, 20 Dec 2009) $

Author: Craig R. McClanahan

Method Summary
voidadd(Session session)
Add this Session to the set of active Sessions for this Manager.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
voidbackgroundProcess()
This method will be invoked by the context/container on a periodic basis and allows the manager to implement a method that executes periodic tasks, such as expiring sessions etc.
voidchangeSessionId(Session session)
Change the session ID of the current session to a new randomly generated session ID.
SessioncreateEmptySession()
Get a session from the recycled ones or create a new empty one.
SessioncreateSession()
Construct and return a new session object, based on the default settings specified by this Manager's properties.
SessioncreateSession(String sessionId)
Construct and return a new session object, based on the default settings specified by this Manager's properties.
SessionfindSession(String id)
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
Session[]findSessions()
Return the set of active Sessions associated with this Manager.
intgetActiveSessions()
Gets the number of currently active sessions.
ContainergetContainer()
Return the Container with which this Manager is associated.
booleangetDistributable()
Return the distributable flag for the sessions supported by this Manager.
intgetExpiredSessions()
Gets the number of sessions that have expired.
StringgetInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
intgetMaxActive()
Gets the maximum number of sessions that have been active at the same time.
intgetMaxInactiveInterval()
Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.
intgetRejectedSessions()
Gets the number of sessions that were not created because the maximum number of active sessions was reached.
intgetSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive.
intgetSessionCounter()
Returns the total number of sessions created by this manager.
intgetSessionIdLength()
Gets the session id length (in bytes) of Sessions created by this Manager.
intgetSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.
voidload()
Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
voidremove(Session session)
Remove this Session from the active Sessions for this Manager.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
voidsetContainer(Container container)
Set the Container with which this Manager is associated.
voidsetDistributable(boolean distributable)
Set the distributable flag for the sessions supported by this Manager.
voidsetExpiredSessions(int expiredSessions)
Sets the number of sessions that have expired.
voidsetMaxActive(int maxActive)
(Re)sets the maximum number of sessions that have been active at the same time.
voidsetMaxInactiveInterval(int interval)
Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.
voidsetRejectedSessions(int rejectedSessions)
Sets the number of sessions that were not created because the maximum number of active sessions was reached.
voidsetSessionAverageAliveTime(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.
voidsetSessionCounter(int sessionCounter)
Sets the total number of sessions created by this manager.
voidsetSessionIdLength(int idLength)
Sets the session id length (in bytes) for Sessions created by this Manager.
voidsetSessionMaxAliveTime(int sessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.
voidunload()
Save any currently active sessions in the appropriate persistence mechanism, if any.

Method Detail

add

public void add(Session session)
Add this Session to the set of active Sessions for this Manager.

Parameters: session Session to be added

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.

Parameters: listener The listener to add

backgroundProcess

public void backgroundProcess()
This method will be invoked by the context/container on a periodic basis and allows the manager to implement a method that executes periodic tasks, such as expiring sessions etc.

changeSessionId

public void changeSessionId(Session session)
Change the session ID of the current session to a new randomly generated session ID.

Parameters: session The session to change the session ID for

createEmptySession

public Session createEmptySession()
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.

createSession

public Session createSession()

Deprecated:

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.

Throws: IllegalStateException if a new session cannot be instantiated for any reason

createSession

public Session createSession(String sessionId)
Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id specified will be used as the session id. If a new session cannot be created for any reason, return null.

Parameters: sessionId The session id which should be used to create the new session; if null, the session id will be assigned by this method, and available via the getId() method of the returned session.

Throws: IllegalStateException if a new session cannot be instantiated for any reason

findSession

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

Parameters: id The session id for the session to be returned

Throws: IllegalStateException if a new session cannot be instantiated for any reason IOException if an input/output error occurs while processing this request

findSessions

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.

getActiveSessions

public int getActiveSessions()
Gets the number of currently active sessions.

Returns: Number of currently active sessions

getContainer

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

getDistributable

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

getExpiredSessions

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

Returns: Number of sessions that have expired

getInfo

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

getMaxActive

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

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

getMaxInactiveInterval

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

getRejectedSessions

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

Returns: Number of rejected sessions

getSessionAverageAliveTime

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

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

getSessionCounter

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

Returns: Total number of sessions created by this manager.

getSessionIdLength

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

Returns: The session id length

getSessionMaxAliveTime

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

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

load

public void load()
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.

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

remove

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

Parameters: session Session to be removed

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.

Parameters: listener The listener to remove

setContainer

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

Parameters: container The newly associated Container

setDistributable

public void setDistributable(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.

Parameters: distributable The new distributable flag

setExpiredSessions

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

Parameters: expiredSessions Number of sessions that have expired

setMaxActive

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

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

setMaxInactiveInterval

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

Parameters: interval The new default value

setRejectedSessions

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

Parameters: rejectedSessions Number of rejected sessions

setSessionAverageAliveTime

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

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

setSessionCounter

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

Parameters: sessionCounter Total number of sessions created by this manager.

setSessionIdLength

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

Parameters: idLength The session id length

setSessionMaxAliveTime

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

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

unload

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

Throws: IOException if an input/output error occurs

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.