com.hazelcast.replicatedmap.merge

## Class PutIfAbsentMapMergePolicy

- java.lang.Object
- - com.hazelcast.replicatedmap.merge.PutIfAbsentMapMergePolicy

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable, ReplicatedMapMergePolicy, Serializable

      public final class PutIfAbsentMapMergePolicy
      extends Object
      implements ReplicatedMapMergePolicy, IdentifiedDataSerializable

  Merges replicated map entries from source to destination if they don't exist in the destination map.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PutIfAbsentMapMergePolicy` | `INSTANCE` Single instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `Object` | `merge(String mapName, com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView mergingEntry, com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView existingEntry)` Selects one of the merging and existing map entries to be merged.
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final PutIfAbsentMapMergePolicy INSTANCE

      Single instance of this class.

  - ### Method Detail

    - #### merge

          public Object merge(String mapName,
                              com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView mergingEntry,
                              com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView existingEntry)

      Description copied from interface: `ReplicatedMapMergePolicy`
      Selects one of the merging and existing map entries to be merged.

      Note that the `existingEntry` may be `null` if there is no entry with the same key in the destination map. This happens, when the entry for that key was

      - only created in the smaller sub-cluster during the split-brain
      - removed in the larger sub-cluster during the split-brain
      Specified by:
        `merge` in interface `ReplicatedMapMergePolicy`
      Parameters:
        `mapName` - name of the replicated map
        `mergingEntry` - `ReplicatedMapEntryView` instance that has the map entry to be merged
        `existingEntry` - `ReplicatedMapEntryView` instance that has the existing map entry or `null` if there is no existing map entry
      Returns:
        the selected value for merging or `null` if the entry should be removed

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output

    - #### readData

          public void readData(ObjectDataInput in)

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input

Copyright © 2020. All rights reserved.