com.hazelcast.spi
Interface EventService

All Known Implementing Classes:
EventServiceImpl

public interface EventService

Component responsible for handling events like topic events or map.listener events.


Method Summary
 void deregisterAllListeners(String serviceName, String topic)
          Deregisters all listeners belonging to the given service and topic.
 boolean deregisterListener(String serviceName, String topic, Object id)
          Deregisters a listener with given registration id.
 void executeEventCallback(Runnable callback)
          Executes an event callback on a random event thread.
 int getEventQueueCapacity()
          Returns queue capacity per event thread.
 int getEventQueueSize()
          Returns current total event queue size.
 int getEventThreadCount()
          Returns event thread count.
 Collection<EventRegistration> getRegistrations(String serviceName, String topic)
          Returns all registrations belonging to the given service and topic.
 EventRegistration[] getRegistrationsAsArray(String serviceName, String topic)
          Returns all registrations belonging to the given service and topic as an array.
 boolean hasEventRegistration(String serviceName, String topic)
          Returns true if a listener is registered with specified service name and topic.
 void publishEvent(String serviceName, Collection<EventRegistration> registrations, Object event, int orderKey)
          Publishes an event for multiple event registrations.
 void publishEvent(String serviceName, EventRegistration registration, Object event, int orderKey)
          Publishes an event for a specific event registration.
 void publishEvent(String serviceName, String topic, Object event, int orderKey)
          Publishes an event for all event registrations belonging to specified service name and topic.
 EventRegistration registerListener(String serviceName, String topic, EventFilter filter, Object listener)
          Registers a listener on all cluster nodes.
 EventRegistration registerListener(String serviceName, String topic, Object listener)
          Registers a listener on all cluster nodes.
 EventRegistration registerLocalListener(String serviceName, String topic, EventFilter filter, Object listener)
          Registers a local only listener.
 EventRegistration registerLocalListener(String serviceName, String topic, Object listener)
          Registers a local only listener.
 

Method Detail

getEventThreadCount

int getEventThreadCount()
Returns event thread count.

Returns:
event thread count
See Also:
GroupProperties.PROP_EVENT_THREAD_COUNT

getEventQueueCapacity

int getEventQueueCapacity()
Returns queue capacity per event thread.

Returns:
queue capacity per event thread
See Also:
GroupProperties.PROP_EVENT_QUEUE_CAPACITY

getEventQueueSize

int getEventQueueSize()
Returns current total event queue size.

Returns:
total event queue size

registerLocalListener

EventRegistration registerLocalListener(String serviceName,
                                        String topic,
                                        Object listener)
Registers a local only listener.

Parameters:
serviceName - service name
topic - topic name
listener - listener instance
Returns:
event registration

registerLocalListener

EventRegistration registerLocalListener(String serviceName,
                                        String topic,
                                        EventFilter filter,
                                        Object listener)
Registers a local only listener.

Parameters:
serviceName - service name
topic - topic name
filter - event filter
listener - listener instance
Returns:
event registration

registerListener

EventRegistration registerListener(String serviceName,
                                   String topic,
                                   Object listener)
Registers a listener on all cluster nodes.

Parameters:
serviceName - service name
topic - topic name
listener - listener instance
Returns:
event registration

registerListener

EventRegistration registerListener(String serviceName,
                                   String topic,
                                   EventFilter filter,
                                   Object listener)
Registers a listener on all cluster nodes.

Parameters:
serviceName - service name
topic - topic name
filter - event filter
listener - listener instance
Returns:
event registration

deregisterListener

boolean deregisterListener(String serviceName,
                           String topic,
                           Object id)
Deregisters a listener with given registration id.

Parameters:
serviceName - service name
topic - topic name
id - registration id
Returns:
true if listener is deregistered successfully, false otherwise
See Also:
EventRegistration.getId(), registerListener(String, String, Object), registerLocalListener(String, String, Object)

deregisterAllListeners

void deregisterAllListeners(String serviceName,
                            String topic)
Deregisters all listeners belonging to the given service and topic.

Parameters:
serviceName - service name
topic - topic name

getRegistrations

Collection<EventRegistration> getRegistrations(String serviceName,
                                               String topic)
Returns all registrations belonging to the given service and topic.

Parameters:
serviceName - service name
topic - topic name
Returns:
registrations

getRegistrationsAsArray

EventRegistration[] getRegistrationsAsArray(String serviceName,
                                            String topic)
Returns all registrations belonging to the given service and topic as an array.

Parameters:
serviceName - service name
topic - topic name
Returns:
registrations array

hasEventRegistration

boolean hasEventRegistration(String serviceName,
                             String topic)
Returns true if a listener is registered with specified service name and topic.

Parameters:
serviceName - service name
topic - topic name
Returns:
true if a listener is registered with specified service name and topic, false otherwise.

publishEvent

void publishEvent(String serviceName,
                  String topic,
                  Object event,
                  int orderKey)
Publishes an event for all event registrations belonging to specified service name and topic.

Parameters:
serviceName - service name
topic - topic name
event - event object
orderKey - order key

publishEvent

void publishEvent(String serviceName,
                  EventRegistration registration,
                  Object event,
                  int orderKey)
Publishes an event for a specific event registration.

Parameters:
serviceName - service name
registration - event registration
event - event object
orderKey - order key

publishEvent

void publishEvent(String serviceName,
                  Collection<EventRegistration> registrations,
                  Object event,
                  int orderKey)
Publishes an event for multiple event registrations.

Parameters:
serviceName - service name
registrations - multiple event registrations
event - event object
orderKey - order key

executeEventCallback

void executeEventCallback(Runnable callback)
Executes an event callback on a random event thread.

If callback is an instance of StripedRunnable, then StripedRunnable.getKey() will be used as order key to pick event thread.

Parameters:
callback - callback to execute
See Also:
StripedRunnable


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.