docs: protected final void notifyStopped() {
      monitor.enter();
      try {
        // We check the internal state of the snapshot instead of state() directly so we don't allow
        // notifyStopped() to be called while STARTING, even if stop() has already been called.
        State previous = snapshot.state;
        if (previous != STOPPING && previous != RUNNING) {
          IllegalStateException failure =
              new IllegalStateException("Cannot notifyStopped() when the service is " + previous);
          notifyFailed(failure);
          throw failure;
        }
        snapshot = new StateSnapshot(TERMINATED);
        terminated(previous);
      } finally {
        monitor.leave();
        executeListeners();
      }
    }