Package org.infinispan.conflict
Enum MergePolicy
- java.lang.Object
-
- java.lang.Enum<MergePolicy>
-
- org.infinispan.conflict.MergePolicy
-
- All Implemented Interfaces:
Serializable
,Comparable<MergePolicy>
,EntryMergePolicy
public enum MergePolicy extends Enum<MergePolicy> implements EntryMergePolicy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MergePolicy.UnsupportedMergePolicy
-
Enum Constant Summary
Enum Constants Enum Constant Description CUSTOM
NONE
PREFERRED_ALWAYS
PREFERRED_NON_NULL
REMOVE_ALL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MergePolicy
fromConfiguration(EntryMergePolicy policy)
static MergePolicy
fromString(String str)
org.infinispan.container.entries.CacheEntry
merge(org.infinispan.container.entries.CacheEntry preferredEntry, List otherEntries)
This method is called byConflictManager.resolveConflicts()
for each conflict discovered to determine whichCacheEntry
should be utilised.static MergePolicy
valueOf(String name)
Returns the enum constant of this type with the specified name.static MergePolicy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CUSTOM
public static final MergePolicy CUSTOM
-
NONE
public static final MergePolicy NONE
-
PREFERRED_ALWAYS
public static final MergePolicy PREFERRED_ALWAYS
-
PREFERRED_NON_NULL
public static final MergePolicy PREFERRED_NON_NULL
-
REMOVE_ALL
public static final MergePolicy REMOVE_ALL
-
-
Method Detail
-
values
public static MergePolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MergePolicy c : MergePolicy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MergePolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
merge
public org.infinispan.container.entries.CacheEntry merge(org.infinispan.container.entries.CacheEntry preferredEntry, List otherEntries)
Description copied from interface:EntryMergePolicy
This method is called byConflictManager.resolveConflicts()
for each conflict discovered to determine whichCacheEntry
should be utilised. This merge policy is used when a user explicitly callsConflictManager.resolveConflicts()
as well as when a partition merge occurs withPartitionHandling.ALLOW_READ_WRITES
set. In the event of a partition merge, we define the preferred partition as the partition whom's coordinator is coordinating the current merge.- Specified by:
merge
in interfaceEntryMergePolicy
- Parameters:
preferredEntry
- During a partition merge, the preferredEntry is the primary replica of a CacheEntry stored in the partition that contains the most nodes or if partitions are equal the one with the largest topologyId. In the event of overlapping partitions, i.e. a node A is present in the topology of both partitions {A}, {A,B,C}, we pick {A} as the preferred partition as it will have the higher topologId because the other partition's topology is behind. During a non-merge call toConflictManager.resolveConflicts()
, the preferredEntry is simply the primary owner of an entryotherEntries
- aList
of all otherCacheEntry
associated with a given Key.- Returns:
- the winning
CacheEntry
to be utilised across the cluster, or null if all entries for a key should be removed.
-
fromString
public static MergePolicy fromString(String str)
-
fromConfiguration
public static MergePolicy fromConfiguration(EntryMergePolicy policy)
-
-