code: private void checkDone() {
      if (doneHandler != null) {
        if (cause != null) {
          doneHandler.handle(new DefaultFutureResult<T>(cause));
        } else {
          if (count == required) {
            doneHandler.handle(new DefaultFutureResult<T>((T) null));
          }
        }
      }
    }
docs: Checks whether the handler should be called.