Search in sources :

Example 1 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter in project hazelcast by hazelcast.

the class AbstractMapAddEntryListenerMessageTask method processInternal.

@Override
protected CompletableFuture<UUID> processInternal() {
    final MapService mapService = getService(MapService.SERVICE_NAME);
    Object listener = newMapListener();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    String name = getDistributedObjectName();
    EventFilter eventFilter = getEventFilter();
    if (isLocalOnly()) {
        return newCompletedFuture(mapServiceContext.addLocalEventListener(listener, eventFilter, name));
    }
    return mapServiceContext.addEventListenerAsync(listener, eventFilter, name);
}
Also used : MapService(com.hazelcast.map.impl.MapService) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 2 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter in project hazelcast by hazelcast.

the class DefaultQueryCache method addEntryListener.

@Override
public UUID addEntryListener(MapListener listener, Predicate<K, V> predicate, boolean includeValue) {
    checkNotNull(listener, "listener cannot be null");
    checkNotNull(predicate, "predicate cannot be null");
    QueryCacheEventService eventService = getEventService();
    EventFilter filter = new QueryEventFilter(null, predicate, includeValue);
    String mapName = delegate.getName();
    return eventService.addListener(mapName, cacheId, listener, filter);
}
Also used : QueryCacheEventService(com.hazelcast.map.impl.querycache.QueryCacheEventService) QueryEventFilter(com.hazelcast.map.impl.query.QueryEventFilter) EntryEventFilter(com.hazelcast.map.impl.EntryEventFilter) QueryEventFilter(com.hazelcast.map.impl.query.QueryEventFilter) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter)

Example 3 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter in project hazelcast by hazelcast.

the class DefaultQueryCache method addEntryListener.

@Override
public UUID addEntryListener(MapListener listener, Predicate<K, V> predicate, K key, boolean includeValue) {
    checkNotNull(listener, "listener cannot be null");
    checkNotNull(predicate, "predicate cannot be null");
    checkNotNull(key, "key cannot be null");
    QueryCacheEventService eventService = getEventService();
    EventFilter filter = new QueryEventFilter(toData(key), predicate, includeValue);
    String mapName = delegate.getName();
    return eventService.addListener(mapName, cacheId, listener, filter);
}
Also used : QueryCacheEventService(com.hazelcast.map.impl.querycache.QueryCacheEventService) QueryEventFilter(com.hazelcast.map.impl.query.QueryEventFilter) EntryEventFilter(com.hazelcast.map.impl.EntryEventFilter) QueryEventFilter(com.hazelcast.map.impl.query.QueryEventFilter) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter)

Example 4 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter in project hazelcast by hazelcast.

the class NearCachedMapProxyImpl method addNearCacheInvalidationListener.

public UUID addNearCacheInvalidationListener(InvalidationListener listener) {
    // local member UUID may change after a split-brain merge
    UUID localMemberUuid = getNodeEngine().getClusterService().getLocalMember().getUuid();
    EventFilter eventFilter = new UuidFilter(localMemberUuid);
    return mapServiceContext.addEventListener(listener, eventFilter, name);
}
Also used : UuidFilter(com.hazelcast.map.impl.nearcache.invalidation.UuidFilter) UUID(java.util.UUID) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter)

Example 5 with EventFilter

use of com.hazelcast.spi.impl.eventservice.EventFilter in project hazelcast by hazelcast.

the class ReplicatedMapProxy method addEntryListener.

@Nonnull
@Override
public UUID addEntryListener(@Nonnull EntryListener<K, V> listener, @Nonnull Predicate<K, V> predicate) {
    checkNotNull(listener, NULL_LISTENER_IS_NOT_ALLOWED);
    checkNotNull(predicate, NULL_PREDICATE_IS_NOT_ALLOWED);
    EventFilter eventFilter = new ReplicatedQueryEventFilter(null, predicate);
    return eventPublishingService.addLocalEventListener(listener, eventFilter, name);
}
Also used : ReplicatedQueryEventFilter(com.hazelcast.replicatedmap.impl.record.ReplicatedQueryEventFilter) ReplicatedQueryEventFilter(com.hazelcast.replicatedmap.impl.record.ReplicatedQueryEventFilter) TrueEventFilter(com.hazelcast.spi.impl.eventservice.impl.TrueEventFilter) ReplicatedEntryEventFilter(com.hazelcast.replicatedmap.impl.record.ReplicatedEntryEventFilter) EventFilter(com.hazelcast.spi.impl.eventservice.EventFilter) Nonnull(javax.annotation.Nonnull)

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