public class GridCacheVersionConflictContext<K,V> extends Object
| Constructor and Description |
|---|
GridCacheVersionConflictContext(GridCacheVersionedEntry<K,V> oldEntry,
GridCacheVersionedEntry<K,V> newEntry)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
expireTime() |
boolean |
explicitTtl() |
boolean |
isManualResolve() |
boolean |
isMerge() |
boolean |
isUseNew() |
boolean |
isUseOld() |
void |
manualResolve()
Set manual resolve class.
|
void |
merge(V mergeVal,
long ttl)
Force cache to use neither old, nor new, but some other value passed as argument.
|
V |
mergeValue() |
GridCacheVersionedEntry<K,V> |
newEntry()
Gets new cache entry.
|
GridCacheVersionedEntry<K,V> |
oldEntry()
Gets old (existing) cache entry.
|
String |
toString() |
long |
ttl() |
void |
useNew()
Force cache to apply new entry overwriting old (existing) entry.
|
void |
useOld()
Force cache to ignore new entry and leave old (existing) entry unchanged.
|
public GridCacheVersionConflictContext(GridCacheVersionedEntry<K,V> oldEntry, GridCacheVersionedEntry<K,V> newEntry)
oldEntry - Old entry.newEntry - New entry.public GridCacheVersionedEntry<K,V> oldEntry()
public GridCacheVersionedEntry<K,V> newEntry()
public void useOld()
public 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 CacheEntry#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).
public void merge(@Nullable V mergeVal, long ttl)
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.public boolean isUseOld()
True in case old value should be used.public boolean isUseNew()
True in case new value should be used.public boolean isMerge()
True in case merge is to be performed.public void manualResolve()
public boolean isManualResolve()
public long ttl()
public long expireTime()
public boolean explicitTtl()
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015