use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class PutAllOperation method put.
private void put(Data dataKey, Data dataValue) {
Object oldValue = putToRecordStore(dataKey, dataValue);
dataValue = getValueOrPostProcessedValue(dataKey, dataValue);
mapServiceContext.interceptAfterPut(name, dataValue);
if (hasMapListener) {
EntryEventType eventType = (oldValue == null ? ADDED : UPDATED);
mapEventPublisher.publishEvent(getCallerAddress(), name, eventType, dataKey, oldValue, dataValue);
}
Record record = (hasWanReplication || hasBackups) ? recordStore.getRecord(dataKey) : null;
if (hasWanReplication) {
EntryView entryView = createSimpleEntryView(dataKey, dataValue, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
}
if (hasBackups) {
RecordInfo replicationInfo = buildRecordInfo(record);
backupRecordInfos.add(replicationInfo);
}
evict(dataKey);
if (hasInvalidation) {
invalidationKeys.add(dataKey);
}
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class PutFromLoadAllBackupOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent(Data key, Data value, Record record) {
if (record == null) {
return;
}
if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
EntryView entryView = EntryViews.createSimpleEntryView(key, value, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class ClientMapBasicTest method testGetEntryView.
@Test
public void testGetEntryView() {
IMap<String, String> map = client.getMap(randomString());
String key = "Key";
String value = "Value";
map.put(key, value);
EntryView view = map.getEntryView(key);
assertEquals(key, view.getKey());
assertEquals(value, view.getValue());
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class AbstractMultipleEntryBackupOperation method publishWanReplicationEventBackup.
protected void publishWanReplicationEventBackup(Data key, Object value, EntryEventType eventType) {
if (mapContainer.isWanReplicationEnabled()) {
if (REMOVED.equals(eventType)) {
mapEventPublisher.publishWanReplicationRemoveBackup(name, key, getNow());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
final Data dataValueAsData = toData(value);
final EntryView entryView = createSimpleEntryView(key, dataValueAsData, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
}
}
}
use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.
the class AbstractMultipleEntryOperation method publishWanReplicationEvent.
protected void publishWanReplicationEvent(Data key, Data value, EntryEventType eventType) {
if (EntryEventType.REMOVED == eventType) {
mapEventPublisher.publishWanReplicationRemove(name, key, getNow());
wanEventList.add(new WanEventWrapper(key, null, EntryEventType.REMOVED));
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
final Data dataValueAsData = toData(value);
final EntryView entryView = createSimpleEntryView(key, dataValueAsData, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
wanEventList.add(new WanEventWrapper(key, value, EntryEventType.UPDATED));
}
}
}
Aggregations