Class GridCacheVersionConflictContext<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext<K,V>
-
public class GridCacheVersionConflictContext<K,V> extends Object
Conflict context implementation.
-
-
Constructor Summary
Constructors Constructor Description GridCacheVersionConflictContext(CacheObjectValueContext ctx, GridCacheVersionedEntry<K,V> oldEntry, GridCacheVersionedEntry<K,V> newEntry)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longexpireTime()booleanisManualResolve()booleanisMerge()booleanisUseNew()booleanisUseOld()voidmanualResolve()Set manual resolve class.voidmerge(V mergeVal, long ttl, long expireTime)Force cache to use neither old, nor new, but some other value passed as argument.VmergeValue()GridCacheVersionedEntry<K,V>newEntry()Gets new cache entry.GridCacheVersionedEntry<K,V>oldEntry()Gets old (existing) cache entry.StringtoString()longttl()voiduseNew()Force cache to apply new entry overwriting old (existing) entry.voiduseOld()Force cache to ignore new entry and leave old (existing) entry unchanged.CacheObjectValueContextvalueContext()Gets cache object context.
-
-
-
Constructor Detail
-
GridCacheVersionConflictContext
public GridCacheVersionConflictContext(CacheObjectValueContext ctx, GridCacheVersionedEntry<K,V> oldEntry, GridCacheVersionedEntry<K,V> newEntry)
Constructor.- Parameters:
oldEntry- Old entry.newEntry- New entry.
-
-
Method Detail
-
oldEntry
public GridCacheVersionedEntry<K,V> oldEntry()
Gets old (existing) cache entry.- Returns:
- Old (existing) cache entry.
-
newEntry
public GridCacheVersionedEntry<K,V> newEntry()
Gets new cache entry.- Returns:
- New cache entry.
-
valueContext
public CacheObjectValueContext valueContext()
Gets cache object context.- Returns:
- Cache object context.
-
useOld
public void useOld()
Force cache to ignore new entry and leave old (existing) entry unchanged.
-
useNew
public void useNew()
Force cache to apply new entry overwriting old (existing) entry.
-
merge
public void merge(@Nullable V mergeVal, long ttl, long expireTime)Force cache to use neither old, nor new, but some other value passed as argument. In this case old value will be replaced with merge value and update will be considered as local.Also in case of merge you have to specify new TTL and expire time explicitly. For unlimited TTL use
0.- Parameters:
mergeVal- Merge value ornullto force remove.ttl- Time to live in milliseconds (must be non-negative).expireTime- Expire time.
-
isUseOld
public boolean isUseOld()
- Returns:
Truein case old value should be used.
-
isUseNew
public boolean isUseNew()
- Returns:
Truein case new value should be used.
-
isMerge
public boolean isMerge()
- Returns:
Truein case merge is to be performed.
-
manualResolve
public void manualResolve()
Set manual resolve class.
-
isManualResolve
public boolean isManualResolve()
- Returns:
- Manual resolve flag.
-
mergeValue
@Nullable public V mergeValue()
- Returns:
- Value to merge (if any).
-
ttl
public long ttl()
- Returns:
- TTL.
-
expireTime
public long expireTime()
- Returns:
- Expire time.
-
-