use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class MapReplicationStateHolder method prepare.
void prepare(PartitionContainer container, int replicaIndex) {
data = new HashMap<String, Set<RecordReplicationInfo>>(container.getMaps().size());
loaded = new HashMap<String, Boolean>(container.getMaps().size());
for (Map.Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
RecordStore recordStore = entry.getValue();
MapContainer mapContainer = recordStore.getMapContainer();
MapConfig mapConfig = mapContainer.getMapConfig();
if (mapConfig.getTotalBackupCount() < replicaIndex) {
continue;
}
MapServiceContext mapServiceContext = mapContainer.getMapServiceContext();
String mapName = entry.getKey();
loaded.put(mapName, recordStore.isLoaded());
// now prepare data to migrate records
Set<RecordReplicationInfo> recordSet = new HashSet<RecordReplicationInfo>(recordStore.size());
final Iterator<Record> iterator = recordStore.iterator();
while (iterator.hasNext()) {
Record record = iterator.next();
Data key = record.getKey();
RecordReplicationInfo recordReplicationInfo = mapReplicationOperation.createRecordReplicationInfo(key, record, mapServiceContext);
recordSet.add(recordReplicationInfo);
}
data.put(mapName, recordSet);
}
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class ClearExpiredOperation method run.
@Override
public void run() throws Exception {
final MapService mapService = getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId());
final ConcurrentMap<String, RecordStore> recordStores = partitionContainer.getMaps();
final boolean backup = !isOwner();
for (final RecordStore recordStore : recordStores.values()) {
if (recordStore.size() > 0 && recordStore.isExpirable()) {
recordStore.evictExpiredEntries(expirationPercentage, backup);
recordStore.disposeDeferredBlocks();
}
}
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class MemberMapMetaDataFetcherTest method distortRandomPartitionUuid.
private void distortRandomPartitionUuid(int partition, UUID uuid, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
Invalidator invalidator = mapNearCacheManager.getInvalidator();
MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
metaDataGenerator.setUuid(partition, uuid);
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class MemberMapMetaDataFetcherTest method getRepairingTask.
private RepairingTask getRepairingTask(String mapName, int partition, long givenSequence, UUID givenUuid) {
Config config = new Config();
config.getMapConfig(mapName).setNearCacheConfig(new NearCacheConfig());
HazelcastInstance member = factory.newHazelcastInstance(config);
MapService mapService = getNodeEngineImpl(member).getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
distortRandomPartitionSequence(mapName, partition, givenSequence, member);
distortRandomPartitionUuid(partition, givenUuid, member);
member.getMap(mapName);
return mapServiceContext.getMapNearCacheManager().getRepairingTask();
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class MemberMapMetaDataFetcherTest method distortRandomPartitionSequence.
private void distortRandomPartitionSequence(String mapName, int partition, long sequence, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
Invalidator invalidator = mapNearCacheManager.getInvalidator();
MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
metaDataGenerator.setCurrentSequence(mapName, partition, sequence);
}
Aggregations