code: public boolean tryComplete() {
          while (true) {
              State current = state.get();
              switch (current) {
                  case IDLE: {
                      if (state.compareAndSet(current, State.COMPLETED))
                          return true;
                      break;
                  }
                  case SUCCEEDED:
                  case FAILED: {
                      return false;
                  }
                  default: {
                      throw new IllegalStateException(current.toString());
                  }
              }
          }
      }
docs: Tries to complete this callback; driver code should call this method once
  <em>after</em> the asynchronous operation to detect whether the
  asynchronous operation has already completed or not.
  
  @return whether the attempt to complete was successful.