use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class CacheGetAllMessageTask method createOperationFactory.
@Override
protected OperationFactory createOperationFactory() {
CacheOperationProvider operationProvider = getOperationProvider(parameters.name);
CacheService service = getService(getServiceName());
ExpiryPolicy expiryPolicy = (ExpiryPolicy) service.toObject(parameters.expiryPolicy);
Set<Data> keys = new HashSet<Data>(parameters.keys);
return operationProvider.createGetAllOperationFactory(keys, expiryPolicy);
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class InvalidationMetadataDistortionTest method distortRandomPartitionSequence.
private void distortRandomPartitionSequence(String mapName, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
CacheService service = nodeEngineImpl.getService(CacheService.SERVICE_NAME);
CacheEventHandler cacheEventHandler = service.getCacheEventHandler();
MetaDataGenerator metaDataGenerator = cacheEventHandler.getMetaDataGenerator();
InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
int partitionCount = partitionService.getPartitionCount();
int randomPartition = getInt(partitionCount);
int randomSequence = getInt(MAX_VALUE);
metaDataGenerator.setCurrentSequence(mapName, randomPartition, randomSequence);
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class ClientCachePartitionLostListenerTest method test_cachePartitionLostListener_invoked_fromOtherNode.
@Test
public void test_cachePartitionLostListener_invoked_fromOtherNode() {
final String cacheName = randomName();
HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance();
HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance();
final HazelcastInstance client = hazelcastFactory.newHazelcastClient();
final HazelcastServerCachingProvider cachingProvider = createCachingProvider(instance1);
final CacheManager cacheManager = cachingProvider.getCacheManager();
final CacheConfig<Integer, String> config = new CacheConfig<Integer, String>();
config.setBackupCount(0);
cacheManager.createCache(cacheName, config);
final CachingProvider clientCachingProvider = HazelcastClientCachingProvider.createCachingProvider(client);
final CacheManager clientCacheManager = clientCachingProvider.getCacheManager();
final Cache<Integer, String> cache = clientCacheManager.getCache(cacheName);
final ICache iCache = cache.unwrap(ICache.class);
final EventCollectingCachePartitionLostListener listener = new EventCollectingCachePartitionLostListener();
iCache.addPartitionLostListener(listener);
assertRegistrationsSizeEventually(instance1, cacheName, 1);
assertRegistrationsSizeEventually(instance2, cacheName, 1);
final CacheService cacheService1 = getNode(instance1).getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheService cacheService2 = getNode(instance2).getNodeEngine().getService(CacheService.SERVICE_NAME);
final int partitionId = 5;
cacheService1.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
cacheService2.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
assertCachePartitionLostEventEventually(listener, partitionId);
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcherTest method distortRandomPartitionSequence.
private void distortRandomPartitionSequence(String cacheName, int partition, long sequence, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
CacheService service = nodeEngineImpl.getService(SERVICE_NAME);
CacheEventHandler cacheEventHandler = service.getCacheEventHandler();
MetaDataGenerator metaDataGenerator = cacheEventHandler.getMetaDataGenerator();
metaDataGenerator.setCurrentSequence(cacheName, partition, sequence);
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcherTest method distortRandomPartitionUuid.
private void distortRandomPartitionUuid(int partition, UUID uuid, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
CacheService service = nodeEngineImpl.getService(SERVICE_NAME);
CacheEventHandler cacheEventHandler = service.getCacheEventHandler();
MetaDataGenerator metaDataGenerator = cacheEventHandler.getMetaDataGenerator();
metaDataGenerator.setUuid(partition, uuid);
}
Aggregations