public class LatestAccessMergePolicy extends Object
Note: This policy can only be used if the clocks of the nodes are in sync.
| Modifier and Type | Method and Description |
|---|---|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
<K,V> V |
merge(SplitBrainMergeEntryView<K,V> mergingEntry,
SplitBrainMergeEntryView<K,V> existingEntry)
Selects one of the merging and existing data structure entries to be merged.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
void |
setSerializationService(SerializationService serializationService)
Sets the
SerializationService for this merge policy. |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public <K,V> V merge(SplitBrainMergeEntryView<K,V> mergingEntry, SplitBrainMergeEntryView<K,V> existingEntry)
SplitBrainMergePolicy
Note that as mentioned also in arguments, the SplitBrainMergeEntryView instance that represents
the existing data structure entry may be null if there is no existing entry for the specified key
in the SplitBrainMergeEntryView instance that represents the merging data structure entry.
K - the type of the keyV - the type of the valuemergingEntry - SplitBrainMergeEntryView instance that has the data structure entry to be mergedexistingEntry - SplitBrainMergeEntryView instance that has the existing data structure entry
or null if there is no existing data structure entrypublic int getId()
IdentifiedDataSerializablepublic void setSerializationService(SerializationService serializationService)
SplitBrainMergePolicySerializationService for this merge policy.
The keys and values of merging and existing SplitBrainMergeEntryViews are always in the in-memory format of the
backing data structure. This can be a serialized format, so the content cannot be processed without deserialization.
For most merge policies this will be fine, since the key or value are not used. If your implementation needs the
deserialized data, you can use SerializationService.toObject(Object) of the injected SerializationService.
The deserialization is not done eagerly for two main reasons:
InMemoryFormat.BINARY with a different
classpath on client and server. In this case a deserialization could throw a ClassNotFoundException.setSerializationService in interface SplitBrainMergePolicyserializationService - the SerializationServicepublic int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic void writeData(ObjectDataOutput out)
DataSerializablewriteData in interface DataSerializableout - outputpublic void readData(ObjectDataInput in)
DataSerializablereadData in interface DataSerializablein - inputCopyright © 2018. All Rights Reserved.