com.hazelcast.map.merge

## Class HigherHitsMapMergePolicy

- java.lang.Object
- - com.hazelcast.map.merge.HigherHitsMapMergePolicy

- All Implemented Interfaces:
    MapMergePolicy, DataSerializable, IdentifiedDataSerializable

      public class HigherHitsMapMergePolicy
      extends Object
      implements MapMergePolicy, IdentifiedDataSerializable

  Merges map entries from source to destination map if the source entry has more hits than the destination one.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HigherHitsMapMergePolicy()`

  - ### 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, EntryView mergingEntry, EntryView 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`

- - ### Constructor Detail

    - #### HigherHitsMapMergePolicy

          public HigherHitsMapMergePolicy()

  - ### Method Detail

    - #### merge

          public Object merge(String mapName,
                              EntryView mergingEntry,
                              EntryView existingEntry)

      Description copied from interface: `MapMergePolicy`
      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 `MapMergePolicy`
      Parameters:
        `mapName` - name of the map
        `mergingEntry` - `EntryView` instance that has the map entry to be merged
        `existingEntry` - `EntryView` 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

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### 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

Copyright © 2019. All rights reserved.