raiseObjection method

void raiseObjection()

Raise the objection, if it does not exist already.

Will time out pending timeout, if it is provided.

Implementation

void raiseObjection() {
  if (_runPhase == null) {
    throw Exception('Cannot raise objection before run phase.');
  }

  unawaited(_pendingDrop?.cancel());
  _pendingDrop = null;

  _objection ??= _runPhase!.raiseObjection('quiesce');

  unawaited(_objection!.dropped
      .then((value) => logger.finest('Quiesce objection dropped')));

  if (timeout != null) {
    unawaited(_pendingTimeout?.cancel());
    _pendingTimeout = CancelableOperation<void>.fromFuture(
      timeout!(),
    );
    _pendingTimeout!.then((_) => logger.severe('Objection has timed out!'));
  }
}