use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class CacheGetInvalidationMetaDataOperation method getPartitionMetaDataGenerator.
private MetaDataGenerator getPartitionMetaDataGenerator() {
CacheService cacheService = getService();
CacheEventHandler cacheEventHandler = cacheService.getCacheEventHandler();
return cacheEventHandler.getMetaDataGenerator();
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class CacheAddNearCacheInvalidationListenerTask method call.
@Override
protected Object call() {
ClientEndpoint endpoint = getEndpoint();
CacheService cacheService = getService(CacheService.SERVICE_NAME);
CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name);
NearCacheInvalidationListener listener = new NearCacheInvalidationListener(endpoint, cacheContext, nodeEngine.getLocalMember().getUuid());
String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly);
endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class CacheAddPartitionLostListenerMessageTask method call.
@Override
protected Object call() {
final ClientEndpoint endpoint = getEndpoint();
CachePartitionLostListener listener = new CachePartitionLostListener() {
@Override
public void partitionLost(CachePartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage = CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
}
};
InternalCachePartitionLostListenerAdapter listenerAdapter = new InternalCachePartitionLostListenerAdapter(listener);
EventFilter filter = new CachePartitionLostEventFilter();
CacheService service = getService(CacheService.SERVICE_NAME);
EventService eventService = service.getNodeEngine().getEventService();
EventRegistration registration;
if (parameters.localOnly) {
registration = eventService.registerLocalListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter);
} else {
registration = eventService.registerListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter);
}
String registrationId = registration.getId();
endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class CacheSizeMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
int total = 0;
CacheService service = getService(getServiceName());
for (Object result : map.values()) {
Integer size = (Integer) service.toObject(result);
total += size;
}
return total;
}
use of com.hazelcast.cache.impl.CacheService in project hazelcast by hazelcast.
the class Pre38CacheAddInvalidationListenerTask method call.
@Override
protected Object call() {
ClientEndpoint endpoint = getEndpoint();
CacheService cacheService = getService(CacheService.SERVICE_NAME);
CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name);
Pre38NearCacheInvalidationListener listener = new Pre38NearCacheInvalidationListener(endpoint, cacheContext, nodeEngine.getLocalMember().getUuid());
String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly);
endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
Aggregations