Package org.infinispan.conflict.impl
Class DefaultConflictManager<K,V>
java.lang.Object
org.infinispan.conflict.impl.DefaultConflictManager<K,V>
- All Implemented Interfaces:
ConflictManager<K,
,V> InternalConflictManager<K,
V>
- Author:
- Ryan Emerson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
getAllVersions
(K key) Get all CacheEntry's that exists for a given key.Returns a stream of conflicts detected in the cluster.boolean
boolean
void
UtilisesConflictManager.getConflicts()
to discover conflicts between Key replicas and utilises the configuredEntryMergePolicy
to determine which entry should take precedence.void
resolveConflicts
(EntryMergePolicy<K, V> mergePolicy) UtilisesConflictManager.getConflicts()
to discover conflicts between Key replicas and utilises the providedEntryMergePolicy
to determine which entry should take precedence.resolveConflicts
(CacheTopology topology, Set<Address> preferredNodes) void
void
start()
void
stop()
-
Constructor Details
-
DefaultConflictManager
public DefaultConflictManager()
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
getStateReceiver
- Specified by:
getStateReceiver
in interfaceInternalConflictManager<K,
V>
-
cancelVersionRequests
public void cancelVersionRequests()- Specified by:
cancelVersionRequests
in interfaceInternalConflictManager<K,
V>
-
restartVersionRequests
public void restartVersionRequests()- Specified by:
restartVersionRequests
in interfaceInternalConflictManager<K,
V>
-
getAllVersions
Description copied from interface:ConflictManager
Get all CacheEntry's that exists for a given key. Note, concurrent calls to this method for the same key will utilise the same CompletableFuture inside this method and consequently return the same results as all other invocations. If this method is invoked during state transfer it will block until rehashing has completed. Similarly, if state transfer is initiated during an invocation of this method and rehashing affects the segments of the provided key, the initial requests for the entries versions are cancelled and re-attempted once state transfer has completed. This method utilises the addresses of the localDistributionInfo.writeOwners()
to request values for a given key. If a value does not exist for a key at one of the addresses, then a null valued is mapped to said address.- Specified by:
getAllVersions
in interfaceConflictManager<K,
V> - Parameters:
key
- the key for which associated entries are to be returned- Returns:
- a map of an address and it's associated CacheEntry
-
getConflicts
Description copied from interface:ConflictManager
Returns a stream of conflicts detected in the cluster. This is a lazily-loaded stream which searches for conflicts by sequentially fetching cache segments from their respective owner nodes. If a rebalance is initiated whilst the stream is fetching a cache segment, then a CacheException is thrown when executing the stream.- Specified by:
getConflicts
in interfaceConflictManager<K,
V> - Returns:
- a stream of Map<Address, CacheEntry> for all conflicts detected throughout this cache.
-
isConflictResolutionInProgress
public boolean isConflictResolutionInProgress()- Specified by:
isConflictResolutionInProgress
in interfaceConflictManager<K,
V> - Returns:
- true if conflict resolution is in progress. This can happen if the user has multiple threads interacting with the ConflictManager or if a Split-brain merge is in progress.
-
resolveConflicts
public void resolveConflicts()Description copied from interface:ConflictManager
UtilisesConflictManager.getConflicts()
to discover conflicts between Key replicas and utilises the configuredEntryMergePolicy
to determine which entry should take precedence. The resultingCacheEntry
is then applied on all replicas in the cluster.- Specified by:
resolveConflicts
in interfaceConflictManager<K,
V>
-
resolveConflicts
Description copied from interface:ConflictManager
UtilisesConflictManager.getConflicts()
to discover conflicts between Key replicas and utilises the providedEntryMergePolicy
to determine which entry should take precedence. The resultingCacheEntry
is then applied on all replicas in the cluster.- Specified by:
resolveConflicts
in interfaceConflictManager<K,
V> - Parameters:
mergePolicy
- the policy to be applied to all detected conflicts
-
resolveConflicts
- Specified by:
resolveConflicts
in interfaceInternalConflictManager<K,
V>
-
cancelConflictResolution
public void cancelConflictResolution()- Specified by:
cancelConflictResolution
in interfaceInternalConflictManager<K,
V>
-
isStateTransferInProgress
public boolean isStateTransferInProgress()- Specified by:
isStateTransferInProgress
in interfaceConflictManager<K,
V> - Returns:
- true if a state transfer is currently in progress.
-