Package com.hazelcast.map

Examples of com.hazelcast.map.MapServiceContext.toData()


        final MapServiceContext mapServiceContext = getMapServiceContext();
        if (!mapServiceContext.hasRegisteredListener(mapName) || eventType == NO_NEED_TO_FIRE_EVENT) {
            return;
        }
        final Data oldValue = mapServiceContext.toData(valueBeforeProcess);
        final Data value = mapServiceContext.toData(valueAfterProcess);
        final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
        mapEventPublisher.publishEvent(getCallerAddress(), mapName, eventType, key, oldValue, value);
    }

    private void invalidateNearCache(Data key) {
View Full Code Here


            if (EntryEventType.REMOVED.equals(eventType)) {
                mapEventPublisher.publishWanReplicationRemove(mapName, key, Clock.currentTimeMillis());
            } else {
                Record record = recordStore.getRecord(key);
                if (record != null) {
                    Data tempValue = mapServiceContext.toData(dataValue);
                    final EntryView entryView = EntryViews.createSimpleEntryView(key, tempValue, record);
                    mapEventPublisher.publishWanReplicationUpdate(mapName, entryView);
                }
            }
        }
View Full Code Here

        oldValue = recordStore.getMapEntry(dataKey).getValue();
        final LocalMapStatsImpl mapStats
                = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(name);
        final Object valueBeforeProcess = mapServiceContext.toObject(oldValue);
        final MapEntrySimple entry = new MapEntrySimple(mapServiceContext.toObject(dataKey), valueBeforeProcess);
        response = mapServiceContext.toData(entryProcessor.process(entry));
        final Object valueAfterProcess = entry.getValue();
        // no matching data by key.
        if (oldValue == null && valueAfterProcess == null) {
            eventType = NO_NEED_TO_FIRE_EVENT;
        } else if (valueAfterProcess == null) {
View Full Code Here

                mapStats.incrementPuts(getLatencyFrom(start));
                eventType = EntryEventType.UPDATED;
            }
            if (eventType != NO_NEED_TO_FIRE_EVENT) {
                recordStore.put(new AbstractMap.SimpleImmutableEntry<Data, Object>(dataKey, entry.getValue()));
                dataValue = mapServiceContext.toData(entry.getValue());
            }
        }
    }

    public void afterRun() throws Exception {
View Full Code Here

        if (eventService.hasEventRegistration(serviceName, name)) {
            if (format == InMemoryFormat.OBJECT && eventType != EntryEventType.REMOVED) {
                oldValue = null;
            }
            mapService.getMapServiceContext().getMapEventPublisher().
                    publishEvent(getCallerAddress(), name, eventType, dataKey, mapServiceContext.toData(oldValue), dataValue);
        }
        invalidateNearCaches();
        if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
            if (EntryEventType.REMOVED.equals(eventType)) {
                mapEventPublisher.publishWanReplicationRemove(name, dataKey, Clock.currentTimeMillis());
View Full Code Here

            if (EntryEventType.REMOVED.equals(eventType)) {
                mapEventPublisher.publishWanReplicationRemove(name, dataKey, Clock.currentTimeMillis());
            } else {
                Record record = recordStore.getRecord(dataKey);
                if (record != null) {
                    final Data dataValueAsData = mapServiceContext.toData(dataValue);
                    final EntryView entryView = createSimpleEntryView(dataKey, dataValueAsData, record);
                    mapEventPublisher.publishWanReplicationUpdate(name, entryView);
                }
            }
        }
View Full Code Here

        if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
            Record record = recordStore.getRecord(dataKey);
            if (record == null) {
                return;
            }
            final Data valueConvertedData = mapServiceContext.toData(dataValue);
            final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, valueConvertedData, record);
            mapEventPublisher.publishWanReplicationUpdate(name, entryView);
        }
    }
View Full Code Here

        if (currentValue != null) {
            return checkIfRemoved(currentValue);
        }
        final MapService service = getService();
        final MapServiceContext mapServiceContext = service.getMapServiceContext();
        return mapServiceContext.toObject(getInternal(mapServiceContext.toData(key, partitionStrategy)));
    }

    public Object getForUpdate(Object key) {
        checkTransactionState();
        TxnValueWrapper currentValue = txMap.get(key);
View Full Code Here

        if (currentValue != null) {
            return checkIfRemoved(currentValue);
        }
        final MapService service = getService();
        final MapServiceContext mapServiceContext = service.getMapServiceContext();
        Data dataKey = mapServiceContext.toData(key, partitionStrategy);
        return mapServiceContext.toObject(getForUpdateInternal(dataKey));
    }

    private Object checkIfRemoved(TxnValueWrapper wrapper) {
        checkTransactionState();
View Full Code Here

    public Object put(Object key, Object value) {
        checkTransactionState();
        MapService service = getService();
        final MapServiceContext mapServiceContext = service.getMapServiceContext();
        final Object valueBeforeTxn = mapServiceContext.toObject(putInternal(mapServiceContext.toData(key, partitionStrategy),
                mapServiceContext.toData(value)));
        TxnValueWrapper currentValue = txMap.get(key);
        if (value != null) {
            TxnValueWrapper wrapper = valueBeforeTxn == null
                    ? new TxnValueWrapper(value, TxnValueWrapper.Type.NEW)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.