use of com.hazelcast.spi.merge.RingbufferMergeData in project hazelcast by hazelcast.
the class RingbufferMergeIntegerValuesMergePolicy method merge.
@Override
public RingbufferMergeData merge(RingbufferMergeTypes mergingValue, RingbufferMergeTypes existingValue) {
final RingbufferMergeData mergingRingbuffer = mergingValue.getValue();
final RingbufferMergeData result = new RingbufferMergeData(mergingRingbuffer.getCapacity());
RingbufferMergeData existingRingbuffer;
if (existingValue != null) {
existingRingbuffer = existingValue.getValue();
} else {
existingRingbuffer = new RingbufferMergeData(mergingRingbuffer.getCapacity());
}
for (Object value : mergingRingbuffer) {
if (value instanceof Integer) {
result.add(value);
}
}
for (Object value : existingRingbuffer) {
if (value instanceof Integer) {
result.add(value);
}
}
return result;
}
Aggregations