MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / getMembers

Method getMembers

samples/JGroups/src/RouterStub.java:226–251  ·  view source on GitHub ↗
(final String group)

Source from the content-addressed store, hash-verified

224
225
226 public synchronized List<PingData> getMembers(final String group) throws Exception {
227 List<PingData> retval=new ArrayList<PingData>();
228 try {
229
230 if(!isConnected() || input == null) throw new Exception ("not connected");
231 // we might get a spurious SUSPECT message from the router, just ignore it
232 if(input.available() > 0) // fixes https://jira.jboss.org/jira/browse/JGRP-1151
233 input.skipBytes(input.available());
234
235 GossipData request=new GossipData(GossipRouter.GOSSIP_GET, group, null);
236 request.writeTo(output);
237 output.flush();
238
239 short num_rsps=input.readShort();
240 for(int i=0; i < num_rsps; i++) {
241 PingData rsp=new PingData();
242 rsp.readFrom(input);
243 retval.add(rsp);
244 }
245 }
246 catch(Exception e) {
247 connectionStateChanged(ConnectionStatus.CONNECTION_BROKEN);
248 throw new Exception("Connection to " + getGossipRouterAddress() + " broken. Could not send GOSSIP_GET request", e);
249 }
250 return retval;
251 }
252
253 public InetSocketAddress getGossipRouterAddress() {
254 return new InetSocketAddress(router_host, router_port);

Callers

nothing calls this directly

Calls 7

isConnectedMethod · 0.95
addMethod · 0.80
writeToMethod · 0.45
flushMethod · 0.45
readFromMethod · 0.45

Tested by

no test coverage detected