Interface BinaryEntry<K,V>
- All Superinterfaces:
InvocableMap.Entry<K,
,V> Map.Entry<K,
,V> QueryMap.Entry<K,
V>
- All Known Implementing Classes:
BackingMapBinaryEntry
,ConverterCollections.ConverterMapEvent.ConverterMapEventBinaryEntry
,InvocableMapHelper.RoutingBinaryEntry
,ReadWriteBackingMap.Entry
- Since:
- Coherence 3.5
- Author:
- as 2009.01.05
-
Method Summary
Modifier and TypeMethodDescriptionvoid
expire
(long cMillis) Update the entry with the specified expiry delay.default <K1,
V1> BinaryEntry <K1, V1> getAssociatedEntry
(String sMapName, K1 key) Return an associated entry from the specified map, obtaining exclusive access to that map entry.default <K1,
V1> BinaryEntry <K1, V1> getAssociatedEntry
(String sMapName, K1 key, boolean fReadOnly) Return an associated entry from the specified map, obtaining either an exclusive or shared (read-only) access to that map entry.Deprecated.Obtain a reference to thebacking map context
for the cache that this Entry corresponds to.Return a raw binary key for this entry.Return a raw binary value for this entry.Return the context this entry operates within.long
Return the number of milliseconds remaining before the specified entry is scheduled to expire.default Map
<ValueExtractor, MapIndex> Return a map of indexes defined for the partition of thecache
that this BinaryEntry belongs to.default int
Return the key partition for this BinaryEntry.Return a raw original binary value for this entry.Return an original value for this entry.Return aSerializer
that is used to serialize/deserialize this entry.boolean
Check whether this BinaryEntry allows data modification operations.default boolean
Check whether the value of this BinaryEntry is changed.default boolean
Check whether this BinaryEntry is loaded by a "read-through" operation.default boolean
Check whether the value of this BinaryEntry is removed.default boolean
Check whether the value of this BinaryEntry is updated.void
remove
(boolean fSynthetic) Remove this Entry from the Map if it is present in the Map.void
Store the value corresponding to this entry.void
updateBinaryValue
(Binary binValue) Update the binary value for this entry.void
updateBinaryValue
(Binary binValue, boolean fSynthetic) Update the binary value for this entry.Methods inherited from interface com.tangosol.util.InvocableMap.Entry
asBinaryEntry, getKey, getValue, getValue, getValue, isPresent, isSynthetic, setValue, update
Methods inherited from interface com.tangosol.util.QueryMap.Entry
extract, extractFromKey, extractFromValue
-
Method Details
-
getBinaryKey
Binary getBinaryKey()Return a raw binary key for this entry.- Returns:
- a raw binary key for this entry
-
getBinaryValue
Binary getBinaryValue()Return a raw binary value for this entry.- Returns:
- a raw binary value for this entry; null if the value does not exist
-
getSerializer
Serializer getSerializer()Return aSerializer
that is used to serialize/deserialize this entry.- Returns:
- a
Serializer
that is used to serialize/deserialize this entry
-
getContext
BackingMapManagerContext getContext()Return the context this entry operates within.Note: This method is a shortcut for the
getBackingMapContext.getManagerContext()
call.- Returns:
- the BackingMapManagerContext for this entry
-
updateBinaryValue
Update the binary value for this entry.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);
- Parameters:
binValue
- new binary value to be stored in this entry or null
-
updateBinaryValue
Update the binary value for this entry.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 anyCacheStore
orBinaryEntryStore
implementations, iff fSynthetic is true and the backing map associated with this entry is a ReadWriteBackingMap.- Parameters:
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 event- Since:
- Coherence 12.1.2
-
getOriginalValue
V getOriginalValue()Return an original value for this entry.- Returns:
- an original value for this entry
- Since:
- Coherence 3.6
-
getOriginalBinaryValue
Binary getOriginalBinaryValue()Return a raw original binary value for this entry.- Returns:
- a raw original binary value for this entry; null if the original value did not exist
- Since:
- Coherence 3.6
-
getBackingMap
ObservableMap<K,V> getBackingMap()Deprecated.As of Coherence 12.1.3, replaced withBackingMapContext.getBackingMapEntry(java.lang.Object)
BackingMapContext.getBackingMapEntry(java.lang.Object)
Obtain a reference to the backing map that this Entry corresponds to. The returned Map should be used in a read-only manner.Note: This method is a shortcut for the
getBackingMapContext().getBackingMap()
call. As of Coherence 3.7, the returned type has been narrowed to ObservableMap.- Returns:
- the backing map reference; null if the entry does not have any backing map association
- Since:
- Coherence 3.6
-
getBackingMapContext
BackingMapContext getBackingMapContext()Obtain a reference to thebacking map context
for the cache that this Entry corresponds to.- Returns:
- the corresponding BackingMapContext; null if the entry does not have any backing map association
- Since:
- Coherence 3.7
-
expire
void expire(long cMillis) Update the entry with the specified expiry delay.Note: this method only has an effect only if the associated backing map implements the
CacheMap
interface- Parameters:
cMillis
- the number of milliseconds until the entry will expire; passCacheMap.EXPIRY_DEFAULT
to use the default expiry setting; passCacheMap.EXPIRY_NEVER
to indicate that the entry should never expire- Since:
- Coherence 3.7
-
getExpiry
long getExpiry()Return the number of milliseconds remaining before the specified entry is scheduled to expire. If theexpire(long)
method has been called, the returned value will reflect the requested expiry delay. Otherwise if the entryexists
, the returned value will represent the time remaining until the entry expires (orCacheMap.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 caseCacheMap.EXPIRY_DEFAULT
will be returned.- Returns:
- the number of milliseconds remaining before the specified entry expires
- Since:
- Coherence 12.1.3
-
isReadOnly
boolean isReadOnly()Check whether this BinaryEntry allows data modification operations.- Returns:
- true iff the entry is "read-only"
- Since:
- Coherence 3.7
-
isValueLoaded
default boolean isValueLoaded()Check whether this BinaryEntry is loaded by a "read-through" operation.- Returns:
- true iff the entry is loaded by a "read-through" operation
- Since:
- Coherence 12.2.1
-
isValueChanged
default boolean isValueChanged()Check whether the value of this BinaryEntry is changed.- Returns:
- true iff the entry is changed
- Since:
- Coherence 12.2.1.1
-
isValueUpdated
default boolean isValueUpdated()Check whether the value of this BinaryEntry is updated.- Returns:
- true iff the entry is updated
- Since:
- Coherence 12.2.1.1
-
isValueRemoved
default boolean isValueRemoved()Check whether the value of this BinaryEntry is removed.- Returns:
- true iff the entry is removed
- Since:
- Coherence 12.2.1.1
-
getAssociatedEntry
Return an associated entry from the specified map, obtaining exclusive access to that map entry.This method may only be called within the context of an entry processor invocation. Any changes made to the entry will be persisted with the same lifecycle as those made by the enclosing invocation. The returned entry is only valid for the duration of the enclosing invocation and multiple calls to this method within the same invocation context will return the same entry object.
Because this method implicitly locks the specified map entry, callers may use it to access, insert, update, modify, or remove map entries from within the context of an entry processor invocation. Operating on the entries returned by this method differs from operating directly against the backing map, as the returned entries provide an isolated, read-consistent view. The implicit lock acquisition attempted by this method could create a deadlock if entries are locked in conflicting orders on different threads. It is the caller's responsibility to ensure that cache entries are accessed (locked) in a deadlock-free manner.
- Type Parameters:
K1
- the key type of the specified associated mapV1
- the value type of the specified associated map- Parameters:
sMapName
- the name of the associated map to return the entry fromkey
- the key of the associated entry to return, in deserialized form- Returns:
- an
InvocableMap.Entry
for the specified key, or null if the specified key is not owned by this service member - Since:
- 20.12
-
getAssociatedEntry
Return an associated entry from the specified map, obtaining either an exclusive or shared (read-only) access to that map entry.This method may only be called within the context of an entry processor invocation. Any changes made to the entry obtained for exclusive access (non read-only) will be persisted with the same lifecycle as those made by the enclosing invocation. The returned entry is only valid for the duration of the enclosing invocation and multiple calls to this method within the same invocation context will return the same entry object.
When this method locks the specified map entry for exclusive, not read-only, callers may use it to access, insert, update, modify, or remove map entries from within the context of an entry processor invocation. Operating on the entries returned by this method differs from operating directly against the backing map, as the returned entries provide an isolated, read-consistent view. The implicit lock acquisition attempted by this method could create a deadlock if entries are locked in conflicting orders on different threads. It is the caller's responsibility to ensure that cache entries are accessed (locked) in a deadlock-free manner.
- Type Parameters:
K1
- the key type of the specified associated mapV1
- the value type of the specified associated map- Parameters:
sMapName
- the name of the associated map to return the entry fromkey
- the key of the associated entry to return, in deserialized formfReadOnly
-true
to obtain non-exclusive, read-only access to associated entry, orfalse
to lock associated entry for exclusive access- Returns:
- an
InvocableMap.Entry
for the specified key, or null if the specified key is not owned by this service member - Since:
- 20.12
-
getKeyPartition
default int getKeyPartition()Return the key partition for this BinaryEntry.- Returns:
- the key partition for this BinaryEntry
-
getIndexMap
Return a map of indexes defined for the partition of thecache
that this BinaryEntry belongs to. The returned map must be treated in the read-only manner.- Returns:
- the map of indexes defined for the cache partition that this BinaryEntry belongs to
- Since:
- 23.03
-
setValue
Store the value corresponding to this entry. If the entry does not exist, then the entry will be created by invoking this method, even with a null value (assuming the Map supports null values).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 theCacheStore
orBinaryEntryStore
.- Specified by:
setValue
in interfaceInvocableMap.Entry<K,
V> - Parameters:
value
- the new value for this EntryfSynthetic
- pass true only if the insertion into or modification of the Map should be treated as a synthetic event
-
remove
void remove(boolean fSynthetic) Remove this Entry from the Map if it is present in the Map.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 theCacheStore
orBinaryEntryStore
.- Specified by:
remove
in interfaceInvocableMap.Entry<K,
V> - Parameters:
fSynthetic
- pass true only if the removal from the Map should be treated as a synthetic event
-
BackingMapContext.getBackingMapEntry(java.lang.Object)
BackingMapContext.getBackingMapEntry(java.lang.Object)