public interface Manager
In order for a Manager implementation to successfully operate
with a Context implementation that implements reloading, it
must obey the following constraints:
Lifecycle so that the Context can indicate
that a restart is required.
stop() to be followed by a call to
start() on the same Manager instance.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Session session)
Add this Session to the set of active Sessions for this Manager.
|
void |
addPropertyChangeListener(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,
String newId)
Change the session ID of the current session to a specified session ID.
|
Session |
createEmptySession()
Get a session from the recycled ones or create a new empty one.
|
Session |
createSession(String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
Session |
findSession(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.
|
Context |
getContext()
Get the Context with which this Manager is associated.
|
long |
getExpiredSessions()
Gets the number of sessions that have expired.
|
int |
getMaxActive()
Gets the maximum number of sessions that have been active at the same
time.
|
default boolean |
getNotifyAttributeListenerOnUnchangedValue()
When an attribute that is already present in the session is added again
under the same name and a
HttpSessionAttributeListener is configured for the
session should
HttpSessionAttributeListener.attributeReplaced(jakarta.servlet.http.HttpSessionBindingEvent)
be called? |
default boolean |
getNotifyBindingListenerOnUnchangedValue()
When an attribute that is already present in the session is added again
under the same name and the attribute implements
HttpSessionBindingListener, should
HttpSessionBindingListener.valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent)
be called followed by
HttpSessionBindingListener.valueBound(jakarta.servlet.http.HttpSessionBindingEvent)? |
int |
getRejectedSessions()
Gets the number of sessions that were not created because the maximum
number of active sessions was reached.
|
default boolean |
getSessionActivityCheck()
If this is
true, Tomcat will track the number of active
requests for each session. |
int |
getSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been
alive.
|
long |
getSessionCounter()
Returns the total number of sessions created by this manager.
|
int |
getSessionCreateRate()
Gets the current rate of session creation (in session per minute).
|
int |
getSessionExpireRate()
Gets the current rate of session expiration (in session per minute).
|
SessionIdGenerator |
getSessionIdGenerator() |
default boolean |
getSessionLastAccessAtStart()
If this is
true, the last accessed time for sessions will
be calculated from the beginning of the previous request. |
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 |
remove(Session session,
boolean update)
Remove this Session from the active Sessions for this Manager.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
default String |
rotateSessionId(Session session)
Change the session ID of the current session to a new randomly generated
session ID.
|
void |
setContext(Context context)
Set the Context with which this Manager is associated.
|
void |
setExpiredSessions(long 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 |
setNotifyAttributeListenerOnUnchangedValue(boolean notifyAttributeListenerOnUnchangedValue)
Configure if
HttpSessionAttributeListener.attributeReplaced(jakarta.servlet.http.HttpSessionBindingEvent)
when an attribute that is already present in the session is added again
under the same name and a HttpSessionAttributeListener is configured for the
session. |
void |
setNotifyBindingListenerOnUnchangedValue(boolean notifyBindingListenerOnUnchangedValue)
Configure if
HttpSessionBindingListener.valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent)
be called followed by
HttpSessionBindingListener.valueBound(jakarta.servlet.http.HttpSessionBindingEvent)
when an attribute that is already present in the session is added again
under the same name and the attribute implements HttpSessionBindingListener. |
void |
setSessionActivityCheck(boolean sessionActivityCheck)
Configure if Tomcat will track the number of active requests for each
session.
|
void |
setSessionCounter(long sessionCounter)
Sets the total number of sessions created by this manager.
|
void |
setSessionIdGenerator(SessionIdGenerator sessionIdGenerator)
Sets the session id generator
|
void |
setSessionLastAccessAtStart(boolean sessionLastAccessAtStart)
Configure if the last accessed time for sessions will
be calculated from the beginning of the previous request.
|
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(String name,
Object value)
Would the Manager distribute the given session attribute?
|
Context getContext()
void setContext(Context context)
null value) that the Manager is associated with.context - The newly associated ContextSessionIdGenerator getSessionIdGenerator()
void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator)
sessionIdGenerator - The session id generatorlong getSessionCounter()
void setSessionCounter(long sessionCounter)
sessionCounter - Total number of sessions created by this manager.int getMaxActive()
void setMaxActive(int maxActive)
maxActive - Maximum number of sessions that have been active at
the same time.int getActiveSessions()
long getExpiredSessions()
void setExpiredSessions(long expiredSessions)
expiredSessions - Number of sessions that have expiredint getRejectedSessions()
int getSessionMaxAliveTime()
void setSessionMaxAliveTime(int sessionMaxAliveTime)
sessionMaxAliveTime - Longest time (in seconds) that an expired
session had been alive.int getSessionAverageAliveTime()
int getSessionCreateRate()
int getSessionExpireRate()
void add(Session session)
session - Session to be addedvoid addPropertyChangeListener(PropertyChangeListener listener)
listener - The listener to adddefault String rotateSessionId(Session session)
session - The session to change the session ID forvoid changeSessionId(Session session, String newId)
session - The session to change the session ID fornewId - new session IDSession createEmptySession()
Session createSession(String sessionId)
null.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.IllegalStateException - if a new session cannot be
instantiated for any reasonSession findSession(String id) throws IOException
null.id - The session id for the session to be returnednull if a session with the
requested ID could not be foundIllegalStateException - if a new session cannot be
instantiated for any reasonIOException - if an input/output error occurs while
processing this requestSession[] findSessions()
void load() throws ClassNotFoundException, IOException
ClassNotFoundException - if a serialized class cannot be
found during the reloadIOException - if an input/output error occursvoid remove(Session session)
session - Session to be removedvoid remove(Session session, boolean update)
session - Session to be removedupdate - Should the expiration statistics be updatedvoid removePropertyChangeListener(PropertyChangeListener listener)
listener - The listener to removevoid unload()
throws IOException
IOException - if an input/output error occursvoid backgroundProcess()
boolean willAttributeDistribute(String name, Object value)
name - The attribute namevalue - The attribute valuetrue if the Manager would distribute the given attribute
otherwise falsedefault boolean getNotifyBindingListenerOnUnchangedValue()
HttpSessionBindingListener, should
HttpSessionBindingListener.valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent)
be called followed by
HttpSessionBindingListener.valueBound(jakarta.servlet.http.HttpSessionBindingEvent)?
The default value is false.
true if the listener will be notified, false if
it will notvoid setNotifyBindingListenerOnUnchangedValue(boolean notifyBindingListenerOnUnchangedValue)
HttpSessionBindingListener.valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent)
be called followed by
HttpSessionBindingListener.valueBound(jakarta.servlet.http.HttpSessionBindingEvent)
when an attribute that is already present in the session is added again
under the same name and the attribute implements HttpSessionBindingListener.notifyBindingListenerOnUnchangedValue - true the listener
will be called, false it will notdefault boolean getNotifyAttributeListenerOnUnchangedValue()
HttpSessionAttributeListener is configured for the
session should
HttpSessionAttributeListener.attributeReplaced(jakarta.servlet.http.HttpSessionBindingEvent)
be called?
The default value is true.
true if the listener will be notified, false if
it will notvoid setNotifyAttributeListenerOnUnchangedValue(boolean notifyAttributeListenerOnUnchangedValue)
HttpSessionAttributeListener.attributeReplaced(jakarta.servlet.http.HttpSessionBindingEvent)
when an attribute that is already present in the session is added again
under the same name and a HttpSessionAttributeListener is configured for the
session.notifyAttributeListenerOnUnchangedValue - true the listener
will be called, false it will notdefault boolean getSessionActivityCheck()
true, Tomcat will track the number of active
requests for each session. When determining if a session is valid, any
session with at least one active request will always be considered valid.
If org.apache.catalina.STRICT_SERVLET_COMPLIANCE is set to
true, the default of this setting will be true,
else the default value will be false.void setSessionActivityCheck(boolean sessionActivityCheck)
sessionActivityCheck - the new flag valuedefault boolean getSessionLastAccessAtStart()
true, the last accessed time for sessions will
be calculated from the beginning of the previous request. If
false, the last accessed time for sessions will be calculated
from the end of the previous request. This also affects how the idle time
is calculated.
If org.apache.catalina.STRICT_SERVLET_COMPLIANCE is set to
true, the default of this setting will be true,
else the default value will be false.void setSessionLastAccessAtStart(boolean sessionLastAccessAtStart)
false, the last accessed time for sessions will be calculated
from the end of the previous request. This also affects how the idle time
is calculated.sessionLastAccessAtStart - the new flag valueCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.