Apache Tomcat 6.0.53

org.apache.catalina
Interface Manager

All Known Subinterfaces:
ClusterManager
All Known Implementing Classes:
BackupManager, ClusterManagerBase, DeltaManager, ManagerBase, PersistentManager, PersistentManagerBase, SimpleTcpReplicationManager, StandardManager

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:

Author:
Craig R. McClanahan

Method Summary
 void add(Session session)
          Add this Session to the set of active Sessions for this Manager.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 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.
 void changeSessionId(Session session)
          Change the session ID of the current session to a new randomly generated session ID.
 Session createEmptySession()
          Get a session from the recycled ones or create a new empty one.
 Session createSession()
          Deprecated.  
 Session createSession(java.lang.String sessionId)
          Construct and return a new session object, based on the default settings specified by this Manager's properties.
 Session findSession(java.lang.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.
 int getActiveSessions()
          Gets the number of currently active sessions.
 Container getContainer()
          Return the Container with which this Manager is associated.
 boolean getDistributable()
          Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.
 int getExpiredSessions()
          Gets the number of sessions that have expired.
 java.lang.String getInfo()
          Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
 int getMaxActive()
          Gets the maximum number of sessions that have been active at the same time.
 int getMaxInactiveInterval()
          Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.
 int getRejectedSessions()
          Gets the number of sessions that were not created because the maximum number of active sessions was reached.
 int getSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSessionCounter()
          Returns the total number of sessions created by this manager.
 int getSessionIdLength()
          Gets the session id length (in bytes) of Sessions created by this Manager.
 int getSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 void load()
          Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
 void remove(Session session)
          Remove this Session from the active Sessions for this Manager.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void setContainer(Container container)
          Set the Container with which this Manager is associated.
 void setDistributable(boolean distributable)
          Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.
 void setExpiredSessions(int expiredSessions)
          Sets the number of sessions that have expired.
 void setMaxActive(int maxActive)
          (Re)sets the maximum number of sessions that have been active at the same time.
 void setMaxInactiveInterval(int interval)
          Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.
 void setRejectedSessions(int rejectedSessions)
          Sets the number of sessions that were not created because the maximum number of active sessions was reached.
 void setSessionAverageAliveTime(int sessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSessionCounter(int sessionCounter)
          Sets the total number of sessions created by this manager.
 void setSessionIdLength(int idLength)
          Sets the session id length (in bytes) for Sessions created by this Manager.
 void setSessionMaxAliveTime(int sessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 void unload()
          Save any currently active sessions in the appropriate persistence mechanism, if any.
 boolean willAttributeDistribute(java.lang.String name, java.lang.Object value)
          Would the Manager distribute the given session attribute?
 

Method Detail

getContainer

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


setContainer

void setContainer(Container container)
Set the Container with which this Manager is associated. The Container must be set to a non-null value before the Manager is first used. Multiple calls to this method before first use are permitted. Once the Manager has been used, this method may not be used to change the Container (including setting a null value) that the Manager is associated with.

Parameters:
container - The newly associated Container

getDistributable

@Deprecated
boolean getDistributable()
Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.

Return the distributable flag for the sessions supported by this Manager.


setDistributable

@Deprecated
void setDistributable(boolean distributable)
Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.

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

getInfo

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


getMaxInactiveInterval

@Deprecated
int getMaxInactiveInterval()
Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.

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


setMaxInactiveInterval

@Deprecated
void setMaxInactiveInterval(int interval)
Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.

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

Parameters:
interval - The new default value

getSessionIdLength

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

Returns:
The session id length

setSessionIdLength

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

Parameters:
idLength - The session id length

getSessionCounter

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

Returns:
Total number of sessions created by this manager.

setSessionCounter

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

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

getMaxActive

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

setMaxActive

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.

getActiveSessions

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

Returns:
Number of currently active sessions

getExpiredSessions

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

Returns:
Number of sessions that have expired

setExpiredSessions

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

Parameters:
expiredSessions - Number of sessions that have expired

getRejectedSessions

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

setRejectedSessions

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

getSessionMaxAliveTime

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.

setSessionMaxAliveTime

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.

getSessionAverageAliveTime

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.

setSessionAverageAliveTime

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.

add

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

Parameters:
session - Session to be added

addPropertyChangeListener

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

Parameters:
listener - The listener to add

changeSessionId

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

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

@Deprecated
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:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

createSession

Session createSession(java.lang.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:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

findSession

Session findSession(java.lang.String id)
                    throws java.io.IOException
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:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason
java.io.IOException - if an input/output error occurs while processing this request

findSessions

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.


load

void load()
          throws java.lang.ClassNotFoundException,
                 java.io.IOException
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:
java.lang.ClassNotFoundException - if a serialized class cannot be found during the reload
java.io.IOException - if an input/output error occurs

remove

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

Parameters:
session - Session to be removed

removePropertyChangeListener

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

Parameters:
listener - The listener to remove

unload

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

Throws:
java.io.IOException - if an input/output error occurs

backgroundProcess

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.


willAttributeDistribute

boolean willAttributeDistribute(java.lang.String name,
                                java.lang.Object value)
Would the Manager distribute the given session attribute? Manager implementations may provide additional configuration options to control which attributes are distributable.

Parameters:
name - The attribute name
value - The attribute value
Returns:
true if the Manager would distribute the given attribute otherwise false

Apache Tomcat 6.0.53

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