@ManagedObject public class DefaultSessionCache extends AbstractSessionCache
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Session> |
_sessions
The cache of sessions in a hashmap
|
private CounterStatistic |
_stats |
private static Logger |
LOG |
_context, _evictionPolicy, _flushOnResponseCommit, _handler, _invalidateOnShutdown, _removeUnloadableSessions, _saveOnCreate, _saveOnInactiveEviction, _sessionDataStoreFAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPINGEVICT_ON_INACTIVITY, EVICT_ON_SESSION_EXIT, NEVER_EVICT| Constructor and Description |
|---|
DefaultSessionCache(SessionHandler manager) |
| Modifier and Type | Method and Description |
|---|---|
protected Session |
doComputeIfAbsent(java.lang.String id,
java.util.function.Function<java.lang.String,Session> mappingFunction)
Compute the mappingFunction to create a Session object iff the session
with the given id isn't already in the map, otherwise return the existing Session.
|
Session |
doDelete(java.lang.String id)
Remove the session with this identity from the store
|
Session |
doGet(java.lang.String id)
Get the session matching the key from the cache.
|
Session |
doPutIfAbsent(java.lang.String id,
Session session)
Put the session into the map if it wasn't already there
|
boolean |
doReplace(java.lang.String id,
Session oldValue,
Session newValue)
Replace the mapping from id to oldValue with newValue
|
long |
getSessionsCurrent() |
long |
getSessionsMax() |
long |
getSessionsTotal() |
Session |
newSession(javax.servlet.http.HttpServletRequest request,
SessionData data)
Create a new Session for a request.
|
Session |
newSession(SessionData data)
Create a new Session object from pre-existing session data
|
void |
resetStats() |
void |
shutdown() |
add, checkExpiration, checkInactiveSession, commit, contains, delete, doStart, doStop, exists, get, getAndEnter, getEvictionPolicy, getSessionDataStore, getSessionHandler, initialize, isFlushOnResponseCommit, isInvalidateOnShutdown, isRemoveUnloadableSessions, isSaveOnCreate, isSaveOnInactiveEviction, newSession, put, release, renewSessionId, renewSessionId, setEvictionPolicy, setFlushOnResponseCommit, setInvalidateOnShutdown, setRemoveUnloadableSessions, setSaveOnCreate, setSaveOnInactiveEviction, setSessionDataStore, toStringaddBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitrenewSessionIdaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedprivate static final Logger LOG
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Session> _sessions
private final CounterStatistic _stats
public DefaultSessionCache(SessionHandler manager)
manager - The SessionHandler related to this SessionCache@ManagedAttribute(value="current sessions in cache", readonly=true) public long getSessionsCurrent()
@ManagedAttribute(value="max sessions in cache", readonly=true) public long getSessionsMax()
@ManagedAttribute(value="total sessions in cache", readonly=true) public long getSessionsTotal()
@ManagedOperation(value="reset statistics", impact="ACTION") public void resetStats()
public Session doGet(java.lang.String id)
AbstractSessionCachedoGet in class AbstractSessionCacheid - session idpublic Session doPutIfAbsent(java.lang.String id, Session session)
AbstractSessionCachedoPutIfAbsent in class AbstractSessionCacheid - the identity of the sessionsession - the session objectprotected Session doComputeIfAbsent(java.lang.String id, java.util.function.Function<java.lang.String,Session> mappingFunction)
AbstractSessionCacheConcurrentHashMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>)doComputeIfAbsent in class AbstractSessionCacheid - the session idmappingFunction - the function to load the data for the sessionpublic Session doDelete(java.lang.String id)
AbstractSessionCachedoDelete in class AbstractSessionCacheid - the idpublic void shutdown()
public Session newSession(javax.servlet.http.HttpServletRequest request, SessionData data)
AbstractSessionCachenewSession in class AbstractSessionCacherequest - the requestdata - the session datapublic Session newSession(SessionData data)
AbstractSessionCachenewSession in interface SessionCachenewSession in class AbstractSessionCachedata - the session datapublic boolean doReplace(java.lang.String id,
Session oldValue,
Session newValue)
AbstractSessionCachedoReplace in class AbstractSessionCacheid - the idoldValue - the old valuenewValue - the new value