use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.
the class MapProxyImpl method submitToKey.
@Override
public ICompletableFuture submitToKey(K key, EntryProcessor entryProcessor) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
MapService service = getService();
Data keyData = toData(key, partitionStrategy);
InternalCompletableFuture f = executeOnKeyInternal(keyData, entryProcessor, null);
return new DelegatingFuture(f, service.getMapServiceContext().getNodeEngine().getSerializationService());
}
use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.
the class ClientMapPartitionLostListenerTest method test_mapPartitionLostListener_invoked_fromOtherNode.
@Test
public void test_mapPartitionLostListener_invoked_fromOtherNode() {
final String mapName = randomMapName();
final Config config = new Config();
config.getMapConfig(mapName).setBackupCount(0);
final HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance(config);
final HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance(config);
final ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setSmartRouting(false);
final HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
final Address clientOwnerAddress = clientInstanceImpl.getClientClusterService().getOwnerConnectionAddress();
final HazelcastInstance other = getAddress(instance1).equals(clientOwnerAddress) ? instance2 : instance1;
final TestEventCollectingMapPartitionLostListener listener = new TestEventCollectingMapPartitionLostListener(0);
client.getMap(mapName).addPartitionLostListener(listener);
assertRegistrationEventually(instance1, mapName, true);
assertRegistrationEventually(instance2, mapName, true);
assertProxyExistsEventually(instance1, mapName);
assertProxyExistsEventually(instance2, mapName);
final MapService mapService = getNode(other).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
mapService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
assertMapPartitionLostEventEventually(listener, partitionId);
}
use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.
the class ClientMapPartitionLostListenerTest method test_mapPartitionLostListener_invoked.
@Test
public void test_mapPartitionLostListener_invoked() {
final String mapName = randomMapName();
final Config config = new Config();
config.getMapConfig(mapName).setBackupCount(0);
final HazelcastInstance instance = hazelcastFactory.newHazelcastInstance(config);
final HazelcastInstance client = hazelcastFactory.newHazelcastClient();
warmUpPartitions(instance, client);
final TestEventCollectingMapPartitionLostListener listener = new TestEventCollectingMapPartitionLostListener(0);
client.getMap(mapName).addPartitionLostListener(listener);
final MapService mapService = getNode(instance).getNodeEngine().getService(MapService.SERVICE_NAME);
final int partitionId = 5;
mapService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
assertMapPartitionLostEventEventually(listener, partitionId);
}
use of com.hazelcast.map.impl.MapService 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.MapService 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);
}
Aggregations