Package com.tangosol.coherence.servlet
Class OptimizedHolder
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.servlet.AttributeHolder
com.tangosol.coherence.servlet.OptimizedHolder
- All Implemented Interfaces:
ExternalizableLite,Externalizable,Serializable
- Direct Known Subclasses:
SplittableHolder
An immutable object to hold attribute values and related information.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor is required for deserialization purposes.Default constructor is required for deserialization purposes.OptimizedHolder(String sName, Object oValue, TraditionalHttpSessionModel model) Construct an OptimizedHolder for a value. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectdeserializeValue(Binary bin) Take the Binary form of the attribute value and turn it into the object value.protected BinaryObtain the non-null internally managed binary value.Obtain the binary form of the value.protected BinaryObtain the internally managed binary value.getValue()Obtain the object form of the value.protected voidCalled to test serialization; if the holder cannot serialize its value, it should throw an IOException at this point.protected BinaryreadBinary(DataInput in) Read the binary value.voidHelper to read the object state from a stream.protected BinaryTake the passed object and turn it into a Binary value.protected voidsetInternalBinary(Binary binValue) Store the internally managed binary value.protected voidwriteBinary(DataOutput out) Write the binary value.voidwriteExternal(DataOutput out) Helper to write the object state to a stream.Methods inherited from class com.tangosol.coherence.servlet.AttributeHolder
flush, getInternalValue, getModel, getName, isActivationListener, isBindingListener, isEnableSuspectAttributes, isLocal, isSuspect, isSuspect, onBound, onUnbound, readExternal, setInternalValue, setLocal, setModel, setSuspect, writeExternalMethods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Constructor Details
-
OptimizedHolder
public OptimizedHolder()Default constructor is required for deserialization purposes. -
OptimizedHolder
Default constructor is required for deserialization purposes.- Parameters:
model- the traditional http session model
-
OptimizedHolder
Construct an OptimizedHolder for a value.- Parameters:
sName- the attribute nameoValue- the value of the attribute; not nullmodel- the traditional http session model
-
-
Method Details
-
getValue
Obtain the object form of the value.- Overrides:
getValuein classAttributeHolder- Returns:
- the object form of the value
-
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
Helper to read the object state from a stream.- Specified by:
readExternalin interfaceExternalizableLite- Overrides:
readExternalin classAttributeHolder- Parameters:
in- the stream to read data from in order to restore the object- Throws:
IOException- if an I/O exception occurs
-
writeExternal
Helper to write the object state to a stream.- Specified by:
writeExternalin interfaceExternalizableLite- Overrides:
writeExternalin classAttributeHolder- Parameters:
out- the stream to write the object to- Throws:
IOException- if an I/O exception occurs
-
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
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
Store the internally managed binary value.- Parameters:
binValue- the binary form of the value
-
serializeValue
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
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
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:
prepareWritein classAttributeHolder- Throws:
IOException- if the holder cannot serialize its value
-
readBinary
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:
IOException- on I/O error
-
writeBinary
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:
IOException- on I/O error
-