Package com.hazelcast.map.impl

Examples of com.hazelcast.map.impl.RecordStore


            final Integer partitionId = entry.getKey();
            final List<DelayedEntry> fails = failsPerPartition.get(partitionId);
            if (fails == null || fails.isEmpty()) {
                continue;
            }
            final RecordStore recordStore = getRecordStoreOrNull(mapName, partitionId);
            if (recordStore == null) {
                continue;
            }
            final WriteBehindQueue<DelayedEntry> queue = getWriteBehindQueue(recordStore);
            queue.addFront(fails);
View Full Code Here


    }

    @Override
    public void run() throws Exception {
        final int partitionId = getPartitionId();
        final RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(partitionId, name);
        keys = selectThisPartitionsKeys(this.keys);
        recordStore.loadAllFromStore(keys, replaceExistingValues);
    }
View Full Code Here

    public void run() {
        MapService mapService = getService();
        MapServiceContext mapServiceContext = mapService.getMapServiceContext();
        int partitionId = getPartitionId();
        RecordStore recordStore = mapServiceContext.getRecordStore(partitionId, name);
        recordStore.removeBackup(dataKey);
        if (unlockKey) {
            recordStore.forceUnlock(dataKey);
        }
    }
View Full Code Here

                                   int replicaIndex) {
        this.setPartitionId(partitionId).setReplicaIndex(replicaIndex);

        data = new HashMap<String, Set<RecordReplicationInfo>>(container.getMaps().size());
        for (Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
            RecordStore recordStore = entry.getValue();
            MapContainer mapContainer = recordStore.getMapContainer();
            final MapConfig mapConfig = mapContainer.getMapConfig();
            if (mapConfig.getTotalBackupCount() < replicaIndex) {
                continue;
            }
            String name = entry.getKey();
            // now prepare data to migrate records
            Set<RecordReplicationInfo> recordSet = new HashSet<RecordReplicationInfo>(recordStore.size());
            final Iterator<Record> iterator = recordStore.iterator();
            while (iterator.hasNext()) {
                final Record record = iterator.next();
                RecordReplicationInfo recordReplicationInfo;
                recordReplicationInfo = createRecordReplicationInfo(record, mapService);
                recordSet.add(recordReplicationInfo);
View Full Code Here

    }

    private void readDelayedEntries(PartitionContainer container) {
        delayedEntries = new HashMap<String, List<DelayedEntry>>(container.getMaps().size());
        for (Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
            RecordStore recordStore = entry.getValue();
            MapContainer mapContainer = recordStore.getMapContainer();
            if (!mapContainer.isWriteBehindMapStoreEnabled()) {
                continue;
            }
            final WriteBehindQueue<DelayedEntry> writeBehindQueue = ((WriteBehindStore) recordStore.getMapDataStore())
                    .getWriteBehindQueue();
            final List<DelayedEntry> delayedEntries = writeBehindQueue.getSnapShot().asList();
            if (delayedEntries != null && delayedEntries.size() == 0) {
                continue;
            }
View Full Code Here

        final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
        if (data != null) {
            for (Entry<String, Set<RecordReplicationInfo>> dataEntry : data.entrySet()) {
                Set<RecordReplicationInfo> recordReplicationInfos = dataEntry.getValue();
                final String mapName = dataEntry.getKey();
                RecordStore recordStore = mapServiceContext.getRecordStore(getPartitionId(), mapName);
                for (RecordReplicationInfo recordReplicationInfo : recordReplicationInfos) {
                    Data key = recordReplicationInfo.getKey();
                    final Data value = recordReplicationInfo.getValue();
                    final MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
                    Record newRecord = mapContainer.createRecord(key, value, -1L, Clock.currentTimeMillis());
                    applyRecordInfo(newRecord, recordReplicationInfo);
                    recordStore.putRecord(key, newRecord);
                }
                recordStore.setLoaded(true);

            }
        }
        for (Entry<String, List<DelayedEntry>> entry : delayedEntries.entrySet()) {
            final RecordStore recordStore = mapServiceContext.getRecordStore(getPartitionId(), entry.getKey());
            final List<DelayedEntry> replicatedEntries = entry.getValue();
            final WriteBehindQueue<DelayedEntry> writeBehindQueue
                    = ((WriteBehindStore) recordStore.getMapDataStore()).getWriteBehindQueue();
            writeBehindQueue.addEnd(replicatedEntries);
        }
    }
View Full Code Here

                    || nodeEngine.getThisAddress().equals(owner) && !backup) {
                final PartitionContainer container = mapServiceContext.getPartitionContainer(i);
                if (container == null) {
                    continue;
                }
                final RecordStore recordStore = container.getRecordStore(map.getName());
                final DefaultRecordStore defaultRecordStore = (DefaultRecordStore) recordStore;
                final Iterator<Record> iterator = defaultRecordStore.iterator(now, backup);
                while (iterator.hasNext()) {
                    iterator.next();
                    count++;
View Full Code Here

            if (nodeEngine.getThisAddress().equals(owner)) {
                final PartitionContainer container = mapServiceContext.getPartitionContainer(i);
                if (container == null) {
                    continue;
                }
                final RecordStore recordStore = container.getRecordStore(map.getName());
                final DefaultRecordStore defaultRecordStore = (DefaultRecordStore) recordStore;
                defaultRecordStore.setSizeEstimator(new SizeEstimator() {

                    long size;
View Full Code Here

        MapService mapService = nodeEngine.getService(serviceName);
        MapServiceContext mapServiceContext = mapService.getMapServiceContext();
        int partitionId = nodeEngine.getPartitionService().getPartitionId("key");
        Data dataKey = mapServiceContext.toData("key");

        RecordStore recordStore = mapServiceContext.getRecordStore(partitionId,mapName);
        MapMergePolicy mergePolicy = mapServiceContext.getMergePolicyProvider().getMergePolicy(PutIfAbsentMapMergePolicy.class.getName());
        EntryView<String, MyObject> mergingEntryView = new SimpleEntryView("key",new MyObject());
        recordStore.merge(dataKey, mergingEntryView, mergePolicy);

        int deSerializedCount = myObjectExisting.deserializedCount;
        assertEquals(0, deSerializedCount);

    }
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

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.