public class BackingMapBinaryEntry extends Base implements BinaryEntry, MapTrigger.Entry
MapTrigger.Entry
, it represents a pending change to
an Entry that is about to committed to the underlying Map. For example,
the original binary value of null indicates pending insert (a non-existing
entry), while the binary value of null represents a pending remove operation.
It is currently only used by the ReadWriteBackingMap to communicate with the BinaryEntryStore.
This implementation is not thread safe.
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected Binary |
m_binKey
The Binary key.
|
protected Binary |
m_binValue
The Binary value.
|
protected Binary |
m_binValueOrig
The original Binary value.
|
protected BackingMapManagerContext |
m_ctx
The backing map context.
|
protected boolean |
m_fSynthetic
Whether this update is synthetic.
|
protected long |
m_ldtExpiry
The expiry timestamp for this entry; or
CacheMap.EXPIRY_DEFAULT if the
entry uses the default expiry setting; or
CacheMap.EXPIRY_NEVER if the
entry never expires |
protected Object |
m_oKey
Lazily converted key in Object format.
|
protected Object |
m_oValue
Lazily converted value in Object format.
|
protected Object |
m_oValueOrig
Lazily converted original value in Object format.
|
Constructor and Description |
---|
BackingMapBinaryEntry(Binary binKey,
Binary binValue,
Binary binValueOrig,
BackingMapManagerContext ctx)
Construct a BackingMapBinaryEntry with the specified binary key, values
and BackingMapManagerContext.
|
BackingMapBinaryEntry(Binary binKey,
Binary binValue,
Binary binValueOrig,
long cDelay,
BackingMapManagerContext ctx)
Construct a BackingMapBinaryEntry with the specified binary key, values
and BackingMapManagerContext.
|
Modifier and Type | Method and Description |
---|---|
protected static long |
calculateExpiry(long cDelay)
Calculate the expiry timestamp based on the expiry delay value.
|
boolean |
equals(Object o)
Compares the specified object with this entry for equality.
|
void |
expire(long cMillis)
Update the entry with the specified expiry delay.
|
Object |
extract(ValueExtractor extractor)
Extract a value out of the Entry's key or value.
|
ObservableMap |
getBackingMap()
Obtain a reference to the backing map that this Entry corresponds to.
|
BackingMapContext |
getBackingMapContext()
Obtain a reference to the
backing map context
for the cache that this Entry corresponds to. |
Binary |
getBinaryKey()
Return a raw binary key for this entry.
|
Binary |
getBinaryValue()
Return a raw binary value for this entry.
|
BackingMapManagerContext |
getContext()
Return the context this entry operates within.
|
long |
getExpiry()
Return the number of milliseconds remaining before the specified entry
is scheduled to expire.
|
Object |
getKey()
Return the key corresponding to this entry.
|
Binary |
getOriginalBinaryValue()
Return a raw original binary value for this entry.
|
Object |
getOriginalValue()
Return an original value for this entry.
|
Serializer |
getSerializer()
Return a
Serializer that is used to serialize/deserialize this
entry. |
Object |
getValue()
Return the value corresponding to this entry.
|
int |
hashCode()
Returns the hash code value for this entry.
|
boolean |
isOriginalPresent()
Determine whether or not the Entry existed before the start of the
mutating operation that is being evaluated by the trigger.
|
boolean |
isPresent()
Determine if this Entry exists in the Map.
|
boolean |
isReadOnly()
Check whether this BinaryEntry allows data modification operations.
|
boolean |
isSynthetic()
Determine if this Entry has been synthetically mutated.
|
void |
remove(boolean fSynthetic)
Remove this Entry from the Map if it is present in the Map.
|
Object |
setValue(Object oValue)
Store the value corresponding to this entry.
|
void |
setValue(Object oValue,
boolean fSynthetic)
Store the value corresponding to this entry.
|
String |
toString()
Render the entry as a String.
|
void |
update(ValueUpdater updater,
Object oValue)
Update the Entry's value.
|
void |
updateBinaryValue(Binary binValue)
Update the binary value for this entry.
|
void |
updateBinaryValue(Binary binValue,
boolean fSynthetic)
Update the binary value for this entry.
|
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, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isValueChanged, isValueLoaded, isValueRemoved, isValueUpdated
getValue
extractFromKey, extractFromValue
comparingByKey, comparingByKey, comparingByValue, comparingByValue
protected BackingMapManagerContext m_ctx
protected Binary m_binKey
protected Binary m_binValue
protected Binary m_binValueOrig
protected long m_ldtExpiry
CacheMap.EXPIRY_DEFAULT
if the
entry uses the default expiry setting; or
CacheMap.EXPIRY_NEVER
if the
entry never expiresprotected Object m_oKey
protected Object m_oValue
protected Object m_oValueOrig
protected boolean m_fSynthetic
public BackingMapBinaryEntry(Binary binKey, Binary binValue, Binary binValueOrig, BackingMapManagerContext ctx)
binKey
- the Binary keybinValue
- the Binary value; could be null representing a
non-existing entrybinValueOrig
- an original Binary value; could be null representing
an insert operationctx
- a BackingMapManagerContextpublic BackingMapBinaryEntry(Binary binKey, Binary binValue, Binary binValueOrig, long cDelay, BackingMapManagerContext ctx)
binKey
- the Binary keybinValue
- the Binary value; could be null representing a
non-existing entrybinValueOrig
- an original Binary value; could be null representing
an insert operationcDelay
- the expiry delayctx
- a BackingMapManagerContextpublic Binary getBinaryKey()
getBinaryKey
in interface BinaryEntry
public Binary getBinaryValue()
getBinaryValue
in interface BinaryEntry
public Binary getOriginalBinaryValue()
getOriginalBinaryValue
in interface BinaryEntry
public Object getKey()
InvocableMap.Entry.isPresent()
, and to create the entry for the key, use InvocableMap.Entry.setValue(V)
.getKey
in interface InvocableMap.Entry
getKey
in interface Map.Entry
public Object getValue()
InvocableMap.Entry.isPresent()
.
Note: any modifications to the value retrieved using this
method are not guaranteed to persist unless followed by a InvocableMap.Entry.setValue(V)
or InvocableMap.Entry.update(com.tangosol.util.ValueUpdater<V, T>, T)
call.
getValue
in interface InvocableMap.Entry
getValue
in interface Map.Entry
public Object getOriginalValue()
getOriginalValue
in interface BinaryEntry
getOriginalValue
in interface MapTrigger.Entry
public boolean isOriginalPresent()
isOriginalPresent
in interface MapTrigger.Entry
public Object setValue(Object oValue)
setValue
in interface InvocableMap.Entry
setValue
in interface Map.Entry
oValue
- the new value for this Entrypublic void setValue(Object oValue, boolean fSynthetic)
Unlike the other form of setValue
, this
form does not return the previous value, and as a result may be
significantly less expensive (in terms of cost of execution) for
certain Map implementations.
As of Coherence 12.1.2, if fSynthetic is true and the
BackingMap
associated with this entry is a
ReadWriteBackingMap, this method will bypass the
CacheStore
or
BinaryEntryStore
.
setValue
in interface BinaryEntry
setValue
in interface InvocableMap.Entry
oValue
- the new value for this EntryfSynthetic
- pass true only if the insertion into or
modification of the Map should be treated as a
synthetic eventpublic void updateBinaryValue(Binary binValue)
Passing a non-null binary is functionally equivalent to:
setValue(getContext().getValueFromInternalConverter().convert(binValue));Passing null value is functionally equivalent to removing the entry.
remove(false);
updateBinaryValue
in interface BinaryEntry
binValue
- new binary value to be stored in this entry or nullpublic void updateBinaryValue(Binary binValue, boolean fSynthetic)
Passing a non-null binary is functionally equivalent to:
setValue(getContext().getValueFromInternalConverter().convert(binValue));Passing null value is functionally equivalent to removing the entry.
remove(false);This method will bypass any
CacheStore
or
BinaryEntryStore
implementations, iff fSynthetic is true and the
backing map associated with this entry is a ReadWriteBackingMap.updateBinaryValue
in interface BinaryEntry
binValue
- new binary value to be stored in this entry or nullfSynthetic
- pass true only if the insertion into or
modification of the Map should be treated as a
synthetic eventpublic Serializer getSerializer()
Serializer
that is used to serialize/deserialize this
entry.getSerializer
in interface BinaryEntry
Serializer
that is used to serialize/deserialize this
entrypublic BackingMapManagerContext getContext()
Note: This method is a shortcut for the getBackingMapContext.getManagerContext()
call.
getContext
in interface BinaryEntry
public ObservableMap getBackingMap()
Note: This method is a shortcut for the getBackingMapContext().getBackingMap()
call. As of Coherence 3.7, the returned type has been narrowed to
ObservableMap.
getBackingMap
in interface BinaryEntry
public BackingMapContext getBackingMapContext()
backing map context
for the cache that this Entry corresponds to.getBackingMapContext
in interface BinaryEntry
public void expire(long cMillis)
Note: this method only has an effect only if the associated backing map
implements the CacheMap
interface
expire
in interface BinaryEntry
cMillis
- the number of milliseconds until the entry will expire;
pass CacheMap.EXPIRY_DEFAULT
to use the default expiry setting;
pass CacheMap.EXPIRY_NEVER
to indicate that the entry should
never expirepublic long getExpiry()
BinaryEntry.expire(long)
method has been called,
the returned value will reflect the requested expiry delay. Otherwise if
the entry exists
, the returned value will represent
the time remaining until the entry expires (or CacheMap.EXPIRY_NEVER
if the
entry will never expire). If the entry does not exist, CacheMap.EXPIRY_DEFAULT
will be returned.
This method will make a "best effort" attempt to determine the
expiry time remaining. In some cases, it may not be possible to determine
the expiry (e.g. the backing-map does not implement the CacheMap
interface), in which case
CacheMap.EXPIRY_DEFAULT
will be returned.
getExpiry
in interface BinaryEntry
public boolean isReadOnly()
isReadOnly
in interface BinaryEntry
public void update(ValueUpdater updater, Object oValue)
V target = entry.getValue(); updater.update(target, value); entry.setValue(target, false);The benefit of using this method is that it may allow the Entry implementation to significantly optimize the operation, such as for purposes of delta updates and backup maintenance.
update
in interface InvocableMap.Entry
updater
- a ValueUpdater used to modify the Entry's valueoValue
- the new value for this Entrypublic boolean isPresent()
InvocableMap.Entry.setValue(Object)
or
InvocableMap.Entry.setValue(Object, boolean)
. If the Entry is present, it can
be destroyed by calling InvocableMap.Entry.remove(boolean)
.isPresent
in interface InvocableMap.Entry
public boolean isSynthetic()
false
if either a non-synthetic update was made or
the entry has not been modified.isSynthetic
in interface InvocableMap.Entry
public void remove(boolean fSynthetic)
This method supports both the operation corresponding to Map.remove(java.lang.Object)
as well as synthetic operations such as eviction. If the
containing Map does not differentiate between the two, then this
method will always be identical to InvocableMap.this.remove(getKey()).
As of Coherence 12.1.2, if fSynthetic is true and the
BackingMap
associated with this entry is a
ReadWriteBackingMap, this method will bypass the
CacheStore
or
BinaryEntryStore
.
remove
in interface BinaryEntry
remove
in interface InvocableMap.Entry
fSynthetic
- pass true only if the removal from the Map should
be treated as a synthetic eventpublic Object extract(ValueExtractor extractor)
extract
in interface QueryMap.Entry
extractor
- a ValueExtractor to apply to the Entry's key or valuepublic boolean equals(Object o)
public int hashCode()
public String toString()
protected static long calculateExpiry(long cDelay)
cDelay
- the expiry delay