class Task {

  boolean trySetResult(TResult result) {
    synchronized (lock) {
      if (complete) {
        return false;
      }
      complete = true;
      Task.this.result = result;
      lock.notifyAll();
      runContinuations();
      return true;
    }
  }

    Task();
  private  Task(TResult result);
  private  Task(boolean cancelled);

}