Package com.hazelcast.map.impl

Examples of com.hazelcast.map.impl.RecordStore


        ss = nei.getSerializationService();
        Address partitionOwner = ps.getPartitionOwner(partitionId);
        if (partitionOwner == null) {
            return false;
        }
        RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(partitionId, mapName);
        iterator = recordStore.entrySetData().iterator();
        return true;
    }
View Full Code Here


    public void run() {
        backupRecordInfos = new ArrayList<RecordInfo>();
        backupEntrySet = new ArrayList<Map.Entry<Data, Data>>();
        int partitionId = getPartitionId();
        final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
        RecordStore recordStore = mapServiceContext.getRecordStore(partitionId, name);
        Set<Map.Entry<Data, Data>> entries = entrySet.getEntrySet();
        InternalPartitionService partitionService = getNodeEngine().getPartitionService();
        Set<Data> keysToInvalidate = new HashSet<Data>();
        for (Map.Entry<Data, Data> entry : entries) {
            Data dataKey = entry.getKey();
            Data dataValue = entry.getValue();
            if (partitionId == partitionService.getPartitionId(dataKey)) {
                Data dataOldValue = null;
                if (initialLoad) {
                    recordStore.putFromLoad(dataKey, dataValue, -1);
                } else {
                    dataOldValue = mapServiceContext.toData(recordStore.put(dataKey, dataValue, -1));
                }
                mapServiceContext.interceptAfterPut(name, dataValue);
                EntryEventType eventType = dataOldValue == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
                final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
                mapEventPublisher.publishEvent(getCallerAddress(), name, eventType, dataKey, dataOldValue, dataValue);
                keysToInvalidate.add(dataKey);

                // check in case of an expiration.
                final Record record = recordStore.getRecordOrNull(dataKey);
                if (record == null) {
                    continue;
                }
                if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
                    final Data dataValueAsData = mapServiceContext.toData(dataValue);
                    final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, dataValueAsData, record);
                    mapEventPublisher.publishWanReplicationUpdate(name, entryView);
                }
                backupEntrySet.add(entry);
                RecordInfo replicationInfo = Records.buildRecordInfo(recordStore.getRecord(dataKey));
                backupRecordInfos.add(replicationInfo);
            }
        }
        invalidateNearCaches(keysToInvalidate);
    }
View Full Code Here

    public MapSizeOperation() {
    }

    public void run() {
        RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(getPartitionId(), name);
        recordStore.checkIfLoaded();
        size = recordStore.size();
        if (mapContainer.getMapConfig().isStatisticsEnabled()) {
            ((MapService) getService()).getMapServiceContext()
                    .getLocalMapStatsProvider().getLocalMapStatsImpl(name).incrementOtherOperations();
        }
    }
View Full Code Here

    public MapEntrySetOperation() {
    }

    public void run() {
        RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(getPartitionId(), name);
        entrySet = recordStore.entrySetData();
        if (mapContainer.getMapConfig().isStatisticsEnabled()) {
            ((MapService) getService()).getMapServiceContext()
                    .getLocalMapStatsProvider().getLocalMapStatsImpl(name).incrementOtherOperations();
        }
    }
View Full Code Here

        if (keyValueSequence == null || keyValueSequence.isEmpty()) {
            return;
        }
        final int partitionId = getPartitionId();
        final MapService mapService = this.mapService;
        final RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(partitionId, name);
        for (int i = 0; i < keyValueSequence.size(); i += 2) {
            final Data key = keyValueSequence.get(i);
            final Data dataValue = keyValueSequence.get(i + 1);
            // here object conversion is for interceptors.
            final Object objectValue = mapService.getMapServiceContext().toObject(dataValue);
            final Object previousValue = recordStore.putFromLoad(key, objectValue);

            callAfterPutInterceptors(objectValue);
            publishEntryEvent(key, mapService.getMapServiceContext().toData(previousValue), dataValue);
            publishWanReplicationEvent(key, dataValue, recordStore.getRecord(key));
        }
    }
View Full Code Here

        final NodeEngineImpl nodeEngine = getNode(node).getNodeEngine();
        MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
        final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
        final int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
        for (int i = 0; i < partitionCount; i++) {
            final RecordStore recordStore = mapServiceContext.getExistingRecordStore(i, mapName);
            if (recordStore == null) {
                continue;
            }
            final MapDataStore<Data, Object> mapDataStore
                    = recordStore.getMapDataStore();
            size += ((WriteBehindStore) mapDataStore).getWriteBehindQueue().size();
        }
        return size;
    }
View Full Code Here

        final long end = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(1);

        while (!loaded) {
            for (int i = 0; i < partitionCount; i++) {
                final RecordStore recordStore = service.getMapServiceContext()
                        .getPartitionContainer(i).getRecordStore(mapName);
                if (recordStore != null) {
                    loaded = recordStore.isLoaded();
                    if (!loaded) {
                        break;
                    }
                }
            }
View Full Code Here

        heapCost += mapContainer.getNearCacheSizeEstimator().getSize();
        return heapCost;
    }

    private int getRecordStoreSize(String mapName, PartitionContainer partitionContainer) {
        final RecordStore existingRecordStore = partitionContainer.getExistingRecordStore(mapName);
        if (existingRecordStore == null) {
            return 0;
        }
        return existingRecordStore.size();
    }
View Full Code Here

        }
        return existingRecordStore.size();
    }

    private long getRecordStoreHeapCost(String mapName, PartitionContainer partitionContainer) {
        final RecordStore existingRecordStore = partitionContainer.getExistingRecordStore(mapName);
        if (existingRecordStore == null) {
            return 0L;
        }
        return existingRecordStore.getHeapCost();
    }
View Full Code Here

        super(name);
    }

    @Override
    public void run() throws Exception {
        final RecordStore recordStore = mapService.getMapServiceContext().getExistingRecordStore(getPartitionId(), name);
        //if there is no recordStore, then there is nothing to evict.
        if (recordStore == null) {
            return;
        }
        recordStore.evictAll(true);
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.map.impl.RecordStore

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.