use of com.hazelcast.map.impl.ListenerAdapter in project hazelcast by hazelcast.
the class AbstractQueryCacheEndToEndConstructor method createSubscriberAccumulator.
@Override
public final void createSubscriberAccumulator(AccumulatorInfo info) {
QueryCacheEventService eventService = context.getQueryCacheEventService();
ListenerAdapter listener = new SubscriberListener(context, info);
publisherListenerId = eventService.addPublisherListener(info.getMapName(), info.getCacheId(), listener);
queryCache.setPublisherListenerId(publisherListenerId);
}
use of com.hazelcast.map.impl.ListenerAdapter in project hazelcast by hazelcast.
the class InternalQueryCacheListenerAdapter method callListener.
private void callListener(IMapEvent event, int eventType) {
int adapterIndex = Integer.numberOfTrailingZeros(eventType);
ListenerAdapter listenerAdapter = listenerAdapters[adapterIndex];
if (listenerAdapter == null) {
return;
}
listenerAdapter.onEvent(event);
}
use of com.hazelcast.map.impl.ListenerAdapter in project hazelcast by hazelcast.
the class NodeQueryCacheEventService method addListener.
@Override
public UUID addListener(String mapName, String cacheId, MapListener listener, EventFilter filter) {
checkHasText(mapName, "mapName");
checkHasText(cacheId, "cacheId");
checkNotNull(listener, "listener cannot be null");
ListenerAdapter queryCacheListenerAdaptor = createQueryCacheListenerAdaptor(listener);
ListenerAdapter listenerAdaptor = new SimpleQueryCacheListenerAdapter(queryCacheListenerAdaptor);
ContextMutexFactory.Mutex mutex = lifecycleMutexFactory.mutexFor(mapName);
try {
synchronized (mutex) {
EventRegistration registration = eventService.registerLocalListener(SERVICE_NAME, cacheId, filter == null ? TrueEventFilter.INSTANCE : filter, listenerAdaptor);
return registration.getId();
}
} finally {
closeResource(mutex);
}
}
use of com.hazelcast.map.impl.ListenerAdapter in project hazelcast by hazelcast.
the class QueryCacheEventListenerAdapters method createQueryCacheListenerAdapters.
static ListenerAdapter[] createQueryCacheListenerAdapters(MapListener mapListener) {
ListenerAdapter[] mapListenerAdapters = MapListenerAdaptors.createListenerAdapters(mapListener);
ListenerAdapter eventLostAdapter = EVENT_LOST_LISTENER_ADAPTER.createNew(mapListener);
ListenerAdapter[] adapters = new ListenerAdapter[mapListenerAdapters.length + 1];
System.arraycopy(mapListenerAdapters, 0, adapters, 0, mapListenerAdapters.length);
adapters[mapListenerAdapters.length] = eventLostAdapter;
return adapters;
}
use of com.hazelcast.map.impl.ListenerAdapter in project hazelcast by hazelcast.
the class EntryEventDataCacheTest method createInvalidationEventRejectingFilter.
private static EventListenerFilter createInvalidationEventRejectingFilter() {
ListenerAdapter listenerAdapter = createListenerAdapter(new EntryAddedListener() {
@Override
public void entryAdded(EntryEvent event) {
}
});
int flags = setAndGetListenerFlags(listenerAdapter);
return new EventListenerFilter(flags, TrueEventFilter.INSTANCE);
}
Aggregations