private void takeRemove(TupleClass tupleToDelete) { setView(); WaitHandle[] handles = new WaitHandle[numServers]; IAsyncResult[] asyncResults = new IAsyncResult[numServers]; for (int i = 0; i < numServers; i++) { IServerService remoteObject = view[i]; takeRemoveDelegate takeRemDel = new takeRemoveDelegate(remoteObject.TakeRemove); IAsyncResult ar = takeRemDel.BeginInvoke(tupleToDelete, url, nonce, null, null); asyncResults[i] = ar; handles[i] = ar.AsyncWaitHandle; } int ntimeouts = 0; if (!WaitHandle.WaitAll(handles, 1000)) { for (int k = 0; k < numServers; k++) { if (handles[k].WaitOne(0) == false) { ntimeouts++; } } } if (ntimeouts > numServers / 2) { takeRemove(tupleToDelete); } }
private void takeRemove(TupleClass tupleToDelete) { WaitHandle[] handles = new WaitHandle[numServers]; IAsyncResult[] asyncResults = new IAsyncResult[numServers]; for (int i = 0; i < numServers; i++) { IServerService remoteObject = view[i]; takeRemoveDelegate takeRemDel = new takeRemoveDelegate(remoteObject.TakeRemove); IAsyncResult ar = takeRemDel.BeginInvoke(tupleToDelete, url, nonce, null, null); asyncResults[i] = ar; handles[i] = ar.AsyncWaitHandle; } if (!WaitHandle.WaitAll(handles, 1000)) { setView(); takeRemove(tupleToDelete); } }