private synchronized void sendInitialMasterTakeover(String clientLocation) { Services.Client client = connections.getClient0(clientLocation); // Step 1: Send takeover. Rpc rpc1 = rpcf.create(); RpcCallback<MasterTakeoverResponse> done1 = new RemoveParticipantIfFailsCallback<MasterTakeoverResponse>(clientLocation, rpc1); client.masterTakeover(rpc1, getMasterInfo(), done1); // Step 2: Send all state. sendFullState(clientLocation); // Step 3: Finish takeover. Rpc rpc2 = rpcf.create(); RpcCallback<Empty> done2 = new RemoveParticipantIfFailsCallback<Empty>(clientLocation, rpc2); client.masterTakeoverFinished(rpc2, getMasterInfo(), done2); }
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); }