ManagedSession objects for a context.
Ideally, multiple requests for the same session id in the same context will always
share the same Session object from the SessionCache, but it would be possible
for implementations of SessionCache to create a fresh object for each request.
The SessionData pertaining to the Session objects is obtained from/written to a SessionDataStore.
The SessionDataStore is the authoritative source of session data:
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(String
id id, ManagedSession session session)Adds a new Session, with a never-before-used id, to the cache. |
| public Set | Returns: the set of session ids that have actually expired: this can be a superset of the original candidate list.the session ids to check candidates)Check a list of session ids that belong to potentially expired sessions. |
| public void | checkInactiveSession(ManagedSession
the session to check session)Check a Session to see if it might be appropriate to evict or expire. |
| public void | |
| public boolean | |
| public ManagedSession | |
| public boolean | |
| public ManagedSession | |
| public int | |
| public SessionDataStore | |
| public SessionManager | |
| public void | |
| public boolean | Returns: true if dirty sessions should be written
before the response is committed.
|
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public ManagedSession | Returns: a new Sessionthe unique id associated to the session id, long the timestamp of the session creation time, long the max inactive time in milliseconds maxInactiveMs)Create an entirely new Session. |
| public ManagedSession | Returns: a Session object for the data suppliedthe data associated with the session data)Re-materialize a Session that has previously existed. |
| public void | |
| public ManagedSession | Returns: the Session after changing its idthe current session id oldId, String the new session id newId, String the current extended session id oldExtendedId, String the new extended session id newExtendedId)Change the id of a Session. |
| public void | setEvictionPolicy(int
-1 is never evict; 0 is evict-on-exit; and any other positive
value is the time in seconds that a session can be idle before it can
be evicted. policy)Sessions in this cache can be:
|
| public void | setFlushOnResponseCommit(boolean flushOnResponse)
If true, a dirty session will be written to the SessionDataStore just before a response is returned to the client. |
| public void | setInvalidateOnShutdown(boolean
true invalidate all sessions in cache on server shutdown invalidateOnShutdown)If true, all existing sessions in the cache will be invalidated when the server shuts down. |
| public void | setRemoveUnloadableSessions(boolean
true to delete session which cannot be loadedIf the data for a session exists but is unreadable, the SessionCache can instruct the SessionDataStore to delete it. |
| public void | setSaveOnCreate(boolean
true to immediately save the newly created sessionWhether or not a session that is newly created should be immediately saved. |
| public void | setSaveOnInactiveEviction(boolean
true if the session should be saved before being evictedWhether or not a a session that is about to be evicted should be saved before being evicted. |
| public void | setSessionDataStore(SessionDataStore
the sds)SessionDataStore to useA SessionDataStore that is the authoritative source of session information. |
| public void |
| EVICT_ON_INACTIVITY | back to summary |
|---|---|
| public static final int EVICT_ON_INACTIVITY | |
| EVICT_ON_SESSION_EXIT | back to summary |
|---|---|
| public static final int EVICT_ON_SESSION_EXIT | |
| NEVER_EVICT | back to summary |
|---|---|
| public static final int NEVER_EVICT | |
| add | back to summary |
|---|---|
| public void add(String id, ManagedSession session) throws Exception Adds a new Session, with a never-before-used id, to the cache.
| |
| checkExpiration | back to summary |
|---|---|
| public Set Check a list of session ids that belong to potentially expired sessions. The Session in the cache should be checked, but also the SessionDataStore, as that is the authoritative source of all session information. | |
| checkInactiveSession | back to summary |
|---|---|
| public void checkInactiveSession(ManagedSession session) Check a Session to see if it might be appropriate to evict or expire.
| |
| commit | back to summary |
|---|---|
| public void commit(ManagedSession session) throws Exception Called when a response is about to be committed. The cache can write the session to ensure that the SessionDataStore contains changes to the session that occurred during the lifetime of the request. This can help ensure that if a subsequent request goes to a different server, it will be able to see the session changes via the shared store. | |
| contains | back to summary |
|---|---|
| public boolean contains(String id) throws Exception Check to see if a Session is in the cache. Does NOT consult the SessionDataStore. | |
| delete | back to summary |
|---|---|
| public ManagedSession delete(String id) throws Exception Remove a Session completely: from both this cache and the SessionDataStore.
| |
| exists | back to summary |
|---|---|
| public boolean exists(String id) throws Exception Check to see if a session exists: WILL consult the SessionDataStore. | |
| get | back to summary |
|---|---|
| public ManagedSession get(String id) throws Exception Get an existing Session. If necessary, the cache will load the data for the session from the configured SessionDataStore.
| |
| getEvictionPolicy | back to summary |
|---|---|
public int getEvictionPolicy()
| |
| getSessionDataStore | back to summary |
|---|---|
public SessionDataStore getSessionDataStore()
| |
| getSessionManager | back to summary |
|---|---|
| public SessionManager getSessionManager() | |
| initialize | back to summary |
|---|---|
public void initialize(SessionContext context)
| |
| isFlushOnResponseCommit | back to summary |
|---|---|
public boolean isFlushOnResponseCommit()
| |
| isInvalidateOnShutdown | back to summary |
|---|---|
| public boolean isInvalidateOnShutdown() | |
| isRemoveUnloadableSessions | back to summary |
|---|---|
public boolean isRemoveUnloadableSessions()
| |
| isSaveOnCreate | back to summary |
|---|---|
public boolean isSaveOnCreate()
| |
| isSaveOnInactiveEviction | back to summary |
|---|---|
public boolean isSaveOnInactiveEviction()
| |
| newSession | back to summary |
|---|---|
| public ManagedSession newSession(String id, long time, long maxInactiveMs) Create an entirely new Session.
| |
| newSession | back to summary |
|---|---|
| public ManagedSession newSession(SessionData data) Re-materialize a Session that has previously existed.
| |
| release | back to summary |
|---|---|
| public void release(ManagedSession session) throws Exception Finish using a Session. This is called by the SessionHandler once a request is finished with a Session. SessionCache implementations may want to delay writing out Session contents until the last request exits a Session.
| |
| renewSessionId | back to summary |
|---|---|
| public ManagedSession renewSessionId(String oldId, String newId, String oldExtendedId, String newExtendedId) throws Exception Change the id of a Session. | |
| setEvictionPolicy | back to summary |
|---|---|
| public void setEvictionPolicy(int policy) Sessions in this cache can be:
| |
| setFlushOnResponseCommit | back to summary |
|---|---|
| public void setFlushOnResponseCommit(boolean flushOnResponse) If true, a dirty session will be written to the SessionDataStore just before a response is returned to the client. This ensures that subsequent requests to either the same node or a different node see the changed session data. | |
| setInvalidateOnShutdown | back to summary |
|---|---|
| public void setInvalidateOnShutdown(boolean invalidateOnShutdown) If true, all existing sessions in the cache will be invalidated when the server shuts down. Default is false.
| |
| setRemoveUnloadableSessions | back to summary |
|---|---|
| public void setRemoveUnloadableSessions(boolean removeUnloadableSessions) If the data for a session exists but is unreadable, the SessionCache can instruct the SessionDataStore to delete it.
| |
| setSaveOnCreate | back to summary |
|---|---|
| public void setSaveOnCreate(boolean saveOnCreate) Whether or not a session that is newly created should be immediately saved. If false, a session that is created and invalidated within a single request is never persisted.
| |
| setSaveOnInactiveEviction | back to summary |
|---|---|
| public void setSaveOnInactiveEviction(boolean saveOnEvict) Whether or not a a session that is about to be evicted should be saved before being evicted.
| |
| setSessionDataStore | back to summary |
|---|---|
| public void setSessionDataStore(SessionDataStore sds) A SessionDataStore that is the authoritative source of session information.
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() | |