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(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.
|
void |
changeSessionId(Session session,
java.lang.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(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()
Deprecated.
Use
getContext() . This method will be removed in
Tomcat 9 onwards. |
Context |
getContext()
Return the Context with which this Manager is associated.
|
boolean |
getDistributable()
Deprecated.
Ignored.
Context.getDistributable() always takes
precedence. Will be removed in Tomcat 8.5.x. |
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.
|
int |
getMaxInactiveInterval()
Deprecated.
Ignored.
Context.getSessionTimeout() always takes
precedence. Will be removed in Tomcat 8.5.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.
|
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()
return the session id generator
|
int |
getSessionIdLength()
Deprecated.
Use
SessionIdGenerator.getSessionIdLength() .
This method will be removed in Tomcat 9 onwards. |
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(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContainer(Container container)
Deprecated.
Use
setContext(Context) . This method will be removed in
Tomcat 9 onwards. |
void |
setContext(Context context)
Set the Context with which this Manager is associated.
|
void |
setDistributable(boolean distributable)
Deprecated.
Ignored.
Context.getDistributable() always takes
precedence. Will be removed in Tomcat 8.5.x. |
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 |
setMaxInactiveInterval(int interval)
Deprecated.
Ignored.
Context.getSessionTimeout() always takes
precedence. Will be removed in Tomcat 8.5.x. |
void |
setSessionCounter(long sessionCounter)
Sets the total number of sessions created by this manager.
|
void |
setSessionIdGenerator(SessionIdGenerator sessionIdGenerator)
Sets the session id generator
|
void |
setSessionIdLength(int idLength)
Deprecated.
Use
SessionIdGenerator.setSessionIdLength(int) .
This method will be removed in Tomcat 9 onwards. |
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?
|
@Deprecated Container getContainer()
getContext()
. This method will be removed in
Tomcat 9 onwards.@Deprecated void setContainer(Container container)
setContext(Context)
. This method will be removed in
Tomcat 9 onwards.container
- The newly associated ContainerContext getContext()
void setContext(Context context)
null
value) that the Manager is associated with.context
- The newly associated Context@Deprecated boolean getDistributable()
Context.getDistributable()
always takes
precedence. Will be removed in Tomcat 8.5.x.@Deprecated void setDistributable(boolean distributable)
Context.getDistributable()
always takes
precedence. Will be removed in Tomcat 8.5.x.distributable
- The new distributable flag@Deprecated int getMaxInactiveInterval()
Context.getSessionTimeout()
always takes
precedence. Will be removed in Tomcat 8.5.x.@Deprecated void setMaxInactiveInterval(int interval)
Context.getSessionTimeout()
always takes
precedence. Will be removed in Tomcat 8.5.x.interval
- The new default valueSessionIdGenerator getSessionIdGenerator()
void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator)
sessionIdGenerator
- The session id generator@Deprecated int getSessionIdLength()
SessionIdGenerator.getSessionIdLength()
.
This method will be removed in Tomcat 9 onwards.@Deprecated void setSessionIdLength(int idLength)
SessionIdGenerator.setSessionIdLength(int)
.
This method will be removed in Tomcat 9 onwards.idLength
- The session id lengthlong 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(java.beans.PropertyChangeListener listener)
listener
- The listener to addvoid changeSessionId(Session session)
session
- The session to change the session ID forvoid changeSessionId(Session session, java.lang.String newId)
session
- The session to change the session ID fornewId
- new session IDSession createEmptySession()
Session createSession(java.lang.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.java.lang.IllegalStateException
- if a new session cannot be
instantiated for any reasonSession findSession(java.lang.String id) throws java.io.IOException
null
.id
- The session id for the session to be returnedjava.lang.IllegalStateException
- if a new session cannot be
instantiated for any reasonjava.io.IOException
- if an input/output error occurs while
processing this requestSession[] findSessions()
void load() throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
- if a serialized class cannot be
found during the reloadjava.io.IOException
- 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(java.beans.PropertyChangeListener listener)
listener
- The listener to removevoid unload() throws java.io.IOException
java.io.IOException
- if an input/output error occursvoid backgroundProcess()
boolean willAttributeDistribute(java.lang.String name, java.lang.Object value)
name
- The attribute namevalue
- The attribute valuetrue
if the Manager would distribute the given attribute
otherwise false
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.