Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.coherence.servlet
Class TraditionalHttpSessionModel.OptimizedHolder

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.coherence.servlet.AbstractHttpSessionModel.AttributeHolder
              com.tangosol.coherence.servlet.TraditionalHttpSessionModel.OptimizedHolder

All Implemented Interfaces:
  ExternalizableLite, java.io.Externalizable, java.io.Serializable

Direct Known Subclasses:
  SplitHttpSessionModel.SplittableHolder

Enclosing class:
  TraditionalHttpSessionModel

    public class TraditionalHttpSessionModel.OptimizedHolder

extends AbstractHttpSessionModel.AttributeHolder
implements ExternalizableLite

An immutable object to hold attribute values and related information.

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

Method Summary
`protected java.lang.Object` | `deserializeValue(Binary bin)` Take the Binary form of the attribute value and turn it into the object value.
`protected Binary` | `ensureInternalBinary()` Obtain the non-null internally managed binary value.
`Binary` | `getBinary()` Obtain the binary form of the value.
`protected Binary` | `getInternalBinary()` Obtain the internally managed binary value.
`java.lang.Object` | `getValue()` Obtain the object form of the value.
`protected void` | `prepareWrite()` Called to test serialization; if the holder cannot serialize its value, it should throw an IOException at this point.
`protected Binary` | `readBinary(java.io.DataInput in)` Read the binary value.
`void` | `readExternal(java.io.DataInput in)` Helper to read the object state from a stream.
`protected Binary` | `serializeValue(java.lang.Object o)` Take the passed object and turn it into a Binary value.
`protected void` | `setInternalBinary(Binary binValue)` Store the internally managed binary value.
`protected void` | `writeBinary(java.io.DataOutput out)` Write the binary value.
`void` | `writeExternal(java.io.DataOutput out)` Helper to write the object state to a stream.

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

Constructor Detail

### TraditionalHttpSessionModel.OptimizedHolder

    public TraditionalHttpSessionModel.OptimizedHolder()

  Default constructor is required for deserialization purposes.

### TraditionalHttpSessionModel.OptimizedHolder

    public TraditionalHttpSessionModel.OptimizedHolder(java.lang.String sName,
                                                       java.lang.Object oValue)

  Construct an OptimizedHolder for a value.

  Parameters:
    `sName` - the attribute name
    `oValue` - the value of the attribute; not null

Method Detail

### getValue

    public java.lang.Object getValue()

  Obtain the object form of the value.

  Overrides:
    `getValue` in class `AbstractHttpSessionModel.AttributeHolder`
  Returns:
    the object form of the value

### getBinary

    public Binary getBinary()

  Obtain the binary form of the value. Failure to serialize the value, if serialization is necessary, will result in a runtime exception.

  Returns:
    the binary form of the value

### readExternal

    public void readExternal(java.io.DataInput in)
                      throws java.io.IOException

  Helper to read the object state from a stream.

  Specified by:
    `readExternal` in interface `ExternalizableLite`
  Overrides:
    `readExternal` in class `AbstractHttpSessionModel.AttributeHolder`
  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.

  Specified by:
    `writeExternal` in interface `ExternalizableLite`
  Overrides:
    `writeExternal` in class `AbstractHttpSessionModel.AttributeHolder`
  Parameters:
    `out` - the stream to write the object to
  Throws:
    `java.io.IOException` - if an I/O exception occurs

### getInternalBinary

    protected Binary getInternalBinary()

  Obtain the internally managed binary value.

  Returns:
    the cached binary form of the value, or null if it has not been lazily serialized

### 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.

  Returns:
    the binary form of the value, but never null

### setInternalBinary

    protected void setInternalBinary(Binary binValue)

  Store the internally managed binary value.

  Parameters:
    `binValue` - the binary form of the value

### serializeValue

    protected Binary serializeValue(java.lang.Object o)

  Take the passed object and turn it into a Binary value.

  Parameters:
    `o` - the object to serialize
  Returns:
    the binary value of the attribute

### deserializeValue

    protected java.lang.Object deserializeValue(Binary bin)

  Take the Binary form of the attribute value and turn it into the object value.

  Parameters:
    `bin` - the binary value to deserialize
  Returns:
    the object value of the attribute

### 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 `AbstractHttpSessionModel.AttributeHolder`
  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.

  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.

  Parameters:
    `out` - the DataOutput that this holder is being serialized to
  Throws:
    `java.io.IOException` - on I/O error

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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