use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class PutIfAbsentMapMergePolicyTest method merge_existingValuePresent.
@Test
public void merge_existingValuePresent() {
EntryView existing = entryWithGivenValue(EXISTING);
EntryView merging = entryWithGivenValue(MERGING);
assertEquals(EXISTING, policy.merge("map", merging, existing));
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class EvictorImpl method evict.
@Override
public void evict(RecordStore recordStore, Data excludedKey) {
EntryView evictableEntry = selectEvictableEntry(recordStore, excludedKey);
if (evictableEntry == null) {
return;
}
evictEntry(recordStore, evictableEntry);
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class EvictorImpl method selectEvictableEntry.
private EntryView selectEvictableEntry(RecordStore recordStore, Data excludedKey) {
Iterable<EntryView> samples = getSamples(recordStore);
EntryView excluded = null;
EntryView selected = null;
for (EntryView candidate : samples) {
if (excludedKey != null && excluded == null && getDataKey(candidate).equals(excludedKey)) {
excluded = candidate;
continue;
}
if (selected == null) {
selected = candidate;
} else if (mapEvictionPolicy.compare(candidate, selected) < 0) {
selected = candidate;
}
}
return selected == null ? excluded : selected;
}
use of com.hazelcast.core.EntryView 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.core.EntryView 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);
}
Aggregations