Package com.tangosol.coherence.servlet
Class SplittableHolder
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.coherence.servlet.AttributeHolder
-
- com.tangosol.coherence.servlet.OptimizedHolder
-
- com.tangosol.coherence.servlet.SplittableHolder
-
- All Implemented Interfaces:
ExternalizableLite
,Externalizable
,Serializable
public class SplittableHolder extends 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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description SplittableHolder()
Default constructor for ExternalizableLite.SplittableHolder(SplitHttpSessionModel model)
Construct an AttributeHolder for a value.SplittableHolder(String sName, Object oValue, SplitHttpSessionModel model)
Construct an AttributeHolder for a value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
assignExternalKey(String sId)
Generate and set the key that will be used to access the binary value for this attribute holder that is in the external cache.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 Object
getExternalKey()
Build a key that will be used to access the binary value for this attribute holder that in the external cache.protected Object
getExternalValue()
Obtain the value from the external cache.Object
getValue()
Obtain the object form of the value.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.protected static boolean
isInstanceOfElasticKeys(Object object)
Determine if a given object is an ElasticKey or a collection of ElasticKeys.void
onBound(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.protected Binary
readBinary(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(DataOutput out)
Write the binary value.void
writeExternal(DataOutput out)
Helper to write the object state to a stream.-
Methods inherited from class com.tangosol.coherence.servlet.OptimizedHolder
deserializeValue, getBinary, getInternalBinary, readExternal, serializeValue, setInternalBinary
-
Methods inherited from class com.tangosol.coherence.servlet.AttributeHolder
getInternalValue, getModel, getName, isActivationListener, isBindingListener, isEnableSuspectAttributes, isLocal, isSuspect, isSuspect, readExternal, setInternalValue, setLocal, setModel, setSuspect, writeExternal
-
Methods 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, 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 Detail
-
SplittableHolder
public SplittableHolder()
Default constructor for ExternalizableLite.
-
SplittableHolder
public SplittableHolder(SplitHttpSessionModel model)
Construct an AttributeHolder for a value.- Parameters:
model
- the split http session model
-
SplittableHolder
public SplittableHolder(String sName, Object oValue, SplitHttpSessionModel model)
Construct an AttributeHolder for a value.- Parameters:
sName
- the attribute nameoValue
- the value of the attribute; not nullmodel
- the split http session model
-
-
Method Detail
-
getValue
public Object getValue()
Obtain the object form of the value.- Overrides:
getValue
in classOptimizedHolder
- Returns:
- the object form of the value
-
onBound
public void onBound(AttributeHolder holderOrig)
Called when the attribute is bound.- Overrides:
onBound
in classAttributeHolder
- 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 classAttributeHolder
- 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 anAbstractHttpSessionModel.unbind()
call
-
flush
protected void flush() throws IOException
Called to flush the value to its data storage.- Overrides:
flush
in classAttributeHolder
- Throws:
IOException
- on I/O error
-
writeExternal
public void writeExternal(DataOutput out) throws IOException
Helper to write the object state to a stream.- Specified by:
writeExternal
in interfaceExternalizableLite
- Overrides:
writeExternal
in classOptimizedHolder
- Parameters:
out
- the stream to write the object to- Throws:
IOException
- if an I/O exception occurs
-
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 classOptimizedHolder
- 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
-
getExternalKey
protected 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
-
assignExternalKey
protected Object assignExternalKey(String sId)
Generate and set the key that will be used to access the binary value for this attribute holder that is in the external cache.- Parameters:
sId
- the session ID associated with this key- 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
-
getExternalValue
protected Object getExternalValue()
Obtain the value from the external cache. For a session with a large Binary value that is split into multiple segments, its value is the key set of the split segments. Otherwise, the value is Binary and this method returns null.- Returns:
- the value of the session if the value of the session is split into multiple segments, or null if the value is in binary form.
- Since:
- 12.2.1.4.16
-
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 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 classOptimizedHolder
- Throws:
IOException
- if the holder cannot serialize its value
-
readBinary
protected Binary readBinary(DataInput in) throws IOException
Read the binary value. This is part of deserialization processing, and is separated out to enable subclassing.- Overrides:
readBinary
in classOptimizedHolder
- Parameters:
in
- the DataInput that this holder is being deserialized from- Returns:
- the binary value
- Throws:
IOException
- on I/O error
-
writeBinary
protected void writeBinary(DataOutput out) throws IOException
Write the binary value. This is part of serialization processing, and is separated out to enable subclassing.- Overrides:
writeBinary
in classOptimizedHolder
- Parameters:
out
- the DataOutput that this holder is being serialized to- Throws:
IOException
- on I/O error
-
isInstanceOfElasticKeys
protected static boolean isInstanceOfElasticKeys(Object object)
Determine if a given object is an ElasticKey or a collection of ElasticKeys.- Parameters:
object
- the object- Returns:
- true if the given object is of the ElasticKey type or its collection; false otherwise
- Since:
- 12.2.1.4.16
-
-