Search in sources :

Example 21 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter 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

EventFilter (com.hazelcast.spi.impl.eventservice.EventFilter)21 EntryEventFilter (com.hazelcast.map.impl.EntryEventFilter)7 EventRegistration (com.hazelcast.spi.impl.eventservice.EventRegistration)7 TrueEventFilter (com.hazelcast.spi.impl.eventservice.impl.TrueEventFilter)6 QueryEventFilter (com.hazelcast.map.impl.query.QueryEventFilter)5 ListenerAdapters.createListenerAdapter (com.hazelcast.map.impl.ListenerAdapters.createListenerAdapter)3 QueryCacheEventService (com.hazelcast.map.impl.querycache.QueryCacheEventService)3 ReplicatedEntryEventFilter (com.hazelcast.replicatedmap.impl.record.ReplicatedEntryEventFilter)3 ReplicatedQueryEventFilter (com.hazelcast.replicatedmap.impl.record.ReplicatedQueryEventFilter)3 Nonnull (javax.annotation.Nonnull)3 CachePartitionLostEventFilter (com.hazelcast.cache.impl.event.CachePartitionLostEventFilter)2 InternalCachePartitionLostListenerAdapter (com.hazelcast.cache.impl.event.InternalCachePartitionLostListenerAdapter)2 Data (com.hazelcast.internal.serialization.Data)2 MapPartitionLostEventFilter (com.hazelcast.map.impl.MapPartitionLostEventFilter)2 UUID (java.util.UUID)2 CacheService (com.hazelcast.cache.impl.CacheService)1 ICacheService (com.hazelcast.cache.impl.ICacheService)1 CachePartitionLostListener (com.hazelcast.cache.impl.event.CachePartitionLostListener)1 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1 CacheAddPartitionLostListenerCodec (com.hazelcast.client.impl.protocol.codec.CacheAddPartitionLostListenerCodec)1