code: public void setResult(R result) {
          try {
              lock.lock();
              this.result = result;
              notifyHaveResult();
          }
          finally {
              lock.unlock();
          }
      }
docs: Set the result value and notify about operation completion.
  
  @param result
  the result value