use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method assertRegistrationsSizeEventually.
private void assertRegistrationsSizeEventually(final HazelcastInstance instance, final int size) {
assertTrueEventually(() -> {
final EventService eventService = getNode(instance).getNodeEngine().getEventService();
final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, PARTITION_LOST_EVENT_TOPIC);
assertEquals(size, registrations.size());
});
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class CollectionOperation method publishEvent.
protected void publishEvent(ItemEventType eventType, Data data) {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
final Address address = getNodeEngine().getThisAddress();
for (EventRegistration registration : registrations) {
CollectionEventFilter filter = (CollectionEventFilter) registration.getFilter();
final boolean includeValue = filter.isIncludeValue();
CollectionEvent event = new CollectionEvent(name, includeValue ? data : null, eventType, address);
eventService.publishEvent(getServiceName(), registration, event, name.hashCode());
}
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class QueueService method addLocalItemListener.
public UUID addLocalItemListener(String name, ItemListener listener, boolean includeValue) {
EventService eventService = nodeEngine.getEventService();
QueueEventFilter filter = new QueueEventFilter(includeValue);
return eventService.registerLocalListener(QueueService.SERVICE_NAME, name, filter, listener).getId();
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class QueueOperation method publishEvent.
public void publishEvent(ItemEventType eventType, Data data) {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
Address thisAddress = getNodeEngine().getThisAddress();
for (EventRegistration registration : registrations) {
QueueEventFilter filter = (QueueEventFilter) registration.getFilter();
QueueEvent event = new QueueEvent(name, filter.isIncludeValue() ? data : null, eventType, thisAddress);
eventService.publishEvent(getServiceName(), registration, event, name.hashCode());
}
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class QueueOperation method hasListener.
public boolean hasListener() {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
return registrations.size() > 0;
}
Aggregations