use of com.hazelcast.cp.event.impl.CPMembershipEventImpl in project hazelcast by hazelcast.
the class MetadataRaftGroupManager method sendMembershipEvents.
private void sendMembershipEvents(Collection<CPMemberInfo> currentMembers, Collection<CPMemberInfo> newMembers) {
if (!isMetadataGroupLeader()) {
return;
}
EventService eventService = nodeEngine.getEventService();
Collection<CPMemberInfo> addedMembers = new LinkedHashSet<>(newMembers);
addedMembers.removeAll(currentMembers);
for (CPMemberInfo member : addedMembers) {
CPMembershipEvent event = new CPMembershipEventImpl(member, EventType.ADDED);
eventService.publishEvent(SERVICE_NAME, EVENT_TOPIC_MEMBERSHIP, event, EVENT_TOPIC_MEMBERSHIP.hashCode());
}
Collection<CPMemberInfo> removedMembers = new LinkedHashSet<>(currentMembers);
removedMembers.removeAll(newMembers);
for (CPMemberInfo member : removedMembers) {
CPMembershipEvent event = new CPMembershipEventImpl(member, EventType.REMOVED);
eventService.publishEvent(SERVICE_NAME, EVENT_TOPIC_MEMBERSHIP, event, EVENT_TOPIC_MEMBERSHIP.hashCode());
}
}
Aggregations