public interface GridDrReceiverCacheConflictContext<K,V>
GridDrReceiverCacheConflictResolver to perform explicit conflict resolution.
Contains all data necessary for conflict resolution.
| Modifier and Type | Method and Description |
|---|---|
void |
merge(V mergeVal,
long ttl)
Force data center replication engine to use neither old, nor new, but some other value passed
as argument.
|
GridDrEntry<K,V> |
newEntry()
Gets new cache entry.
|
GridDrEntry<K,V> |
oldEntry()
Gets old (existing) cache entry.
|
void |
useNew()
Force data center replication receiver cache to apply new entry thus overwriting old (existing) entry.
|
void |
useOld()
Force data center replication receiver cache to ignore new entry and leave old (existing) entry unchanged.
|
GridDrEntry<K,V> oldEntry()
GridDrEntry<K,V> newEntry()
void useOld()
void useNew()
Note that updates from remote data centers always have explicit TTL , while local data center
updates will only have explicit TTL in case GridCacheEntry.timeToLive(long) was called
before update. In the latter case new entry will pick TTL of the old (existing) entry, even
if it was set through update from remote data center. it means that depending on concurrent
update timings new update might pick unexpected TTL. For example, consider that three updates
of the same key are performed: local update with explicit TTL (1) followed by another local
update without explicit TTL (2) and one remote update (3). In this case you might expect that
update (2) will pick TTL set during update (1). However, in case update (3) occurrs between (1)
and (2) and it overwrites (1) during conflict resolution, then update (2) will pick TTL of
update (3). To have predictable TTL in such cases you should either always set it explicitly
through GridCacheEntry.timeToLive(long) or use merge(Object, long).
void merge(@Nullable V mergeVal, long ttl)
GridConfiguration.getDataCenterId() will be used).
Also in case of merge you have to specify new TTL explicitly. For unlimited TTL use 0.
mergeVal - Merge value or null to force remove.ttl - Time to live in milliseconds.Copyright © 2014. All rights reserved.