CoherenceTM v3.4.2
Copyright© 2000-2009 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, java.io.Externalizable, java.io.Serializable

public class MonolithicHttpSessionModel
extends AbstractHttpSessionModel
implements java.io.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, javax.servlet.http.HttpSession session, java.lang.String sId)
          Session creation constructor.
 
Method Summary
protected  java.util.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  java.util.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, java.lang.Throwable e)
          Log a serialization failure for an attribute holder.
protected  void readAttributes(java.io.DataInput in)
          Helper to read the session attributes from a stream.
protected  void setAttributeSerializationFailureMap(java.util.Map mapFailures)
          Set the map of attributes that cannot be written.
 java.lang.String toString()
          Returns a string representation of the object.
protected  void writeAttributes(java.io.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, extractAttributeName, extractAttributeNames, flush, getActualAttributeMap, getAttribute, getAttributeMap, getAttributeNameArray, getCollection, getCreationTime, getDescription, getHttpSession, getId, getLastAccessedTime, getLastFlushedTime, getLocalAttributeMap, getMaxInactiveInterval, getReferenceCount, getVersion, instantiateAttributeHolder, instantiateAttributeHolder, isActivatableAttributes, isActive, isExpired, isImmutable, isLocal, isModified, isNew, isOwnedByThisServer, isOwnedByThisThread, isUsable, isValid, makeDistributed, passivate, qualifyAttributeName, readExternal, readExternal, removeAttribute, sessionReturned, setActivatableAttributes, setAttribute, setCollection, setId, setLastAccessedTime, setLastFlushedTime, setMaxInactiveInterval, setModified, setValid, setVersion, 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,
                                  javax.servlet.http.HttpSession session,
                                  java.lang.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(java.io.DataInput in)
                       throws java.io.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:
java.io.IOException - if an I/O exception occurs

writeAttributes

protected void writeAttributes(java.io.DataOutput out)
                        throws java.io.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:
java.io.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 java.util.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(java.util.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 java.util.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,
                                                java.lang.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 java.lang.String toString()
Returns a string representation of the object.

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

CoherenceTM v3.4.2
Copyright© 2000-2009 by Oracle Corporation