java.lang.Object
org.mortbay.jetty.servlet.AbstractSessionManager
- All Implemented Interfaces:
- org.mortbay.util.LifeCycle, java.io.Serializable, SessionManager
- Direct Known Subclasses:
- HashSessionManager
- public abstract class AbstractSessionManager
- extends java.lang.Object
- implements SessionManager
An Abstract implementation of SessionManager.
The partial implementation of SessionManager interface provides
the majority of the handling required to implement a
SessionManager. Concrete implementations of SessionManager based
on AbstractSessionManager need only implement the newSession method
to return a specialized version of the Session inner class that
provides an attribute Map.
If the property
org.mortbay.jetty.servlet.AbstractSessionManager.23Notifications is set to
true, the 2.3 servlet spec notification style will be used.
- Version:
- $Id: AbstractSessionManager.java,v 1.35 2003/10/19 12:12:39 gregwilkins Exp $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static org.apache.commons.logging.Log log
__distantFuture
public static final int __distantFuture
- See Also:
- Constant Field Values
__24SessionDestroyed
public static final boolean __24SessionDestroyed
_dftMaxIdleSecs
private int _dftMaxIdleSecs
_scavengePeriodMs
private int _scavengePeriodMs
_workerName
private java.lang.String _workerName
_useRequestedId
private boolean _useRequestedId
_sessionListeners
protected transient java.util.ArrayList _sessionListeners
_sessionAttributeListeners
protected transient java.util.ArrayList _sessionAttributeListeners
_sessions
protected transient java.util.Map _sessions
_random
protected transient java.util.Random _random
_handler
protected transient ServletHandler _handler
_minSessions
protected int _minSessions
_maxSessions
protected int _maxSessions
_scavenger
private transient AbstractSessionManager.SessionScavenger _scavenger
AbstractSessionManager
public AbstractSessionManager()
AbstractSessionManager
public AbstractSessionManager(java.util.Random random)
getUseRequestedId
public boolean getUseRequestedId()
setUseRequestedId
public void setUseRequestedId(boolean useRequestedId)
initialize
public void initialize(ServletHandler handler)
- Specified by:
initialize in interface SessionManager
getSessionMap
public java.util.Map getSessionMap()
getSessions
public int getSessions()
getMinSessions
public int getMinSessions()
getMaxSessions
public int getMaxSessions()
resetStats
public void resetStats()
newSessionId
private java.lang.String newSessionId(javax.servlet.http.HttpServletRequest request,
long created)
getHttpSession
public javax.servlet.http.HttpSession getHttpSession(java.lang.String id)
- Specified by:
getHttpSession in interface SessionManager
newHttpSession
public javax.servlet.http.HttpSession newHttpSession(javax.servlet.http.HttpServletRequest request)
- Specified by:
newHttpSession in interface SessionManager
newSession
protected abstract AbstractSessionManager.Session newSession(javax.servlet.http.HttpServletRequest request)
getWorkerName
public java.lang.String getWorkerName()
- Get the workname.
If set, the workername is dot appended to the session ID
and can be used to assist session affinity in a load balancer.
setWorkerName
public void setWorkerName(java.lang.String workerName)
- Set the workname.
If set, the workername is dot appended to the session ID
and can be used to assist session affinity in a load balancer.
getMaxInactiveInterval
public int getMaxInactiveInterval()
- Specified by:
getMaxInactiveInterval in interface SessionManager
setMaxInactiveInterval
public void setMaxInactiveInterval(int seconds)
- Specified by:
setMaxInactiveInterval in interface SessionManager
getScavengePeriod
public int getScavengePeriod()
setScavengePeriod
public void setScavengePeriod(int seconds)
addEventListener
public void addEventListener(java.util.EventListener listener)
throws java.lang.IllegalArgumentException
- Description copied from interface:
SessionManager
- Add an event listener.
- Specified by:
addEventListener in interface SessionManager
removeEventListener
public void removeEventListener(java.util.EventListener listener)
- Specified by:
removeEventListener in interface SessionManager
isStarted
public boolean isStarted()
- Specified by:
isStarted in interface org.mortbay.util.LifeCycle
start
public void start()
throws java.lang.Exception
- Description copied from interface:
org.mortbay.util.LifeCycle
- Start the LifeCycle.
- Specified by:
start in interface org.mortbay.util.LifeCycle
stop
public void stop()
- Description copied from interface:
org.mortbay.util.LifeCycle
- Stop the LifeCycle.
The LifeCycle may wait for current activities to complete
normally, but it can be interrupted.
- Specified by:
stop in interface org.mortbay.util.LifeCycle
scavenge
private void scavenge()
- Find sessions that have timed out and invalidate them.
This runs in the SessionScavenger thread.