Register this process with the router under group . @param group The name of the group under which to register
(String group, Address addr, String logical_name, List<PhysicalAddress> phys_addrs)
| 135 | * @param group The name of the group under which to register |
| 136 | */ |
| 137 | public synchronized void connect(String group, Address addr, String logical_name, List<PhysicalAddress> phys_addrs) throws Exception { |
| 138 | doConnect(); |
| 139 | GossipData request=new GossipData(GossipRouter.CONNECT, group, addr, logical_name, phys_addrs); |
| 140 | request.writeTo(output); |
| 141 | output.flush(); |
| 142 | byte result = input.readByte(); |
| 143 | if(result == GossipRouter.CONNECT_OK) { |
| 144 | connectionStateChanged(ConnectionStatus.CONNECTED); |
| 145 | } else { |
| 146 | connectionStateChanged(ConnectionStatus.DISCONNECTED); |
| 147 | throw new Exception("Connect failed received from GR " + getGossipRouterAddress()); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | public synchronized void doConnect() throws Exception { |
| 152 | if(!isConnected()) { |
no test coverage detected