use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class DiscardMergePolicyTest method merge_existingValuePresent.
@Test
public void merge_existingValuePresent() {
MapMergeTypes existing = mergingValueWithGivenValue(EXISTING);
MapMergeTypes merging = mergingValueWithGivenValue(MERGING);
assertEquals(EXISTING, mergePolicy.merge(merging, existing));
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class DiscardMergePolicyTest method merge_bothValuesNull.
@Test
public void merge_bothValuesNull() {
MapMergeTypes existing = mergingValueWithGivenValue(null);
MapMergeTypes merging = mergingValueWithGivenValue(null);
assertNull(mergePolicy.merge(merging, existing));
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class WanMapSupportingService method handleAddOrUpdate.
private void handleAddOrUpdate(WanMapAddOrUpdateEvent replicationUpdate) {
SplitBrainMergePolicy mergePolicy = replicationUpdate.getMergePolicy();
String mapName = replicationUpdate.getObjectName();
MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
SerializationService serializationService = nodeEngine.getSerializationService();
MapMergeTypes<Object, Object> mergingEntry = createMergingEntry(serializationService, replicationUpdate.getEntryView());
// noinspection unchecked
MapOperation operation = operationProvider.createMergeOperation(mapName, mergingEntry, (SplitBrainMergePolicy<Object, MapMergeTypes<Object, Object>, Object>) mergePolicy, true);
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(replicationUpdate.getEntryView().getKey());
Future future = nodeEngine.getOperationService().invokeOnPartition(SERVICE_NAME, operation, partitionId);
future.get();
wanEventTypeCounters.incrementUpdate(mapName);
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class MergeOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(mergingEntries.size());
for (MapMergeTypes mergingEntry : mergingEntries) {
out.writeObject(mergingEntry);
}
out.writeObject(mergePolicy);
out.writeBoolean(disableWanReplicationEvent);
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class MergeOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
int size = in.readInt();
mergingEntries = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
MapMergeTypes mergingEntry = in.readObject();
mergingEntries.add(mergingEntry);
}
mergePolicy = in.readObject();
disableWanReplicationEvent = in.readBoolean();
}
Aggregations