use of com.hazelcast.cache.impl.ICacheService in project hazelcast by hazelcast.
the class CacheDestroyOperation method run.
@Override
public void run() throws Exception {
ICacheService service = getService();
service.deleteCache(name, getCallerUuid(), true);
if (!isLocal) {
destroyCacheOnAllMembers(name, getCallerUuid());
}
}
use of com.hazelcast.cache.impl.ICacheService in project hazelcast by hazelcast.
the class CacheGetAllOperation method run.
public void run() {
ICacheService service = getService();
ICacheRecordStore cache = service.getOrCreateRecordStore(name, getPartitionId());
int partitionId = getPartitionId();
Set<Data> partitionKeySet = new HashSet<Data>();
for (Data key : keys) {
if (partitionId == getNodeEngine().getPartitionService().getPartitionId(key)) {
partitionKeySet.add(key);
}
}
response = cache.getAll(partitionKeySet, expiryPolicy);
}
use of com.hazelcast.cache.impl.ICacheService in project hazelcast by hazelcast.
the class CacheReplicationOperation method run.
@Override
public void run() throws Exception {
ICacheService service = getService();
for (Map.Entry<String, Map<Data, CacheRecord>> entry : data.entrySet()) {
ICacheRecordStore cache = service.getOrCreateRecordStore(entry.getKey(), getPartitionId());
cache.clear();
Map<Data, CacheRecord> map = entry.getValue();
Iterator<Map.Entry<Data, CacheRecord>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Data, CacheRecord> next = iterator.next();
Data key = next.getKey();
CacheRecord record = next.getValue();
iterator.remove();
cache.putRecord(key, record);
}
}
data.clear();
if (getReplicaIndex() == 0) {
nearCacheStateHolder.applyState();
}
}
use of com.hazelcast.cache.impl.ICacheService in project hazelcast by hazelcast.
the class ServiceManagerImpl method registerCacheServiceIfAvailable.
private void registerCacheServiceIfAvailable() {
//search for jcache api jar on classpath
if (JCacheDetector.isJCacheAvailable(nodeEngine.getConfigClassLoader(), logger)) {
ICacheService service = createService(ICacheService.class);
registerService(ICacheService.SERVICE_NAME, service);
} else {
logger.finest("javax.cache api is not detected on classpath. Skipping CacheService...");
}
}
use of com.hazelcast.cache.impl.ICacheService in project hazelcast by hazelcast.
the class CacheConfigTest method testGetCacheConfigsAtJoin.
@Test
public void testGetCacheConfigsAtJoin() {
final String cacheName = randomString();
final String managerPrefix = "hz:";
final String fullCacheName = managerPrefix + cacheName;
final Config config = new Config();
final CacheConfig cacheConfig = new CacheConfig().setName(cacheName).setManagerPrefix(managerPrefix);
final TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(2);
final HazelcastInstance instance1 = instanceFactory.newHazelcastInstance(config);
final ICacheService cacheService1 = getCacheService(instance1);
assertNull(cacheService1.getCacheConfig(fullCacheName));
cacheService1.putCacheConfigIfAbsent(cacheConfig);
assertNotNull(cacheService1.getCacheConfig(fullCacheName));
final HazelcastInstance instance2 = instanceFactory.newHazelcastInstance(config);
final ICacheService cacheService2 = getCacheService(instance2);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertNotNull(cacheService2.getCacheConfig(fullCacheName));
}
});
}
Aggregations