Package com.hazelcast.map.record

Examples of com.hazelcast.map.record.Record


    public MergeRemoveOperation() {
    }

    public void run() {
        Record record = recordStore.getRecord(dataKey);
        // todo what if statistics is disabled. currently it accepts the remove
        // check if there is newer update or insert. If so then cancel the remove
        if (record.getCreationTime() > removeTime
                || record.getLastUpdateTime() > removeTime) {
            return;
        }
        recordStore.deleteRecord(dataKey);
        merged = true;
    }
View Full Code Here


        final RecordStore recordStore = mapServiceContext.getRecordStore(getPartitionId(), name);
        final LocalMapStatsImpl mapStats
                = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(name);
        final Iterator<Record> iterator = recordStore.iterator();
        while (iterator.hasNext()) {
            final Record record = iterator.next();
            final long start = Clock.currentTimeMillis();
            final Data key = record.getKey();
            final Object valueBeforeProcess = record.getValue();
            final Object valueBeforeProcessObject = mapServiceContext.toObject(valueBeforeProcess);
            Object objectKey = mapServiceContext.toObject(key);
            if (getPredicate() != null) {
                final SerializationService ss = getNodeEngine().getSerializationService();
                QueryEntry queryEntry = new QueryEntry(ss, key, objectKey, valueBeforeProcessObject);
View Full Code Here

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

                EntryEventType eventType = dataOldValue == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
                final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
                mapEventPublisher.publishEvent(getCallerAddress(), name, eventType, dataKey, dataOldValue, dataValue);
                keysToInvalidate.add(dataKey);
                if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
                    Record record = recordStore.getRecord(dataKey);
                    if (record != null) {
                        final Data dataValueAsData = mapServiceContext.toData(dataValue);
                        final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, dataValueAsData, record);
                        mapEventPublisher.publishWanReplicationUpdate(name, entryView);
                    }
View Full Code Here

        while (expirationIterator.hasNext()) {
            if (checkedEntryCount >= maxIterationCount) {
                break;
            }
            checkedEntryCount++;
            final Record record = expirationIterator.next();
            final Data key = record.getKey();
            if (isLocked(key)) {
                continue;
            }
            if (isReachable(record, now)) {
                continue;
            }
            //!!! get entry value here because evictInternal(key) nulls the record value.
            final Object value = record.getValue();
            evictInternal(key);
            evictedCount++;
            initExpirationIterator();

            // do post eviction operations if this partition is an owner partition.
View Full Code Here

    private boolean isReachable(Record record, long time) {
        if (record == null) {
            return false;
        }
        final Record idleExpired = isIdleExpired(record, time);
        if (idleExpired == null) {
            return false;
        }
        final Record ttlExpired = isTTLExpired(record, time);

        return ttlExpired != null;
    }
View Full Code Here

    public void run() {
        Map.Entry entry;
        RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(getPartitionId(), name);
        final Iterator<Record> iterator = recordStore.iterator();
        while (iterator.hasNext()) {
            final Record record = iterator.next();
            Data dataKey = record.getKey();
            Object objectKey = mapService.getMapServiceContext().toObject(record.getKey());
            Object valueBeforeProcess = mapService.getMapServiceContext().toObject(record.getValue());
            if (getPredicate() != null) {
                QueryEntry queryEntry
                        = new QueryEntry(getNodeEngine().getSerializationService(), dataKey, objectKey, valueBeforeProcess);
                if (!getPredicate().apply(queryEntry)) {
                    continue;
View Full Code Here

    public boolean replace(Data key, Object testValue, Object newValue) {
        checkIfLoaded();
        final long now = getNow();
        earlyWriteCleanup(now);

        Record record = records.get(key);
        if (record == null) {
            return false;
        }
        if (mapServiceContext.compare(name, record.getValue(), testValue)) {
            newValue = mapServiceContext.interceptPut(name, record.getValue(), newValue);
            newValue = mapDataStore.add(key, newValue, now);
            onStore(record);
            updateSizeEstimator(-calculateRecordHeapCost(record));
            setRecordValue(record, newValue, now);
            updateSizeEstimator(calculateRecordHeapCost(record));
View Full Code Here

        final int evictableBaseIndex = getEvictionStartIndex(criterias, evictableSize);
        final long criteriaValue = criterias[evictableBaseIndex];
        int evictedRecordCounter = 0;
        final Iterator<Record> iterator = recordStore.iterator();
        while (iterator.hasNext()) {
            final Record record = iterator.next();
            final long value = getEvictionCriteriaValue(record, evictionPolicy);
            if (value <= criteriaValue) {
                final Data tmpKey = record.getKey();
                final Object tmpValue = record.getValue();
                if (evictIfNotLocked(tmpKey, recordStore)) {
                    evictedRecordCounter++;
                    final String mapName = mapConfig.getName();
                    interceptAndInvalidate(mapServiceContext, value, tmpKey, mapName);
                    fireEvent(tmpKey, tmpValue, mapName, mapServiceContext);
View Full Code Here

    }

    @Override
    public void run() {
        recordStore.unlock(dataKey, ownerUuid, getThreadId());
        Record record = recordStore.getRecord(dataKey);
        if (record == null || version == record.getVersion()) {
            dataOldValue = getNodeEngine().toData(recordStore.remove(dataKey));
            successful = dataOldValue != null;
        }
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.map.record.Record

Copyright © 2018 www.massapicom. 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.