S - the service type for which this segment is responsiblepublic class EventServiceSegment<S> extends Object
Registrations for that service. The segment is responsible for keeping the
number of publications and keeping the registrations.
The listener registration defines a specific topic that allows for further granulation of
the published events. This allows events to be published for the same service but for
a different topic (e.g. for a map service the topics are specific map instance names).| Constructor and Description |
|---|
EventServiceSegment(String serviceName,
S service) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addRegistration(String topic,
Registration registration)
Adds a registration for the
topic and notifies the listener and service of the listener
registration. |
ConcurrentMap<String,Registration> |
getRegistrationIdMap()
Returns the map from registration ID to the listener registration.
|
ConcurrentMap<String,Collection<Registration>> |
getRegistrations() |
Collection<Registration> |
getRegistrations(String topic,
boolean forceCreate)
Returns the
Registrations for the event topic. |
Registration |
removeRegistration(String topic,
String id)
Removes the registration matching the
topic and ID. |
public Collection<Registration> getRegistrations(String topic, boolean forceCreate)
Registrations for the event topic. If there are no
registrations and forceCreate, it will create a concurrent set and put it in the registration map.topic - the event topicforceCreate - whether to create the registration set if none exists or to return nullforceCreate is falsepublic ConcurrentMap<String,Registration> getRegistrationIdMap()
public ConcurrentMap<String,Collection<Registration>> getRegistrations()
public boolean addRegistration(String topic, Registration registration)
topic and notifies the listener and service of the listener
registration. Returns if the registration was added. The registration might not be added
if an equal instance is already registered.topic - the event topicregistration - the listener registrationpublic Registration removeRegistration(String topic, String id)
topic and ID.
Returns the removed registration or null if none matched.topic - the registration topic nameid - the registration IDnull if none matchecCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.