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
-
Method Summary
Modifier and TypeMethodDescriptionReturns the creation time stamp.boolean
int
hashCode()
id()
Returns the session id.Returns the last used (referenced in request) time stamp.boolean
Marks the session as to be removed.toString()
Return the storage area for transient data.void
Updates 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, values
Methods inherited from class java.util.AbstractMap
clone
Methods 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:
lastUsedAt
in interfaceSession
- Returns:
- the last used timestamp
-
updateLastUsedAt
Updates the last used time stamp.- Specified by:
updateLastUsedAt
in interfaceSession
-
transientData
Description copied from interface:Session
Return 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:
transientData
in interfaceSession
- Returns:
- the storage area
-
hashCode
- Specified by:
hashCode
in interfaceMap<Serializable,
Serializable> - Overrides:
hashCode
in classConcurrentHashMap<Serializable,
Serializable>
-
setBeingDiscarded
Marks the session as to be removed.- Returns:
- false, if called before (session is already being discarded)
-
equals
- Specified by:
equals
in interfaceMap<Serializable,
Serializable> - Overrides:
equals
in classConcurrentHashMap<Serializable,
Serializable>
-
toString
- Overrides:
toString
in classConcurrentHashMap<Serializable,
Serializable>
-