use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class BasePutOperation method publishWANReplicationEvent.
private void publishWANReplicationEvent(MapEventPublisher mapEventPublisher, Object value) {
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
Record record = recordStore.getRecord(dataKey);
if (record == null) {
return;
}
final Data valueConvertedData = mapServiceContext.toData(value);
final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, valueConvertedData, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class PartitionWideEntryBackupOperation method run.
@Override
public void run() {
long now = getNow();
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
Iterator<Record> iterator = recordStore.iterator(now, true);
while (iterator.hasNext()) {
Record record = iterator.next();
Data dataKey = record.getKey();
Object oldValue = record.getValue();
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
if (!applyPredicate(dataKey, value)) {
continue;
}
Map.Entry entry = createMapEntry(dataKey, value);
processBackup(entry);
if (noOp(entry, oldValue)) {
continue;
}
if (entryRemovedBackup(entry, dataKey)) {
continue;
}
entryAddedOrUpdatedBackup(entry, dataKey);
evict(dataKey);
}
publishWanReplicationEventBackups();
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class PartitionWideEntryOperation method run.
@Override
public void run() {
long now = getNow();
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
responses = new MapEntries(recordStore.size());
Iterator<Record> iterator = recordStore.iterator(now, false);
while (iterator.hasNext()) {
Record record = iterator.next();
Data dataKey = record.getKey();
Object oldValue = record.getValue();
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
if (!applyPredicate(dataKey, value)) {
continue;
}
Map.Entry entry = createMapEntry(dataKey, value);
Data response = process(entry);
if (response != null) {
responses.add(dataKey, response);
}
// first call noOp, other if checks below depends on it.
if (noOp(entry, oldValue, now)) {
continue;
}
if (entryRemoved(entry, dataKey, oldValue, now)) {
continue;
}
entryAddedOrUpdated(entry, dataKey, oldValue, now);
evict(dataKey);
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class PutBackupOperation method publishWANReplicationEventBackup.
private void publishWANReplicationEventBackup(MapServiceContext mapServiceContext, MapEventPublisher mapEventPublisher) {
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
Record record = recordStore.getRecord(dataKey);
if (record == null) {
return;
}
final Data valueConvertedData = mapServiceContext.toData(dataValue);
final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, valueConvertedData, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class AbstractEvictableRecordStore method evictExpiredEntriesInternal.
private int evictExpiredEntriesInternal(int maxIterationCount, long now, boolean backup) {
int evictedCount = 0;
int checkedEntryCount = 0;
initExpirationIterator();
while (expirationIterator.hasNext()) {
if (checkedEntryCount >= maxIterationCount) {
break;
}
checkedEntryCount++;
Record record = expirationIterator.next();
record = getOrNullIfExpired(record, now, backup);
if (record == null) {
evictedCount++;
}
}
return evictedCount;
}
Aggregations