Package com.tangosol.coherence.servlet
Class MonolithicHttpSessionModel
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.coherence.servlet.AbstractHttpSessionModel
-
- com.tangosol.coherence.servlet.MonolithicHttpSessionModel
-
- All Implemented Interfaces:
HttpSessionModel
,ExternalizableLite
,Externalizable
,Serializable
public class MonolithicHttpSessionModel extends AbstractHttpSessionModel
This is an implementation of HttpSessionModel that manages its attribute state in a single ('monolithic') serializable unit, allowing session attributes to safely form graphs while avoiding duplication of objects, yet not being able to optimize attribute serialization and deserialization as a result.- Version:
- Coherence 2.5
- Author:
- cp 2004.08.16
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
-
Fields inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
CTX_OPTIMIZE_MODIFIED_SESSIONS, MAGIC_V350, STRING_ARRAY
-
-
Constructor Summary
Constructors Constructor Description MonolithicHttpSessionModel()
Default constructor for deserialization.MonolithicHttpSessionModel(MonolithicHttpSessionCollection collection, javax.servlet.http.HttpSession session, String sId)
Session creation constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map
ensureAttributeSerializationFailureMap()
Ensure that the map of attributes that cannot be written exists, creating it if necessary, and return it.protected void
enter()
Increment the usage count of the session by this thread.protected void
enterWriteAttributes()
Specify that the attributes are now being written.protected Map
getAttributeSerializationFailureMap()
Get the map of attributes that cannot be written.protected boolean
isWritingAttributes()
Determine if the attributes are currently being written.protected void
leaveWriteAttributes()
Specify that the attributes are no longer being written.protected void
logAttributeSerializationFailure(AttributeHolder holder, Throwable e)
Log a serialization failure for an attribute holder.protected void
readAttributes(DataInput in)
Helper to read the session attributes from a stream.protected void
setAttributeSerializationFailureMap(Map mapFailures)
Set the map of attributes that cannot be written.String
toString()
Returns a string representation of the object.protected void
writeAttributes(DataOutput out)
Helper to write the session attributes to a stream.-
Methods inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
activate, addEnteredThread, bind, checkActive, checkUsable, checkValid, discard, exit, extractAttributeName, extractAttributeNames, flush, getActualAttributeMap, getAttribute, getAttributeMap, getAttributeNameArray, getCollection, getCreationTime, getDescription, getEnteredThreads, getHttpSession, getId, getLastAccessedTime, getLastFlushedTime, getLocalAttributeMap, getMaxInactiveInterval, getNewId, getReferenceCount, getThreadOwner, getVersion, instantiateAttributeHolder, instantiateAttributeHolder, isActivatableAttributes, isActive, isExpired, isExpiredInternal, isImmutable, isLastAccessTimeFlushRequired, isLocal, isModified, isNew, isOwnedByThisThread, isUsable, isValid, obtainThreadOwnership, passivate, qualifyAttributeName, readExternal, readExternal, releaseThreadOwnership, removeAttribute, removeEnteredThread, resetReferenceCount, sessionReturned, setActivatableAttributes, setAttribute, setCollection, setHttpSession, setId, setLastAccessedTime, setLastFlushedTime, setMaxInactiveInterval, setModified, setNewId, setValid, setVersion, touch, unbind, unbind, 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, 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
-
-
-
-
Constructor Detail
-
MonolithicHttpSessionModel
public MonolithicHttpSessionModel()
Default constructor for deserialization.
-
MonolithicHttpSessionModel
public MonolithicHttpSessionModel(MonolithicHttpSessionCollection 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 Detail
-
readAttributes
protected void readAttributes(DataInput in) throws IOException
Helper to read the session attributes from a stream.- Overrides:
readAttributes
in classAbstractHttpSessionModel
- Parameters:
in
- the stream to read data from in order to restore the object- Throws:
IOException
- if an I/O exception occurs
-
writeAttributes
protected void writeAttributes(DataOutput out) throws IOException
Helper to write the session attributes to a stream.- Overrides:
writeAttributes
in classAbstractHttpSessionModel
- Parameters:
out
- the stream to write the object to- Throws:
IOException
- if an I/O exception occurs
-
enterWriteAttributes
protected void enterWriteAttributes()
Specify that the attributes are now being written.
-
leaveWriteAttributes
protected void leaveWriteAttributes()
Specify that the attributes are no longer being written.
-
isWritingAttributes
protected boolean isWritingAttributes()
Determine if the attributes are currently being written.- Returns:
- true if the
writeAttributes(java.io.DataOutput)
processing is occurring
-
getAttributeSerializationFailureMap
protected Map getAttributeSerializationFailureMap()
Get the map of attributes that cannot be written. This map should only exist during attribute serialization, and only if failures occur.- Returns:
- a map of currently accumulating unserializable attributes, or null
-
setAttributeSerializationFailureMap
protected void setAttributeSerializationFailureMap(Map mapFailures)
Set the map of attributes that cannot be written. This map should only exist during attribute serialization, and only if failures occur.- Parameters:
mapFailures
- the map
-
ensureAttributeSerializationFailureMap
protected Map ensureAttributeSerializationFailureMap()
Ensure that the map of attributes that cannot be written exists, creating it if necessary, and return it.- Returns:
- a map of currently accumulating unserializable attributes; never null
-
logAttributeSerializationFailure
protected void logAttributeSerializationFailure(AttributeHolder holder, Throwable e)
Log a serialization failure for an attribute holder.- Overrides:
logAttributeSerializationFailure
in classAbstractHttpSessionModel
- Parameters:
holder
- the attribute holder that failed to serialize its valuee
- the throwable object that resulted from the serialization failure
-
enter
protected void enter()
Description copied from class:AbstractHttpSessionModel
Increment the usage count of the session by this thread.This method may only be called by a thread that owns this model. See
AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.- Overrides:
enter
in classAbstractHttpSessionModel
-
toString
public String toString()
Returns a string representation of the object.- Overrides:
toString
in classAbstractHttpSessionModel
- Returns:
- a string representation of the object
-
-