docs: public void cancel() {
      List<CancellationTokenRegistration> registrations;
      synchronized (lock) {
        throwIfClosed();
        if (cancellationRequested) {
          return;
        }
  
        cancelScheduledCancellation();
  
        cancellationRequested = true;
        registrations = new ArrayList<>(this.registrations);
      }
      notifyListeners(registrations);
    }