Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


com.tangosol.coherence.servlet
Class SplitHttpSessionModel.SplittableHolder

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.servlet.AbstractHttpSessionModel.AttributeHolder
          extended by com.tangosol.coherence.servlet.TraditionalHttpSessionModel.OptimizedHolder
              extended by com.tangosol.coherence.servlet.SplitHttpSessionModel.SplittableHolder

All Implemented Interfaces:
ExternalizableLite, java.io.Externalizable, java.io.Serializable
Enclosing class:
SplitHttpSessionModel

public class SplitHttpSessionModel.SplittableHolder
extends TraditionalHttpSessionModel.OptimizedHolder

An immutable object to hold attribute values and related information. In this AttributeHolder sub-class, the binary value will be null if it has not been serialized, empty if it is external and has not been fetched yet, or a valid binary value.


Constructor Summary
SplitHttpSessionModel.SplittableHolder()
          Default constructor for ExternalizableLite.
SplitHttpSessionModel.SplittableHolder(java.lang.String sName, java.lang.Object oValue)
          Construct an AttributeHolder for a value.

 

Method Summary
protected  Binary ensureInternalBinary()
          Obtain the non-null internally managed binary value.
protected  void flush()
          Called to flush the value to its data storage.
protected  Binary getExternalBinary()
          Obtain the binary form of the value from the external cache.
protected  NamedCache getExternalCache()
          Obtain the cache that holds split-out (external) attribute values.
protected  java.lang.Object getExternalKey()
          Build a key that will be used to access the binary value for this attribute holder that in the external cache.
protected  boolean isExternal()
          Determine if the value is stored in the external cache.
protected  boolean isExternalDesirable(Binary binValue)
          Decide whether or not this holder will choose to store the passed binary value in its external storage.
 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. 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.
protected  Binary readBinary(java.io.DataInput in)
          Read the binary value.
protected  void removeExternalBinary()
          Remove the binary form of the value from the external cache.
protected  void setExternal(boolean fExternal)
          Specify that the value is stored in the external cache.
protected  void setExternalBinary(Binary binValue)
          Store the binary form of the value in the external cache.
protected  void writeBinary(java.io.DataOutput out)
          Write the binary value.

 

Methods inherited from class com.tangosol.coherence.servlet.TraditionalHttpSessionModel.OptimizedHolder
deserializeValue, getBinary, getInternalBinary, getValue, readExternal, serializeValue, setInternalBinary, writeExternal

 

Methods inherited from class com.tangosol.coherence.servlet.AbstractHttpSessionModel.AttributeHolder
getInternalValue, getModel, getName, isActivationListener, isBindingListener, isLocal, isSuspect, readExternal, setInternalValue, setLocal, setSuspect, writeExternal

 

Constructor Detail

SplitHttpSessionModel.SplittableHolder

public SplitHttpSessionModel.SplittableHolder()
Default constructor for ExternalizableLite.

SplitHttpSessionModel.SplittableHolder

public SplitHttpSessionModel.SplittableHolder(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

onBound

public void onBound(AbstractHttpSessionModel.AttributeHolder holderOrig)
Called when the attribute is bound.
Overrides:
onBound in class AbstractHttpSessionModel.AttributeHolder
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.
Overrides:
onUnbound in class AbstractHttpSessionModel.AttributeHolder
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

flush

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

ensureInternalBinary

protected Binary ensureInternalBinary()
Obtain the non-null internally managed binary value. This method allows sub-classes to lazily load the cached binary.

This method is explicitly NOT a "MAKE BINARY OUT OF VALUE" method. It is only intended to allow lazy loading of the pre-existing binary value, for example from a distributed cache.

Overrides:
ensureInternalBinary in class TraditionalHttpSessionModel.OptimizedHolder
Returns:
the binary form of the value, but never null

isExternal

protected boolean isExternal()
Determine if the value is stored in the external cache. The value in the external cache is not necessarily up to date; this only indicates whether it is there at all.
Returns:
true if the holder's value is stored in the external cache

setExternal

protected void setExternal(boolean fExternal)
Specify that the value is stored in the external cache.
Parameters:
fExternal - true if the object is stored in the external cache

isExternalDesirable

protected boolean isExternalDesirable(Binary binValue)
Decide whether or not this holder will choose to store the passed binary value in its external storage.
Parameters:
binValue - the binary value to evaluate to determine whether it should be stored internally or externally
Returns:
true if this holder will store the passed value in an external cache, false otherwise

getExternalCache

protected NamedCache getExternalCache()
Obtain the cache that holds split-out (external) attribute values.
Returns:
the cache that holds split-out (external) attribute values

getExternalKey

protected java.lang.Object getExternalKey()
Build a key that will be used to access the binary value for this attribute holder that in the external cache.
Returns:
the key for this attribute holder's value in the external cache

getExternalBinary

protected Binary getExternalBinary()
Obtain the binary form of the value from the external cache.
Returns:
the binary form of the value or null if it hasn't been stored in the external cache yet

setExternalBinary

protected void setExternalBinary(Binary binValue)
Store the binary form of the value in the external cache.
Parameters:
binValue - the binary form of the value to store in the external cache

removeExternalBinary

protected void removeExternalBinary()
Remove the binary form of the value from the external cache.

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.
Overrides:
prepareWrite in class TraditionalHttpSessionModel.OptimizedHolder
Throws:
java.io.IOException - if the holder cannot serialize its value

readBinary

protected Binary readBinary(java.io.DataInput in)
                     throws java.io.IOException
Read the binary value. This is part of deserialization processing, and is separated out to enable subclassing.
Overrides:
readBinary in class TraditionalHttpSessionModel.OptimizedHolder
Parameters:
in - the DataInput that this holder is being deserialized from
Returns:
the binary value
Throws:
java.io.IOException - on I/O error

writeBinary

protected void writeBinary(java.io.DataOutput out)
                    throws java.io.IOException
Write the binary value. This is part of serialization processing, and is separated out to enable subclassing.
Overrides:
writeBinary in class TraditionalHttpSessionModel.OptimizedHolder
Parameters:
out - the DataOutput that this holder is being serialized to
Throws:
java.io.IOException - on I/O error

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


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