Package com.tangosol.coherence.servlet
Class AttributeHolder
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.servlet.AttributeHolder
- All Implemented Interfaces:
Externalizable
,Serializable
- Direct Known Subclasses:
OptimizedHolder
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.AttributeHolder
(String sName, Object oValue, AbstractHttpSessionModel model) Construct an AttributeHolder for a value. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
flush()
Called to flush the value to its data storage.protected Object
Obtain the internally managed object value.getModel()
Return the AbstractHttpSessionModel to which this AttributeHolder belongs.getName()
Determine the name of the attribute.getValue()
Obtain the object form of the value.boolean
Determine if the value is an object that implements the HttpSessionActivationListener interface.boolean
Determine if the value is an object that implements the HttpSessionBindingListener interface.protected boolean
Determine if suspect attributes need special treatment.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
Determine if the value needs to be serialized because it was never serialized or because it could have changed.protected boolean
Determine if the value needs to be marked as suspect because suspect attribute handling is enabled and it is not known to be immutablevoid
onBound
(AttributeHolder holderOrig) Called when the attribute is bound.void
onUnbound
(boolean fReplaced, boolean fAll) Called when the attribute is unbound.protected void
Called to test serialization; if the holder cannot serialize its value, it should throw an IOException at this point.void
Helper to read the object state from a stream.void
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
(Object oValue) Store the internally managed object value.protected void
setLocal
(boolean fLocal) Specify whether or not this attribute is managed locally.protected void
setModel
(AbstractHttpSessionModel model) protected void
setSuspect
(boolean fSuspect) Toggle the suspect flag for the value.void
writeExternal
(DataOutput out) Helper to write the object state to a stream.void
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.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, 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
-
AttributeHolder
public AttributeHolder()Default constructor is required for deserialization purposes. -
AttributeHolder
-
AttributeHolder
Construct an AttributeHolder for a value.- Parameters:
sName
- the attribute nameoValue
- the value of the attribute; not nullmodel
- the http session model
-
-
Method Details
-
getModel
Return the AbstractHttpSessionModel to which this AttributeHolder belongs.- Returns:
- the parent AbstractHttpSessionModel
-
setModel
-
getName
Determine the name of the attribute.- Returns:
- the attribute name managed by this holder
-
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
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 anAbstractHttpSessionModel.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
Called to flush the value to its data storage.- Throws:
IOException
- on I/O error
-
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
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
-
isSuspect
Determine if the value needs to be marked as suspect because suspect attribute handling is enabled and it is not known to be immutable- Parameters:
oValue
- the object which may be suspect- Returns:
- true if the object is deemed suspect
-
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
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:
IOException
- if the holder cannot serialize its value
-
isEnableSuspectAttributes
protected boolean isEnableSuspectAttributes()Determine if suspect attributes need special treatment.- Returns:
- true iff suspect attributes need special treatment
- See Also:
-
readExternal
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 interfaceExternalizable
- Parameters:
in
- the stream to read data from in order to restore the object- Throws:
IOException
- if an I/O exception occurs
-
writeExternal
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 interfaceExternalizable
- Parameters:
out
- the stream to write the object to- Throws:
IOException
- if an I/O exception occurs
-
readExternal
Helper to read the object state from a stream.- 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.- Parameters:
out
- the stream to write the object to- Throws:
IOException
- if an I/O exception occurs
-