Search in sources :

Example 1 with ListenerWrapperEventFilter

use of com.hazelcast.internal.services.ListenerWrapperEventFilter in project hazelcast by hazelcast.

the class EventServiceSegment method pingNotifiableEventListener.

/**
 * Notifies the registration of a event in the listener lifecycle.
 * The registration is checked for a {@link NotifiableEventListener} in this order :
 * <ul>
 * <li>first check if {@link Registration#getListener()} returns a {@link NotifiableEventListener}</li>
 * <li>otherwise check if the event filter wraps a listener and use that one</li>
 * </ul>
 *
 * @param topic        the event topic
 * @param registration the listener registration
 * @param register     if the listener was registered or not
 */
private void pingNotifiableEventListener(String topic, Registration registration, boolean register) {
    Object listener = registration.getListener();
    if (!(listener instanceof NotifiableEventListener)) {
        EventFilter filter = registration.getFilter();
        if (filter instanceof ListenerWrapperEventFilter) {
            listener = ((ListenerWrapperEventFilter) filter).getListener();
        }
    }
    pingNotifiableEventListenerInternal(listener, topic, registration, register);
    pingNotifiableEventListenerInternal(service, topic, registration, register);
}
Also used : ListenerWrapperEventFilter(com.hazelcast.internal.services.ListenerWrapperEventFilter) NotifiableEventListener(com.hazelcast.internal.services.NotifiableEventListener) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter) ListenerWrapperEventFilter(com.hazelcast.internal.services.ListenerWrapperEventFilter)

Aggregations

ListenerWrapperEventFilter (com.hazelcast.internal.services.ListenerWrapperEventFilter)1 NotifiableEventListener (com.hazelcast.internal.services.NotifiableEventListener)1 EventFilter (com.hazelcast.spi.impl.eventservice.EventFilter)1