public class EventServiceImpl extends Object implements InternalEventService
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_SYNC_FREQUENCY_PROP |
Constructor and Description |
---|
EventServiceImpl(NodeEngineImpl nodeEngine) |
Modifier and Type | Method and Description |
---|---|
void |
close(EventRegistration eventRegistration)
Closes an EventRegistration.
|
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 the given registration id.
|
void |
executeEventCallback(Runnable callback)
Executes an event callback on a random event thread.
|
int |
getEventQueueCapacity()
Returns the queue capacity per event thread.
|
int |
getEventQueueSize()
Returns the current total event queue size.
|
int |
getEventThreadCount()
Returns the event thread count.
|
PostJoinRegistrationOperation |
getPostJoinOperation() |
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.
|
EventServiceSegment |
getSegment(String service,
boolean forceCreate) |
void |
handle(Packet packet)
Signals the PacketHandler that there is a packet to be handled.
|
boolean |
handleRegistration(Registration reg) |
boolean |
hasEventRegistration(String serviceName,
String topic)
Returns true if a listener is registered with the specified service name and topic.
|
void |
onMemberLeft(MemberImpl member) |
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 the specified service name and topic.
|
void |
publishRemoteEvent(String serviceName,
Collection<EventRegistration> registrations,
Object event,
int orderKey)
Publishes an event for multiple event registrations, excluding local ones.
|
EventRegistration |
registerListener(String serviceName,
String topic,
EventFilter filter,
Object listener)
Registers a listener on all cluster nodes with an event filter.
|
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 with an event filter.
|
EventRegistration |
registerLocalListener(String serviceName,
String topic,
Object listener)
Registers a local only listener.
|
void |
shutdown() |
public static final String EVENT_SYNC_FREQUENCY_PROP
public EventServiceImpl(NodeEngineImpl nodeEngine)
public void close(EventRegistration eventRegistration)
InternalEventService
close
in interface InternalEventService
eventRegistration
- the EventRegistration to close.public int getEventThreadCount()
EventService
getEventThreadCount
in interface EventService
GroupProperty.EVENT_THREAD_COUNT
public int getEventQueueCapacity()
EventService
getEventQueueCapacity
in interface EventService
GroupProperty.EVENT_QUEUE_CAPACITY
public int getEventQueueSize()
EventService
getEventQueueSize
in interface EventService
public EventRegistration registerLocalListener(String serviceName, String topic, Object listener)
EventService
registerLocalListener
in interface EventService
serviceName
- service nametopic
- topic namelistener
- listener instancepublic EventRegistration registerLocalListener(String serviceName, String topic, EventFilter filter, Object listener)
EventService
registerLocalListener
in interface EventService
serviceName
- service nametopic
- topic namefilter
- event filterlistener
- listener instancepublic EventRegistration registerListener(String serviceName, String topic, Object listener)
EventService
registerListener
in interface EventService
serviceName
- service nametopic
- topic namelistener
- listener instancepublic EventRegistration registerListener(String serviceName, String topic, EventFilter filter, Object listener)
EventService
registerListener
in interface EventService
serviceName
- service nametopic
- topic namefilter
- event filterlistener
- listener instancepublic boolean handleRegistration(Registration reg)
public boolean deregisterListener(String serviceName, String topic, Object id)
EventService
deregisterListener
in interface EventService
serviceName
- service nametopic
- topic nameid
- registration idEventRegistration.getId()
,
EventService.registerListener(String, String, Object)
,
EventService.registerLocalListener(String, String, Object)
public void deregisterAllListeners(String serviceName, String topic)
EventService
deregisterAllListeners
in interface EventService
serviceName
- service nametopic
- topic namepublic EventRegistration[] getRegistrationsAsArray(String serviceName, String topic)
EventService
getRegistrationsAsArray
in interface EventService
serviceName
- service nametopic
- topic namepublic Collection<EventRegistration> getRegistrations(String serviceName, String topic)
EventService
getRegistrations
in interface EventService
serviceName
- service nametopic
- topic namepublic boolean hasEventRegistration(String serviceName, String topic)
EventService
hasEventRegistration
in interface EventService
serviceName
- service nametopic
- topic namepublic void publishEvent(String serviceName, String topic, Object event, int orderKey)
EventService
publishEvent
in interface EventService
serviceName
- service nametopic
- topic nameevent
- event objectorderKey
- order keypublic void publishEvent(String serviceName, EventRegistration registration, Object event, int orderKey)
EventService
publishEvent
in interface EventService
serviceName
- service nameregistration
- event registrationevent
- event objectorderKey
- order keypublic void publishEvent(String serviceName, Collection<EventRegistration> registrations, Object event, int orderKey)
EventService
publishEvent
in interface EventService
serviceName
- service nameregistrations
- multiple event registrationsevent
- event objectorderKey
- order keypublic void publishRemoteEvent(String serviceName, Collection<EventRegistration> registrations, Object event, int orderKey)
EventService
publishRemoteEvent
in interface EventService
serviceName
- service nameregistrations
- multiple event registrationsevent
- event objectorderKey
- order keypublic EventServiceSegment getSegment(String service, boolean forceCreate)
public void executeEventCallback(Runnable callback)
EventService
If callback
is an instance of StripedRunnable
,
then StripedRunnable.getKey()
will be used as order key
to pick event thread.
executeEventCallback
in interface EventService
callback
- the callback to execute on a random event threadStripedRunnable
public void handle(Packet packet)
PacketHandler
handle
in interface PacketHandler
packet
- the response packet to handlepublic PostJoinRegistrationOperation getPostJoinOperation()
public void shutdown()
public void onMemberLeft(MemberImpl member)
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.