use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class CacheAddPartitionLostListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
CachePartitionLostListener listener = event -> {
if (endpoint.isAlive()) {
ClientMessage eventMessage = CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
};
InternalCachePartitionLostListenerAdapter listenerAdapter = new InternalCachePartitionLostListenerAdapter(listener);
EventFilter filter = new CachePartitionLostEventFilter();
CacheService service = getService(CacheService.SERVICE_NAME);
EventService eventService = service.getNodeEngine().getEventService();
if (parameters.localOnly) {
return newCompletedFuture(eventService.registerLocalListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter).getId());
}
return eventService.registerListenerAsync(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter).thenApplyAsync(EventRegistration::getId, CALLER_RUNS);
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class ListAddListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
Data partitionKey = serializationService.toData(parameters.name);
ItemListener listener = createItemListener(endpoint, partitionKey);
EventService eventService = clientEngine.getEventService();
CollectionEventFilter filter = new CollectionEventFilter(parameters.includeValue);
if (parameters.localOnly) {
return newCompletedFuture(eventService.registerLocalListener(getServiceName(), parameters.name, filter, listener).getId());
}
return eventService.registerListenerAsync(getServiceName(), parameters.name, filter, listener).thenApplyAsync(EventRegistration::getId, CALLER_RUNS);
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class MapServiceContextImpl method addLocalListenerAdapter.
@Override
public UUID addLocalListenerAdapter(ListenerAdapter adapter, String mapName) {
EventService eventService = getNodeEngine().getEventService();
EventRegistration registration = eventService.registerLocalListener(MapService.SERVICE_NAME, mapName, adapter);
return registration.getId();
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class TxnSetOperation method runInternal.
@Override
protected void runInternal() {
recordStore.unlock(dataKey, ownerUuid, threadId, getCallId());
Record record = recordStore.getRecordOrNull(dataKey);
if (record == null || version == record.getVersion()) {
EventService eventService = getNodeEngine().getEventService();
if (eventService.hasEventRegistration(MapService.SERVICE_NAME, getName())) {
oldValue = record == null ? null : mapServiceContext.toData(record.getValue());
}
eventType = record == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
recordStore.setTxn(dataKey, dataValue, ttl, UNSET, transactionId);
shouldBackup = true;
}
}
use of com.hazelcast.spi.impl.eventservice.EventService in project hazelcast by hazelcast.
the class ReplicatedMapEventPublishingService method fireMapClearedEvent.
public void fireMapClearedEvent(int deletedEntrySize, String name) {
EventService eventService = nodeEngine.getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, name);
if (registrations.isEmpty()) {
return;
}
MapEventData mapEventData = new MapEventData(name, name, nodeEngine.getThisAddress(), EntryEventType.CLEAR_ALL.getType(), deletedEntrySize);
eventService.publishEvent(SERVICE_NAME, registrations, mapEventData, name.hashCode());
}
Aggregations