Class InMemorySessionManager
- All Implemented Interfaces:
Iterable<ComponentType>,Channel,ComponentType,Eligible,Manager
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgrapes.http.SessionManager
SessionManager.SessionManagerInfo, SessionManager.SessionManagerMXBean, SessionManager.SessionManagerSummaryMXBeanNested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new session manager with its channel set to itself and the path set to “/”.InMemorySessionManager(String path) Creates a new session manager with its channel set to itself and the path set to the given path.InMemorySessionManager(Channel componentChannel) Creates a new session manager with its channel set to the given channel, the path to “/” and the handler’s priority to 1000.InMemorySessionManager(Channel componentChannel, String path) Creates a new session manager with the given channel and path.InMemorySessionManager(Channel componentChannel, String pattern, int priority, String path) Creates a new session manager using the given channel and path. -
Method Summary
Modifier and TypeMethodDescriptionprotected SessioncreateSession(String sessionId) Creates a new session with the given id.lookupSession(String sessionId) Lookup the session with the given id.protected voidremoveSession(String sessionId) Removes the given session from the cache.protected intReturn the number of established sessions.startDiscarding(long absoluteTimeout, long idleTimeout) Start discarding all sessions (generateDiscardSessionevents) that have reached their absolute or idle timeout.Methods inherited from class org.jgrapes.http.SessionManager
absoluteTimeout, addSessionCookie, derivePattern, hasTimedOut, idleTimeout, idName, maxSessions, onDiscard, onProtocolSwitchAccepted, onRequest, path, setAbsoluteTimeout, setIdleTimeout, setIdName, setMaxSessions, setSessionSupplierMethods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setNameMethods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGeneratorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
InMemorySessionManager
public InMemorySessionManager()Creates a new session manager with its channel set to itself and the path set to “/”.The manager handles all
Requestevents. -
InMemorySessionManager
Creates a new session manager with its channel set to itself and the path set to the given path.The manager handles all requests that match the given path, using the same rules as browsers do for selecting the cookies that are to be sent.
- Parameters:
path- the path
-
InMemorySessionManager
Creates a new session manager with its channel set to the given channel, the path to “/” and the handler’s priority to 1000.The manager handles all
Requestevents.- Parameters:
componentChannel- the component channel
-
InMemorySessionManager
Creates a new session manager with the given channel and path.The manager handles all requests that match the given path, using the same rules as browsers do for selecting the cookies that are to be sent. The request handler’s priority is set to 1000.
- Parameters:
componentChannel- the component channelpath- the path
-
InMemorySessionManager
Creates a new session manager using the given channel and path.The manager handles only requests that match the given pattern. The
Requesthandler is registered with the given priority.This constructor can be used if special handling of top level requests is needed.
- Parameters:
componentChannel- the component channelpattern- the path part of aResourcePatternpriority- the prioritypath- the path
-
-
Method Details
-
startDiscarding
Description copied from class:SessionManagerStart discarding all sessions (generateDiscardSessionevents) that have reached their absolute or idle timeout.Do not make the sessions unavailable yet.
Returns the time when the next timeout occurs. This method is called only if at least one of the timeouts has been specified.
Implementations have to take care that sessions are only discarded once. As they must remain available while the
DiscardSessionevent is handled this may require marking them as being discarded.- Specified by:
startDiscardingin classSessionManager- Parameters:
absoluteTimeout- the absolute timeoutidleTimeout- the idle timeout- Returns:
- the next timeout (empty if no sessions left)
-
createSession
Description copied from class:SessionManagerCreates a new session with the given id.- Specified by:
createSessionin classSessionManager- Parameters:
sessionId-- Returns:
- the session
-
lookupSession
Description copied from class:SessionManagerLookup the session with the given id.Lookup will fail if the session has timed out.
- Specified by:
lookupSessionin classSessionManager- Parameters:
sessionId-- Returns:
- the session
-
removeSession
Description copied from class:SessionManagerRemoves the given session from the cache.- Specified by:
removeSessionin classSessionManager- Parameters:
sessionId- the session id
-
sessionCount
Description copied from class:SessionManagerReturn the number of established sessions.- Specified by:
sessionCountin classSessionManager- Returns:
- the result
-