use of com.hazelcast.spi.merge.SplitBrainMergeTypes.RingbufferMergeTypes in project hazelcast by hazelcast.
the class MergeOperation method merge.
/**
* Merges the provided {@code mergingValue} into the {@code existingContainer}
* and returns the merged ringbuffer.
*
* @param existingContainer the container into which to merge the data
* @param mergingValue the data to merge
* @return the merged ringbuffer
*/
private Ringbuffer<Object> merge(RingbufferContainer<Object, Object> existingContainer, RingbufferMergeTypes mergingValue) {
RingbufferMergeTypes existingValue = createMergingValueOrNull(existingContainer);
RingbufferMergeData resultData = mergePolicy.merge(mergingValue, existingValue);
if (resultData == null) {
ringbufferService.destroyDistributedObject(namespace.getObjectName());
return null;
} else {
if (existingContainer == null) {
RingbufferConfig config = getRingbufferConfig(ringbufferService, namespace);
existingContainer = ringbufferService.getOrCreateContainer(getPartitionId(), namespace, config);
}
setRingbufferData(resultData, existingContainer);
return existingContainer.getRingbuffer();
}
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.RingbufferMergeTypes in project hazelcast by hazelcast.
the class MergeOperation method run.
@Override
public void run() throws Exception {
RingbufferContainer<Object, Object> existingContainer = ringbufferService.getContainerOrNull(getPartitionId(), namespace);
RingbufferMergeTypes mergingValue = createMergingValue(serializationService, mergingRingbuffer);
mergePolicy = (SplitBrainMergePolicy<RingbufferMergeData, RingbufferMergeTypes, RingbufferMergeData>) serializationService.getManagedContext().initialize(mergePolicy);
resultRingbuffer = merge(existingContainer, mergingValue);
}
Aggregations