com.hazelcast.map.merge
Class LatestUpdateMapMergePolicy

java.lang.Object
  extended by com.hazelcast.map.merge.LatestUpdateMapMergePolicy
All Implemented Interfaces:
MapMergePolicy, DataSerializable

public class LatestUpdateMapMergePolicy
extends Object
implements MapMergePolicy

LatestUpdateMapMergePolicy causes the merging entry to be merged from source to destination map if source entry has updated more recently than the destination entry. This policy can only be used of the clocks of the machines are in sync.


Constructor Summary
LatestUpdateMapMergePolicy()
           
 
Method Summary
 Object merge(String mapName, EntryView mergingEntry, EntryView existingEntry)
          Returns the value of the entry after the merge of entries with the same key.
 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

LatestUpdateMapMergePolicy

public LatestUpdateMapMergePolicy()
Method Detail

merge

public Object merge(String mapName,
                    EntryView mergingEntry,
                    EntryView existingEntry)
Description copied from interface: MapMergePolicy
Returns the value of the entry after the merge of entries with the same key. You should consider the case where existingEntry's value is null.

Specified by:
merge in interface MapMergePolicy
Parameters:
mapName - name of the map
mergingEntry - entry merging into the destination cluster
existingEntry - existing entry in the destination cluster
Returns:
final value of the entry. If returns null then entry will 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

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


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.