use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class EntryBackupOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent(EntryEventType eventType) {
final MapContainer mapContainer = this.mapContainer;
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
final MapEventPublisher mapEventPublisher = mapContainer.getMapServiceContext().getMapEventPublisher();
final Data key = dataKey;
if (EntryEventType.REMOVED == eventType) {
mapEventPublisher.publishWanReplicationRemoveBackup(name, key, Clock.currentTimeMillis());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
dataValue = mapContainer.getMapServiceContext().toData(dataValue);
final EntryView entryView = createSimpleEntryView(key, dataValue, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class EntryOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent() {
final MapContainer mapContainer = this.mapContainer;
if (mapContainer.getWanReplicationPublisher() == null && mapContainer.getWanMergePolicy() == null) {
return;
}
final Data key = dataKey;
if (REMOVED.equals(eventType)) {
mapEventPublisher.publishWanReplicationRemove(name, key, getNow());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
dataValue = toData(dataValue);
final EntryView entryView = createSimpleEntryView(key, dataValue, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
}
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class GetEntryViewOperation method run.
@Override
public void run() {
Record record = recordStore.getRecordOrNull(dataKey);
if (record != null) {
Data value = mapServiceContext.toData(record.getValue());
result = EntryViews.createSimpleEntryView(dataKey, value, record);
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class MapSplitBrainHandlerService method prepareMergeRunnable.
@Override
public Runnable prepareMergeRunnable() {
final long now = getNow();
final Map<String, MapContainer> mapContainers = getMapContainers();
final Map<MapContainer, Collection<Record>> recordMap = new HashMap<MapContainer, Collection<Record>>(mapContainers.size());
final IPartitionService partitionService = nodeEngine.getPartitionService();
final int partitionCount = partitionService.getPartitionCount();
final Address thisAddress = nodeEngine.getClusterService().getThisAddress();
for (MapContainer mapContainer : mapContainers.values()) {
for (int i = 0; i < partitionCount; i++) {
RecordStore recordStore = mapServiceContext.getPartitionContainer(i).getRecordStore(mapContainer.getName());
// add your owned entries to the map so they will be merged
if (thisAddress.equals(partitionService.getPartitionOwner(i))) {
Collection<Record> records = recordMap.get(mapContainer);
if (records == null) {
records = new ArrayList<Record>();
recordMap.put(mapContainer, records);
}
final Iterator<Record> iterator = recordStore.iterator(now, false);
while (iterator.hasNext()) {
final Record record = iterator.next();
records.add(record);
}
}
// clear all records either owned or backup
recordStore.reset();
}
Indexes indexes = mapContainer.getIndexes();
indexes.clearIndexes();
}
return new Merger(recordMap);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class BasePutOperation method getBackupOperation.
@Override
public Operation getBackupOperation() {
final Record record = recordStore.getRecord(dataKey);
final RecordInfo replicationInfo = buildRecordInfo(record);
if (isPostProcessing(recordStore)) {
dataValue = mapServiceContext.toData(record.getValue());
}
return new PutBackupOperation(name, dataKey, dataValue, replicationInfo, putTransient);
}
Aggregations