Interface XSiteEntryMergePolicy<K,V>
- All Known Implementing Classes:
AlwaysRemoveXSiteEntryMergePolicy,DefaultXSiteEntryMergePolicy,PreferNonNullXSiteEntryMergePolicy,PreferNullXSiteEntryMergePolicy,XSiteMergePolicy
- Since:
- 12.0
- Author:
- Pedro Ruivo
-
Method Summary
-
Method Details
-
merge
Resolves conflicts for asynchronous cross-site replication.When a conflict is detected (concurrent updates on the same key in different sites), this method is invoked with the local data and the remote site's data (
SiteEntry). It includes the value and theMetadataassociated.The value and the
Metadatamay benull. If that is the case, it means thekeydoesn't exist (forlocalEntry) or it is a remove operation (forremoteEntry).The returned
SiteEntrymust be equal independent of the order of the arguments (i.e.resolve(k, s1, s2).equals(resolve(k, s2, s1))) otherwise your date may be corrupted. It is allowed to return one of the arguments (localEntryorremoteEntry) and to create a newSiteEntrywith a new value.Note: if the return
SiteEntry.getValue()isnull, Infinispan will interpret it to remove thekey.Note2: This method shouldn't block (I/O or locks). If it needs to block, use a different thread and complete the
CompletionStagewith the result. We recommend usingBlockingManager.supplyBlocking(Supplier, Object).- Parameters:
key- The key that was updated concurrently.localEntry- The local value andMetadatastored.remoteEntry- The remote value andMetadatareceived.- Returns:
- A
CompletionStagewith theSiteEntry.
-