public void disconnect(String group, Address addr) throws Exception { writeRequest(new GossipData(GossipType.UNREGISTER, group, addr)); }
public void sendToMember(String group, Address dest, Address sender, byte[] data, int offset, int length) throws Exception { try { writeRequest(new GossipData(GossipType.MESSAGE, group, dest, data, offset, length).setSender(sender)); } catch(Exception ex) { throw new Exception(String.format("connection to %s broken. Could not send message to %s: %s", gossipRouterAddress(), dest, ex)); } }
/** * Registers mbr with the GossipRouter under the given group, with the given logical name and physical address. * Establishes a connection to the GossipRouter and sends a CONNECT message. * @param group The group cluster) name under which to register the member * @param addr The address of the member * @param logical_name The logical name of the member * @param phys_addr The physical address of the member * @throws Exception Thrown when the registration failed */ public void connect(String group, Address addr, String logical_name, PhysicalAddress phys_addr) throws Exception { synchronized(this) { _doConnect(); } try { writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr)); } catch(Exception ex) { throw new Exception(String.format("connection to %s failed: %s", group, 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)); } }
public void disconnect(String group, Address addr) throws Exception { writeRequest(new GossipData(GossipType.UNREGISTER, group, addr)); }
public void sendToMember(String group, Address dest, Address sender, byte[] data, int offset, int length) throws Exception { try { writeRequest(new GossipData(GossipType.MESSAGE, group, dest, data, offset, length).setSender(sender)); } catch(Exception ex) { throw new Exception(String.format("connection to %s broken. Could not send message to %s: %s", gossipRouterAddress(), dest, ex)); } }
/** * Registers mbr with the GossipRouter under the given group, with the given logical name and physical address. * Establishes a connection to the GossipRouter and sends a CONNECT message. * @param group The group cluster) name under which to register the member * @param addr The address of the member * @param logical_name The logical name of the member * @param phys_addr The physical address of the member * @throws Exception Thrown when the registration failed */ public void connect(String group, Address addr, String logical_name, PhysicalAddress phys_addr) throws Exception { synchronized(this) { _doConnect(); } try { writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr)); } catch(Exception ex) { throw new Exception(String.format("connection to %s failed: %s", group, 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)); } }