private void sendComponent(String clientLocation, Component component) { Services.Client client = connections.getClient0(clientLocation); if (client == null) { removeParticipant(clientLocation); } Services.Component componentProto = ServicesPbConversion.componentToPb(component); Rpc rpc = rpcf.create(); RpcCallback<Empty> done = new RemoveParticipantIfFailsCallback<Empty>(clientLocation, rpc); client.setState(rpc, componentProto, done); }
private void sendFullState() throws InterruptedException { RpcList rpcs = new RpcList(); for (String location : clients) { Services.Client client = connections.getClient0(location); if (client == null) { clients.remove(client); continue; } RemoveClientCallback<Empty> done = new RemoveClientCallback<Empty>(location); for (Component component : state.getComponents()) { Services.Component componentPb = ServicesPbConversion.componentToPb(component); Rpc rpc = rpcf.create(); client.setState(rpc, componentPb, done); rpcs.add(rpc); } } rpcs.awaitAll(); }