Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


com.tangosol.coherence.servlet
Class AbstractHttpSessionModel.AttributeHolder

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.servlet.AbstractHttpSessionModel.AttributeHolder

All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
TraditionalHttpSessionModel.OptimizedHolder
Enclosing class:
AbstractHttpSessionModel

public class AbstractHttpSessionModel.AttributeHolder
extends Base
implements java.io.Externalizable

An immutable object to hold attribute values and related information.


Constructor Summary
AbstractHttpSessionModel.AttributeHolder()
          Default constructor is required for deserialization purposes.
AbstractHttpSessionModel.AttributeHolder(java.lang.String sName, java.lang.Object oValue)
          Construct an AttributeHolder for a value.

 

Method Summary
protected  void flush()
          Called to flush the value to its data storage.
protected  java.lang.Object getInternalValue()
          Obtain the internally managed object value.
 AbstractHttpSessionModel getModel()
          Return the AbstractHttpSessionModel to which this AttributeHolder belongs.
 java.lang.String getName()
          Determine the name of the attribute.
 java.lang.Object getValue()
          Obtain the object form of the value.
 boolean isActivationListener()
          Determine if the value is an object that implements the HttpSessionActivationListener interface.
 boolean isBindingListener()
          Determine if the value is an object that implements the HttpSessionBindingListener interface.
 boolean isLocal()
          If a session distribution controller is used, and if the session is not local (is distributed), then this property specifies whether or not this specific attribute is managed locally.
protected  boolean isSuspect()
          Determine if the value needs to be serialized because it was never serialized or because it could have changed.
 void onBound(AbstractHttpSessionModel.AttributeHolder holderOrig)
          Called when the attribute is bound.
 void onUnbound(boolean fReplaced, boolean fAll)
          Called when the attribute is unbound.
protected  void prepareWrite()
          Called to test serialization; if the holder cannot serialize its value, it should throw an IOException at this point.
 void readExternal(java.io.DataInput in)
          Helper to read the object state from a stream.
 void readExternal(java.io.ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
protected  void setInternalValue(java.lang.Object oValue)
          Store the internally managed object value.
protected  void setLocal(boolean fLocal)
          Specify whether or not this attribute is managed locally.
protected  void setSuspect(boolean fSuspect)
          Toggle the suspect flag for the value.
 void writeExternal(java.io.DataOutput out)
          Helper to write the object state to a stream.
 void writeExternal(java.io.ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

 

Constructor Detail

AbstractHttpSessionModel.AttributeHolder

public AbstractHttpSessionModel.AttributeHolder()
Default constructor is required for deserialization purposes.

AbstractHttpSessionModel.AttributeHolder

public AbstractHttpSessionModel.AttributeHolder(java.lang.String sName,
                                                java.lang.Object oValue)
Construct an AttributeHolder for a value.
Parameters:
sName - the attribute name
oValue - the value of the attribute; not null

Method Detail

getModel

public AbstractHttpSessionModel getModel()
Return the AbstractHttpSessionModel to which this AttributeHolder belongs.
Returns:
the parent AbstractHttpSessionModel

getName

public java.lang.String getName()
Determine the name of the attribute.
Returns:
the attribute name managed by this holder

getValue

public java.lang.Object getValue()
Obtain the object form of the value.
Returns:
the object form of the value

isActivationListener

public boolean isActivationListener()
Determine if the value is an object that implements the HttpSessionActivationListener interface.
Returns:
true if the value implements HttpSessionActivationListener

isBindingListener

public boolean isBindingListener()
Determine if the value is an object that implements the HttpSessionBindingListener interface.
Returns:
true if the value implements HttpSessionBindingListener

onBound

public void onBound(AbstractHttpSessionModel.AttributeHolder holderOrig)
Called when the attribute is bound.
Parameters:
holderOrig - the holder that this new bound holder is replacing, if any, otherwise null

onUnbound

public void onUnbound(boolean fReplaced,
                      boolean fAll)
Called when the attribute is unbound.
Parameters:
fReplaced - set to true of this is the result of a bind operation (so the holder is being replaced)
fAll - true if this method is called within the context of an AbstractHttpSessionModel.unbind() call

isLocal

public boolean isLocal()
If a session distribution controller is used, and if the session is not local (is distributed), then this property specifies whether or not this specific attribute is managed locally.
Returns:
true iff the attribute is managed locally

setLocal

protected void setLocal(boolean fLocal)
Specify whether or not this attribute is managed locally.

Note: an attribute could change from local to distributed if and only if a session distribution controller is used and the session is distributed. It could change from distributed to local only as a result of serialization failure when the attribute preservation feature is enabled.

Parameters:
fLocal - true iff the attribute is managed locally

flush

protected void flush()
              throws java.io.IOException
Called to flush the value to its data storage.
Throws:
java.io.IOException - on I/O error

getInternalValue

protected java.lang.Object getInternalValue()
Obtain the internally managed object value.
Returns:
the cached object form of the value, or null if it has not been lazily deserialized

setInternalValue

protected void setInternalValue(java.lang.Object oValue)
Store the internally managed object value.
Parameters:
oValue - the object form of the value

isSuspect

protected boolean isSuspect()
Determine if the value needs to be serialized because it was never serialized or because it could have changed.
Returns:
true if the holder's value has been accessed and is mutable

setSuspect

protected void setSuspect(boolean fSuspect)
Toggle the suspect flag for the value. Method provided to enable effective subclassing.
Parameters:
fSuspect - true if suspect, false otherwise

prepareWrite

protected void prepareWrite()
                     throws java.io.IOException
Called to test serialization; if the holder cannot serialize its value, it should throw an IOException at this point. Note that this method should only be called as part of the "write" processing for the model, as the holder will expect an immediate follow-up call to actually write itself out.
Throws:
java.io.IOException - if the holder cannot serialize its value

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
java.io.IOException - if an I/O exception occurs

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the stream to write the object to
Throws:
java.io.IOException - if an I/O exception occurs

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
Helper to read the object state from a stream.
Parameters:
in - the stream to read data from in order to restore the object
Throws:
java.io.IOException - if an I/O exception occurs

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Helper to write the object state to a stream.
Parameters:
out - the stream to write the object to
Throws:
java.io.IOException - if an I/O exception occurs

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


Copyright © 2000, 2009, Oracle. All rights reserved.