CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.coherence.servlet
Class MonolithicHttpSessionModel

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.servlet.AbstractHttpSessionModel
          extended by com.tangosol.coherence.servlet.MonolithicHttpSessionModel
All Implemented Interfaces:
HttpSessionModel, ExternalizableLite, Externalizable, Serializable

public class MonolithicHttpSessionModel
extends AbstractHttpSessionModel
implements Externalizable, ExternalizableLite

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.

Note that the Externalizable implementation on this class is just there to throw exceptions that this class is not Serializable or Externalizable. Use ExternalizableLite instead.

Version:
Coherence 2.5
Author:
cp 2004.08.16

Nested Class Summary
 
Nested classes/interfaces inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
AbstractHttpSessionModel.AttributeHolder
 
Field Summary
 
Fields inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel
ENTRY_ARRAY, STRING_ARRAY
 
Constructor Summary
MonolithicHttpSessionModel()
          Default constructor for deserialization.
MonolithicHttpSessionModel(MonolithicHttpSessionCollection collection, HttpSession session, String sId)
          Session creation constructor.
 
Method Summary
protected  Map ensureAttributeSerializationFailureMap()
          Ensure that the map of attributes that cannot be written exists, creating it if necessary, and return it.
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(AbstractHttpSessionModel.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, bind, checkActive, checkUsable, checkValid, discard, enter, exit, flush, getActualAttributeMap, getAttribute, getAttributeMap, getAttributeNameArray, getCollection, getCreationTime, getDescription, getHttpSession, getId, getLastAccessedTime, getLastFlushedTime, getLocalAttributeMap, getMaxInactiveInterval, getReferenceCount, instantiateAttributeHolder, instantiateAttributeHolder, isActivatableAttributes, isActive, isExpired, isImmutable, isLocal, isModified, isNew, isOwnedByThisServer, isOwnedByThisThread, isUsable, isValid, makeDistributed, passivate, readExternal, readExternal, removeAttribute, sessionReturned, setActivatableAttributes, setAttribute, setCollection, setId, setLastAccessedTime, setLastFlushedTime, setMaxInactiveInterval, setModified, setValid, touch, unbind, unbind, writeExternal, writeExternal
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface com.tangosol.io.ExternalizableLite
readExternal, writeExternal
 

Constructor Detail

MonolithicHttpSessionModel

public MonolithicHttpSessionModel()
Default constructor for deserialization.


MonolithicHttpSessionModel

public MonolithicHttpSessionModel(MonolithicHttpSessionCollection collection,
                                  HttpSession session,
                                  String sId)
Session creation constructor.

Parameters:
collection - the collection that manages this model
session - the session that delegates to this model
sId - 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 class AbstractHttpSessionModel
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 class AbstractHttpSessionModel
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.


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(AbstractHttpSessionModel.AttributeHolder holder,
                                                Throwable e)
Log a serialization failure for an attribute holder.

Overrides:
logAttributeSerializationFailure in class AbstractHttpSessionModel
Parameters:
holder - the attribute holder that failed to serialize its value
e - the throwable object that resulted from the serialization failure

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class AbstractHttpSessionModel
Returns:
a string representation of the object

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation