Search in sources :

Example 1 with MapDataStore

use of com.hazelcast.map.impl.mapstore.MapDataStore in project hazelcast by hazelcast.

the class MapServiceContextImpl method flushMaps.

@Override
public void flushMaps() {
    for (MapContainer mapContainer : mapContainers.values()) {
        mapContainer.getMapStoreContext().stop();
    }
    for (PartitionContainer partitionContainer : partitionContainers) {
        for (String mapName : mapContainers.keySet()) {
            RecordStore recordStore = partitionContainer.getExistingRecordStore(mapName);
            if (recordStore != null) {
                MapDataStore mapDataStore = recordStore.getMapDataStore();
                mapDataStore.hardFlush();
            }
        }
    }
}
Also used : MapDataStore(com.hazelcast.map.impl.mapstore.MapDataStore) DefaultRecordStore(com.hazelcast.map.impl.recordstore.DefaultRecordStore) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore)

Example 2 with MapDataStore

use of com.hazelcast.map.impl.mapstore.MapDataStore in project hazelcast by hazelcast.

the class AwaitMapFlushOperation method innerBeforeRun.

@Override
public void innerBeforeRun() throws Exception {
    super.innerBeforeRun();
    MapDataStore mapDataStore = recordStore.getMapDataStore();
    if (!(mapDataStore instanceof WriteBehindStore)) {
        return;
    }
    store = (WriteBehindStore) mapDataStore;
}
Also used : MapDataStore(com.hazelcast.map.impl.mapstore.MapDataStore) WriteBehindStore(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore)

Example 3 with MapDataStore

use of com.hazelcast.map.impl.mapstore.MapDataStore in project hazelcast by hazelcast.

the class StoreWorker method hasEntryInWriteBehindQueue.

private boolean hasEntryInWriteBehindQueue(RecordStore recordStore) {
    if (recordStore == null) {
        return false;
    }
    MapDataStore mapDataStore = recordStore.getMapDataStore();
    WriteBehindStore dataStore = (WriteBehindStore) mapDataStore;
    WriteBehindQueue<DelayedEntry> writeBehindQueue = dataStore.getWriteBehindQueue();
    return writeBehindQueue.size() != 0;
}
Also used : MapDataStore(com.hazelcast.map.impl.mapstore.MapDataStore) DelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)

Example 4 with MapDataStore

use of com.hazelcast.map.impl.mapstore.MapDataStore in project hazelcast by hazelcast.

the class MapStoreWriteBehindTest method writeBehindQueueSize.

private int writeBehindQueueSize(HazelcastInstance node, String mapName) {
    int size = 0;
    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 mapDataStore = recordStore.getMapDataStore();
        size += ((WriteBehindStore) mapDataStore).getWriteBehindQueue().size();
    }
    return size;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapDataStore(com.hazelcast.map.impl.mapstore.MapDataStore) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 5 with MapDataStore

use of com.hazelcast.map.impl.mapstore.MapDataStore in project hazelcast by hazelcast.

the class WriteBehindOnBackupsTest method writeBehindQueueSize.

public static int writeBehindQueueSize(HazelcastInstance node, String mapName) {
    int size = 0;
    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 mapDataStore = recordStore.getMapDataStore();
        if (mapDataStore instanceof WriteBehindStore) {
            size += ((WriteBehindStore) mapDataStore).getWriteBehindQueue().size();
        }
    }
    return size;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapDataStore(com.hazelcast.map.impl.mapstore.MapDataStore) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Aggregations

MapDataStore (com.hazelcast.map.impl.mapstore.MapDataStore)5 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)3 MapService (com.hazelcast.map.impl.MapService)2 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 WriteBehindStore (com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore)1 DelayedEntry (com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)1 DefaultRecordStore (com.hazelcast.map.impl.recordstore.DefaultRecordStore)1