use of com.hazelcast.spi.EventService in project hazelcast by hazelcast.
the class CacheEventHandler method publishEvent.
void publishEvent(String cacheName, CacheEventSet eventSet, int orderKey) {
final EventService eventService = nodeEngine.getEventService();
final Collection<EventRegistration> candidates = eventService.getRegistrations(SERVICE_NAME, cacheName);
if (candidates.isEmpty()) {
return;
}
eventService.publishEvent(SERVICE_NAME, candidates, eventSet, orderKey);
}
use of com.hazelcast.spi.EventService in project hazelcast by hazelcast.
the class ClientServiceProxy method addClientListener.
@Override
public String addClientListener(ClientListener clientListener) {
checkNotNull(clientListener, "clientListener should not be null");
EventService eventService = nodeEngine.getEventService();
EventRegistration registration = eventService.registerLocalListener(ClientEngineImpl.SERVICE_NAME, ClientEngineImpl.SERVICE_NAME, clientListener);
return registration.getId();
}
use of com.hazelcast.spi.EventService in project hazelcast by hazelcast.
the class ClientServiceProxy method removeClientListener.
@Override
public boolean removeClientListener(String registrationId) {
checkNotNull(registrationId, "registrationId should not be null");
EventService eventService = nodeEngine.getEventService();
return eventService.deregisterListener(ClientEngineImpl.SERVICE_NAME, ClientEngineImpl.SERVICE_NAME, registrationId);
}
use of com.hazelcast.spi.EventService in project hazelcast by hazelcast.
the class ClientEngineImpl method sendClientEvent.
private void sendClientEvent(ClientEvent event) {
final EventService eventService = nodeEngine.getEventService();
final Collection<EventRegistration> regs = eventService.getRegistrations(SERVICE_NAME, SERVICE_NAME);
String uuid = event.getUuid();
eventService.publishEvent(SERVICE_NAME, regs, event, uuid.hashCode());
}
use of com.hazelcast.spi.EventService in project hazelcast by hazelcast.
the class AbstractCacheService method publishCachePartitionLostEvent.
protected void publishCachePartitionLostEvent(String cacheName, int partitionId) {
Collection<EventRegistration> registrations = new LinkedList<EventRegistration>();
for (EventRegistration registration : getRegistrations(cacheName)) {
if (registration.getFilter() instanceof CachePartitionLostEventFilter) {
registrations.add(registration);
}
}
if (registrations.isEmpty()) {
return;
}
Member member = nodeEngine.getLocalMember();
CacheEventData eventData = new CachePartitionEventData(cacheName, partitionId, member);
EventService eventService = nodeEngine.getEventService();
eventService.publishEvent(SERVICE_NAME, registrations, eventData, partitionId);
}
Aggregations