public abstract class ManagerBase extends Object implements Manager, MBeanRegistration
Modifier and Type | Field and Description |
---|---|
protected Container |
container
The Container with which this Manager is associated.
|
protected boolean |
distributable
The distributable flag for Sessions created by this Manager.
|
protected String |
domain |
protected int |
duplicates |
protected int |
expiredSessions
Number of sessions that have expired.
|
protected boolean |
initialized |
protected int |
maxActive |
protected int |
maxInactiveInterval
The default maximum inactive interval for Sessions created by
this Manager.
|
protected MBeanServer |
mserver |
protected static String |
name
The descriptive name of this Manager implementation (for logging).
|
protected ObjectName |
oname |
protected int |
processExpiresFrequency
Frequency of the session expiration, and related manager operations.
|
protected long |
processingTime
Processing time during session expiration.
|
protected int |
sessionAverageAliveTime
Average time (in seconds) that expired sessions had been alive.
|
protected int |
sessionCounter |
protected int |
sessionIdLength
The session id length of Sessions created by this Manager.
|
protected int |
sessionMaxAliveTime
The longest time (in seconds) that an expired session had been alive.
|
protected Map<String,Session> |
sessions
The set of currently active Sessions for this Manager, keyed by
session identifier.
|
protected PropertyChangeSupport |
support
The property change support for this component.
|
Constructor and Description |
---|
ManagerBase() |
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.
|
protected boolean |
appendJVMRoute() |
void |
backgroundProcess()
Implements the Manager interface, direct call to processExpires
|
void |
changeSessionId(Session session,
Random random)
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(String sessionId,
Random random)
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
void |
destroy() |
static char[] |
encode(byte[] data)
Encode the bytes into a String with a slightly modified Base64-algorithm
This code was written by Kevin Kelley
|
void |
expireSession(String sessionId) |
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.
|
protected String |
generateSessionId(Random random)
Generate and return a new session identifier.
|
int |
getActiveSessions()
Returns the number of active sessions
|
String |
getClassName()
Returns the name of the implementation class.
|
Container |
getContainer()
Return the Container with which this Manager is associated.
|
String |
getCreationTime(String sessionId) |
boolean |
getDistributable()
Return the distributable flag for the sessions supported by
this Manager.
|
String |
getDomain() |
int |
getDuplicates()
Number of duplicated session IDs generated by the random source.
|
Engine |
getEngine()
Retrieve the enclosing Engine for this Manager.
|
int |
getExpiredSessions()
Gets the number of sessions that have expired.
|
String |
getInfo()
Return descriptive information about this Manager implementation and
the corresponding version number, in the format
<description>/<version> . |
String |
getJvmRoute()
Retrieve the JvmRoute for the enclosing Engine.
|
String |
getLastAccessedTime(String sessionId) |
int |
getMaxActive()
Max number of concurrent active sessions
|
int |
getMaxInactiveInterval()
Return the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
String |
getName()
Return the descriptive short name of this Manager implementation.
|
protected StandardSession |
getNewSession()
Get new session class to be used in the doLoad() method.
|
ObjectName |
getObjectName() |
int |
getProcessExpiresFrequency()
Return the frequency of manager checks.
|
long |
getProcessingTime() |
HashMap |
getSession(String sessionId)
Returns information about the session with the given session id.
|
String |
getSessionAttribute(String sessionId,
String key)
For debugging: get a session attribute
|
int |
getSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been
alive.
|
int |
getSessionCounter()
Total 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 |
init() |
String |
listSessionIds()
For debugging: return a list of all session ids currently active
|
void |
postDeregister() |
void |
postRegister(Boolean registrationDone) |
void |
preDeregister() |
ObjectName |
preRegister(MBeanServer server,
ObjectName name) |
void |
processExpires()
Invalidate all sessions that have expired.
|
void |
remove(Session session)
Remove this Session from the active Sessions for this Manager.
|
void |
removePropertyChangeListener(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)
Set the distributable flag for the sessions supported by this
Manager.
|
void |
setDuplicates(int duplicates) |
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)
Set the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
void |
setProcessExpiresFrequency(int processExpiresFrequency)
Set the manager checks frequency.
|
void |
setProcessingTime(long processingTime) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRejectedSessions, load, setRejectedSessions, unload
protected Container container
protected boolean distributable
true
, any user attributes added to a
session controlled by this Manager must be Serializable.protected int maxInactiveInterval
protected int sessionIdLength
protected static String name
protected int sessionMaxAliveTime
protected int sessionAverageAliveTime
protected int expiredSessions
protected Map<String,Session> sessions
protected int sessionCounter
protected int maxActive
protected int duplicates
protected boolean initialized
protected long processingTime
protected int processExpiresFrequency
protected PropertyChangeSupport support
protected String domain
protected ObjectName oname
protected MBeanServer mserver
public Container getContainer()
getContainer
in interface Manager
public void setContainer(Container container)
setContainer
in interface Manager
container
- The newly associated Containerpublic String getClassName()
public boolean getDistributable()
getDistributable
in interface Manager
public void setDistributable(boolean distributable)
setDistributable
in interface Manager
distributable
- The new distributable flagpublic String getInfo()
<description>/<version>
.public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface Manager
public void setMaxInactiveInterval(int interval)
setMaxInactiveInterval
in interface Manager
interval
- The new default valuepublic int getSessionIdLength()
getSessionIdLength
in interface Manager
public void setSessionIdLength(int idLength)
setSessionIdLength
in interface Manager
idLength
- The session id lengthpublic String getName()
public int getExpiredSessions()
getExpiredSessions
in interface Manager
public void setExpiredSessions(int expiredSessions)
setExpiredSessions
in interface Manager
expiredSessions
- Number of sessions that have expiredpublic long getProcessingTime()
public void setProcessingTime(long processingTime)
public int getProcessExpiresFrequency()
public void setProcessExpiresFrequency(int processExpiresFrequency)
processExpiresFrequency
- the new manager checks frequencypublic void backgroundProcess()
backgroundProcess
in interface Manager
public void processExpires()
public void destroy()
public void init()
public void add(Session session)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Manager
listener
- The listener to addpublic void changeSessionId(Session session, Random random)
changeSessionId
in interface Manager
session
- The session to change the session ID forpublic Session createSession(String sessionId, Random random)
null
.createSession
in interface Manager
sessionId
- The session id which should be used to create the
new session; if null
, a new session id will be
generatedIllegalStateException
- if a new session cannot be
instantiated for any reasonpublic Session createEmptySession()
createEmptySession
in interface Manager
public Session findSession(String id) throws IOException
null
.findSession
in interface Manager
id
- The session id for the session to be returnedIllegalStateException
- if a new session cannot be
instantiated for any reasonIOException
- if an input/output error occurs while
processing this requestpublic Session[] findSessions()
findSessions
in interface Manager
public void remove(Session session)
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Manager
listener
- The listener to removeprotected StandardSession getNewSession()
protected String generateSessionId(Random random)
protected boolean appendJVMRoute()
public static char[] encode(byte[] data)
data
- The bytes you want to encodepublic Engine getEngine()
public String getJvmRoute()
public void setSessionCounter(int sessionCounter)
Manager
setSessionCounter
in interface Manager
sessionCounter
- Total number of sessions created by this manager.public int getSessionCounter()
getSessionCounter
in interface Manager
public int getDuplicates()
public void setDuplicates(int duplicates)
public int getActiveSessions()
getActiveSessions
in interface Manager
public int getMaxActive()
getMaxActive
in interface Manager
public void setMaxActive(int maxActive)
Manager
setMaxActive
in interface Manager
maxActive
- Maximum number of sessions that have been active at
the same time.public int getSessionMaxAliveTime()
getSessionMaxAliveTime
in interface Manager
public void setSessionMaxAliveTime(int sessionMaxAliveTime)
setSessionMaxAliveTime
in interface Manager
sessionMaxAliveTime
- Longest time (in seconds) that an expired
session had been alive.public int getSessionAverageAliveTime()
getSessionAverageAliveTime
in interface Manager
public void setSessionAverageAliveTime(int sessionAverageAliveTime)
setSessionAverageAliveTime
in interface Manager
sessionAverageAliveTime
- Average time (in seconds) that expired
sessions had been alive.public String listSessionIds()
public String getSessionAttribute(String sessionId, String key)
sessionId
- key
- public HashMap getSession(String sessionId)
The session information is organized as a HashMap, mapping session attribute names to the String representation of their values.
sessionId
- Session idpublic void expireSession(String sessionId)
public ObjectName getObjectName()
public String getDomain()
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
Copyright © 2013 JBoss by Red Hat. All rights reserved.