Package org.jgrapes.http
Class InMemorySession
- All Implemented Interfaces:
Serializable,ConcurrentMap<Serializable,,Serializable> Map<Serializable,,Serializable> Session
public class InMemorySession
extends ConcurrentHashMap<Serializable,Serializable>
implements Session
Implements the
Session interface using a ConcurrentHashMap.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap
ConcurrentHashMap.KeySetView<K,V> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the creation time stamp.booleaninthashCode()id()Returns the session id.Returns the last used (referenced in request) time stamp.booleanMarks the session as to be removed.toString()Return the storage area for transient data.voidUpdates the last used time stamp.Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, valuesMethods inherited from class java.util.AbstractMap
cloneMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
InMemorySession
Create a new session.
-
-
Method Details
-
id
Returns the session id. -
createdAt
Returns the creation time stamp. -
lastUsedAt
Returns the last used (referenced in request) time stamp.- Specified by:
lastUsedAtin interfaceSession- Returns:
- the last used timestamp
-
updateLastUsedAt
Updates the last used time stamp.- Specified by:
updateLastUsedAtin interfaceSession
-
transientData
Description copied from interface:SessionReturn the storage area for transient data.Usually implemented by a
ConcurrentHashMap. Other implementations must at least provide the same support for concurrency asConcurrentHashMap.- Specified by:
transientDatain interfaceSession- Returns:
- the storage area
-
hashCode
- Specified by:
hashCodein interfaceMap<Serializable,Serializable> - Overrides:
hashCodein classConcurrentHashMap<Serializable,Serializable>
-
setBeingDiscarded
Marks the session as to be removed.- Returns:
- false, if called before (session is already being discarded)
-
equals
- Specified by:
equalsin interfaceMap<Serializable,Serializable> - Overrides:
equalsin classConcurrentHashMap<Serializable,Serializable>
-
toString
- Overrides:
toStringin classConcurrentHashMap<Serializable,Serializable>
-