/** * Fetches a list of {@link PingData} from the GossipRouter, one for each member in the given group. This call * returns immediately and when the results are available, the * {@link org.jgroups.stack.RouterStub.MembersNotification#members(List)} callback will be invoked. * @param group The group for which we need members information * @param callback The callback to be invoked. */ public void getMembers(final String group, MembersNotification callback) throws Exception { if(callback == null) return; // if(!isConnected()) throw new Exception ("not connected"); synchronized(get_members_map) { List<MembersNotification> set=get_members_map.get(group); if(set == null) get_members_map.put(group, set=new ArrayList<>()); set.add(callback); } try { writeRequest(new GossipData(GossipType.GET_MBRS, group, null)); } catch(Exception ex) { removeResponse(group, callback); throw new Exception(String.format("connection to %s broken. Could not send %s request: %s", gossipRouterAddress(), GossipType.GET_MBRS, ex)); } }
/** * Fetches a list of {@link PingData} from the GossipRouter, one for each member in the given group. This call * returns immediately and when the results are available, the * {@link org.jgroups.stack.RouterStub.MembersNotification#members(List)} callback will be invoked. * @param group The group for which we need members information * @param callback The callback to be invoked. */ public void getMembers(final String group, MembersNotification callback) throws Exception { if(callback == null) return; // if(!isConnected()) throw new Exception ("not connected"); synchronized(get_members_map) { List<MembersNotification> set=get_members_map.get(group); if(set == null) get_members_map.put(group, set=new ArrayList<>()); set.add(callback); } try { writeRequest(new GossipData(GossipType.GET_MBRS, group, null)); } catch(Exception ex) { removeResponse(group, callback); throw new Exception(String.format("connection to %s broken. Could not send %s request: %s", gossipRouterAddress(), GossipType.GET_MBRS, ex)); } }