Package com.tangosol.coherence.servlet
Class SplitHttpSessionModel
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.servlet.AbstractHttpSessionModel
com.tangosol.coherence.servlet.TraditionalHttpSessionModel
com.tangosol.coherence.servlet.SplitHttpSessionModel
- All Implemented Interfaces:
HttpSessionModel
,ExternalizableLite
,Externalizable
,Serializable
This is an implementation of HttpSessionModel that manages most of its
state in a single serializable unit, but splits out its large attributes --
if any -- into separately managed units. By doing so, the cost of accessing
those attributes is only realized when they are accessed or modified, and
the core session data can remain very small, and thus very efficiently
managed in a distributed environment.
- Version:
- Coherence 2.3
- Author:
- cp 2003.10.28
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
ElasticKey, used by to store segments of a large value that exceeds the flash journal size limit.Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe map of cache and its max value size if using elastic data.static ValueExtractor
ValueExtractor that can be used to extract the session ID from an external attribute key.Fields inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
CTX_OPTIMIZE_MODIFIED_SESSIONS, MAGIC_V350, STRING_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for deserialization.SplitHttpSessionModel
(SplitHttpSessionCollection collection, javax.servlet.http.HttpSession session, String sId) Session creation constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
flush()
Flush the changes to this model to whatever data structure (for example, a cache) that is responsible for managing the model's data.protected NamedCache
Obtain the cache that holds split-out (external) attribute values.int
Determine the minimum size of an attribute such that it is considered "large" and will be stored in a separate "external" or "overflow" cache.protected Map
<Object, Set<SplitHttpSessionModel.ElasticKey>> Obtain the caches that hold segments of large (external) attribute value.protected SplitHttpSessionCollection
Get the SplitHttpSessionCollection that contains this model.protected AttributeHolder
Factory method: Instantiate an AttributeHolder for deserialization purposes.protected AttributeHolder
instantiateAttributeHolder
(String sName, Object oValue) Factory method: Instantiate an AttributeHolder to manage the passed value.protected void
remapExternalAttributes
(String sIdNew) Copy all attributes which are stored in an external cache so that the attribute key reflects the new session id.protected void
Removes an external attribute from the external cache.protected void
Helper method used to forcefully remove all external attributes from the external attribute cache.protected void
setCollection
(AbstractHttpSessionCollection collection) After deserialization, the collection needs to be configured.protected void
setExternalBinary
(Object oKey, Binary binValue) Adds this binary value to the temporary map for flushing.toString()
Returns a string representation of the object.protected void
unbind()
Unbind session attributes.Methods inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
activate, addEnteredThread, bind, checkActive, checkUsable, checkValid, discard, enter, exit, extractAttributeName, extractAttributeNames, getActualAttributeMap, getAttribute, getAttributeMap, getAttributeNameArray, getCollection, getCreationTime, getDescription, getEnteredThreads, getHttpSession, getId, getLastAccessedTime, getLastFlushedTime, getLocalAttributeMap, getMaxInactiveInterval, getNewId, getReferenceCount, getThreadOwner, getVersion, isActivatableAttributes, isActive, isExpired, isExpiredInternal, isImmutable, isLastAccessTimeFlushRequired, isLocal, isModified, isNew, isOwnedByThisThread, isUsable, isValid, logAttributeSerializationFailure, obtainThreadOwnership, passivate, qualifyAttributeName, readAttributes, readExternal, readExternal, releaseThreadOwnership, removeAttribute, removeEnteredThread, resetReferenceCount, sessionReturned, setActivatableAttributes, setAttribute, setHttpSession, setId, setLastAccessedTime, setLastFlushedTime, setMaxInactiveInterval, setModified, setNewId, setValid, setVersion, touch, unbind, writeAttributes, writeExternal, writeExternal
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
SESSION_ID_EXTRACTOR
ValueExtractor that can be used to extract the session ID from an external attribute key. -
s_mapElastic
The map of cache and its max value size if using elastic data. For cache that doesn't use elastic data, the max value size is 0.
-
-
Constructor Details
-
SplitHttpSessionModel
public SplitHttpSessionModel()Default constructor for deserialization. -
SplitHttpSessionModel
public SplitHttpSessionModel(SplitHttpSessionCollection collection, javax.servlet.http.HttpSession session, String sId) Session creation constructor.- Parameters:
collection
- the collection that manages this modelsession
- the session that delegates to this modelsId
- the session ID
-
-
Method Details
-
toString
Returns a string representation of the object.- Overrides:
toString
in classTraditionalHttpSessionModel
- Returns:
- a string representation of the object
-
unbind
protected void unbind()Unbind session attributes.This method may only be called by a thread that owns this model. See
AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.- Overrides:
unbind
in classAbstractHttpSessionModel
-
flush
protected void flush()Flush the changes to this model to whatever data structure (for example, a cache) that is responsible for managing the model's data.This method may only be called by a thread that owns this model. See
AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.- Overrides:
flush
in classAbstractHttpSessionModel
-
setCollection
After deserialization, the collection needs to be configured.- Overrides:
setCollection
in classAbstractHttpSessionModel
- Parameters:
collection
- the AbstractHttpSessionCollection that this model belongs to
-
getSplitHttpSessionCollection
Get the SplitHttpSessionCollection that contains this model.- Returns:
- the SplitHttpSessionCollection that contains this model
-
removeExternalAttributes
protected void removeExternalAttributes()Helper method used to forcefully remove all external attributes from the external attribute cache. -
setExternalBinary
Adds this binary value to the temporary map for flushing.- Parameters:
oKey
- The attribute namebinValue
- The binary value
-
removeExternalAttribute
Removes an external attribute from the external cache.- Parameters:
oKey
- the key
-
getMinExternalAttributeSize
public int getMinExternalAttributeSize()Determine the minimum size of an attribute such that it is considered "large" and will be stored in a separate "external" or "overflow" cache.- Returns:
- the length of attributes, above which they will be stored in the external ("overflow") cache
-
getExternalCache
Obtain the cache that holds split-out (external) attribute values.- Returns:
- the cache that holds split-out (external) attribute values
-
getMultiExternalMap
Obtain the caches that hold segments of large (external) attribute value.- Returns:
- the caches that hold segments of large (external) attribute value
- Since:
- 12.2.1.4.16
-
remapExternalAttributes
Copy all attributes which are stored in an external cache so that the attribute key reflects the new session id.- Parameters:
sIdNew
- the new session id
-
instantiateAttributeHolder
Factory method: Instantiate an AttributeHolder for deserialization purposes.- Overrides:
instantiateAttributeHolder
in classTraditionalHttpSessionModel
- Returns:
- a new AttributeHolder that can be deserialized into
-
instantiateAttributeHolder
Factory method: Instantiate an AttributeHolder to manage the passed value.- Overrides:
instantiateAttributeHolder
in classTraditionalHttpSessionModel
- Parameters:
sName
- the attribute nameoValue
- a non-null Object value- Returns:
- a new AttributeHolder that will manage the passed value
-