code: public synchronized int addTree(InetAddress endpoint, 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");
          }
  
          if (tree == null)
              failed = true;
          else
              trees.add(new TreeResponse(endpoint, tree));
          return treeRequests.completed(endpoint);
      }
docs: Add a new received tree and return the number of remaining tree to
  be received for the job to be complete.
  
  Callers may assume exactly one addTree call will result in zero remaining endpoints.
  
  @param endpoint address of the endpoint that sent response
  @param tree sent Merkle tree or null if validation failed on endpoint
  @return the number of responses waiting to receive