Search in sources :

Example 76 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class PutAllBackupOperation method run.

@Override
public void run() {
    boolean wanEnabled = mapContainer.isWanReplicationEnabled();
    for (int i = 0; i < entries.size(); i++) {
        Data dataKey = entries.getKey(i);
        Data dataValue = entries.getValue(i);
        Record record = recordStore.putBackup(dataKey, dataValue);
        applyRecordInfo(record, recordInfos.get(i));
        if (wanEnabled) {
            Data dataValueAsData = mapServiceContext.toData(dataValue);
            EntryView entryView = createSimpleEntryView(dataKey, dataValueAsData, record);
            mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
        }
        evict(dataKey);
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) EntryViews.createSimpleEntryView(com.hazelcast.map.impl.EntryViews.createSimpleEntryView) Data(com.hazelcast.nio.serialization.Data) Record(com.hazelcast.map.impl.record.Record)

Example 77 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class PutBackupOperation method run.

@Override
public void run() {
    ttl = recordInfo != null ? recordInfo.getTtl() : ttl;
    final Record record = recordStore.putBackup(dataKey, dataValue, ttl, putTransient);
    if (recordInfo != null) {
        Records.applyRecordInfo(record, recordInfo);
    }
    if (unlockKey) {
        recordStore.forceUnlock(dataKey);
    }
}
Also used : Record(com.hazelcast.map.impl.record.Record)

Example 78 with Record

use of com.hazelcast.map.impl.record.Record 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);
            }
        }
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) EntryViews.createSimpleEntryView(com.hazelcast.map.impl.EntryViews.createSimpleEntryView) Record(com.hazelcast.map.impl.record.Record) Data(com.hazelcast.nio.serialization.Data)

Example 79 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class AbstractMultipleEntryOperation method doPostOps.

protected void doPostOps(Data key, Object oldValue, Map.Entry entry) {
    final EntryEventType eventType = pickEventTypeOrNull(entry, oldValue);
    if (eventType == null) {
        return;
    }
    Object newValue = entry.getValue();
    invalidateNearCache(key);
    mapServiceContext.interceptAfterPut(name, newValue);
    if (isPostProcessing(recordStore)) {
        Record record = recordStore.getRecord(key);
        newValue = record == null ? null : record.getValue();
    }
    if (mapContainer.isWanReplicationEnabled()) {
        newValue = toData(newValue);
        publishWanReplicationEvent(key, (Data) newValue, eventType);
    }
    publishEntryEvent(key, newValue, oldValue, eventType);
}
Also used : EntryEventType(com.hazelcast.core.EntryEventType) Record(com.hazelcast.map.impl.record.Record)

Example 80 with Record

use of com.hazelcast.map.impl.record.Record 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));
        }
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) EntryViews.createSimpleEntryView(com.hazelcast.map.impl.EntryViews.createSimpleEntryView) Record(com.hazelcast.map.impl.record.Record) Data(com.hazelcast.nio.serialization.Data)

Aggregations

Record (com.hazelcast.map.impl.record.Record)109 Data (com.hazelcast.internal.serialization.Data)27 Data (com.hazelcast.nio.serialization.Data)22 Map (java.util.Map)13 EntryEventData (com.hazelcast.map.impl.event.EntryEventData)11 ExpiryMetadata (com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata)11 EntryView (com.hazelcast.core.EntryView)8 Indexes (com.hazelcast.query.impl.Indexes)8 ArrayList (java.util.ArrayList)7 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)6 MapContainer (com.hazelcast.map.impl.MapContainer)6 DelayedEntry (com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)6 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)6 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)6 EntryViews.createSimpleEntryView (com.hazelcast.map.impl.EntryViews.createSimpleEntryView)5 MapService (com.hazelcast.map.impl.MapService)5 List (java.util.List)5 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)4 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)3 MapEntries (com.hazelcast.map.impl.MapEntries)3