Examples of EventService


Examples of com.hazelcast.spi.EventService

        return clientEngine.getClients();
    }

    @Override
    public String addClientListener(ClientListener clientListener) {
        EventService eventService = nodeEngine.getEventService();
        EventRegistration registration = eventService
                .registerLocalListener(ClientEngineImpl.SERVICE_NAME, ClientEngineImpl.SERVICE_NAME, clientListener);
        return registration.getId();
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

        return registration.getId();
    }

    @Override
    public boolean removeClientListener(String registrationId) {
        final EventService eventService = nodeEngine.getEventService();
        return eventService.deregisterListener(ClientEngineImpl.SERVICE_NAME,
                ClientEngineImpl.SERVICE_NAME, registrationId);
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

    public final void publishEntryEvent(String multiMapName, EntryEventType eventType, Data key, Object value) {
        publisher.publishEntryEvent(multiMapName, eventType, key, value);
    }

    public String addListener(String name, EventListener listener, Data key, boolean includeValue, boolean local) {
        EventService eventService = nodeEngine.getEventService();
        EventRegistration registration;
        final MultiMapEventFilter filter = new MultiMapEventFilter(includeValue, key);
        if (local) {
            registration = eventService.registerLocalListener(SERVICE_NAME, name, filter, listener);
        } else {
            registration = eventService.registerListener(SERVICE_NAME, name, filter, listener);
        }
        return registration.getId();
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

        }
        return registration.getId();
    }

    public boolean removeListener(String name, String registrationId) {
        EventService eventService = nodeEngine.getEventService();
        return eventService.deregisterListener(SERVICE_NAME, name, registrationId);
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

                        }
                    }
                });
            }
        }
        final EventService eventService = nodeEngine.getEventService();
        Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, SERVICE_NAME);
        for (EventRegistration reg : registrations) {
            eventService.publishEvent(SERVICE_NAME, reg, membershipEvent, reg.getId().hashCode());
        }
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

                        service.memberAttributeChanged(event);
                    }
                });
            }
        }
        final EventService eventService = nodeEngine.getEventService();
        Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, SERVICE_NAME);
        for (EventRegistration reg : registrations) {
            eventService.publishEvent(SERVICE_NAME, reg, memberAttributeEvent, reg.getId().hashCode());
        }
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

        this.nodeEngine = nodeEngine;
    }

    public void publishMultiMapEvent(String mapName, EntryEventType eventType,
                                     int numberOfEntriesAffected) {
        final EventService eventService = nodeEngine.getEventService();
        final Collection<EventRegistration> registrations =
                eventService.getRegistrations(MultiMapService.SERVICE_NAME, mapName);
        if (registrations.isEmpty()) {
            return;
        }
        final Address caller = nodeEngine.getThisAddress();
        final String source = caller.toString();
        final MapEventData mapEventData =
                new MapEventData(source, mapName, caller, eventType.getType(), numberOfEntriesAffected);
        eventService.publishEvent(MultiMapService.SERVICE_NAME, registrations, mapEventData, mapName.hashCode());

    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

        eventService.publishEvent(MultiMapService.SERVICE_NAME, registrations, mapEventData, mapName.hashCode());

    }

    public final void publishEntryEvent(String multiMapName, EntryEventType eventType, Data key, Object value) {
        EventService eventService = nodeEngine.getEventService();
        Collection<EventRegistration> registrations =
                eventService.getRegistrations(MultiMapService.SERVICE_NAME, multiMapName);
        for (EventRegistration registration : registrations) {
            MultiMapEventFilter filter = (MultiMapEventFilter) registration.getFilter();
            if (filter.getKey() == null || filter.getKey().equals(key)) {
                Data dataValue = filter.isIncludeValue() ? nodeEngine.toData(value) : null;
                final Address caller = nodeEngine.getThisAddress();
                final String source = caller.toString();
                EntryEventData event =
                        new EntryEventData(source, multiMapName, caller, key, dataValue, null, eventType.getType());
                eventService.publishEvent(MultiMapService.SERVICE_NAME, registration, event, multiMapName.hashCode());
            }
        }
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

        this.serviceName = serviceName;
    }

    public Object call() throws Exception {
        final ClientEngine clientEngine = getClientEngine();
        final EventService eventService = clientEngine.getEventService();
        return eventService.deregisterListener(serviceName, name, registrationId);
    }
View Full Code Here

Examples of com.hazelcast.spi.EventService

                    PortableItemEvent portableItemEvent = new PortableItemEvent(item, eventType, uuid);
                    endpoint.sendEvent(portableItemEvent, getCallId());
                }
            }
        };
        final EventService eventService = clientEngine.getEventService();
        final CollectionEventFilter filter = new CollectionEventFilter(includeValue);
        final EventRegistration registration = eventService.registerListener(getServiceName(), name, filter, listener);
        final String registrationId = registration.getId();
        endpoint.setListenerRegistration(getServiceName(), name, registrationId);
        return registrationId;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.