/** * Add a new received tree and return the number of remaining tree to be received for the job * to be complete. * * <p>Callers may assume exactly one addTree call will result in zero remaining endpoints. */ public synchronized int addTree(TreeRequest request, MerkleTree tree) { // Wait for all request to have been performed (see #3400) try { requestsSent.await(); } catch (InterruptedException e) { throw new AssertionError("Interrupted while waiting for requests to be sent"); } assert request.cf.right.equals(cfname); trees.add(new TreeResponse(request.endpoint, tree)); return treeRequests.completed(request); }
/** @return true if the @param differencer was the last remaining */ synchronized boolean completedSynchronization(Differencer differencer) { return differencers.completed(differencer) == 0; }