}
@Override
public Object call() throws Exception {
final ClusterServiceImpl service = getService();
final ClientEndpoint endpoint = getEndpoint();
final String registrationId = service.addMembershipListener(new MembershipListener() {
@Override
public void memberAdded(MembershipEvent membershipEvent) {
if (endpoint.live()) {
final MemberImpl member = (MemberImpl) membershipEvent.getMember();
endpoint.sendEvent(new ClientMembershipEvent(member, MembershipEvent.MEMBER_ADDED), getCallId());
}
}
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
if (endpoint.live()) {
final MemberImpl member = (MemberImpl) membershipEvent.getMember();
endpoint.sendEvent(new ClientMembershipEvent(member, MembershipEvent.MEMBER_REMOVED), getCallId());
}
}
public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) {
if (endpoint.live()) {
final MemberImpl member = (MemberImpl) memberAttributeEvent.getMember();
final String uuid = member.getUuid();
final MemberAttributeOperationType op = memberAttributeEvent.getOperationType();
final String key = memberAttributeEvent.getKey();
final Object value = memberAttributeEvent.getValue();
final MemberAttributeChange memberAttributeChange = new MemberAttributeChange(uuid, op, key, value);
endpoint.sendEvent(new ClientMembershipEvent(member, memberAttributeChange), getCallId());
}
}
});
final String name = ClusterServiceImpl.SERVICE_NAME;
endpoint.setListenerRegistration(name, name, registrationId);
final Collection<MemberImpl> memberList = service.getMemberList();
final Collection<Data> response = new ArrayList<Data>(memberList.size());
final SerializationService serializationService = getClientEngine().getSerializationService();
for (MemberImpl member : memberList) {