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.');
  }

  // ignore: discarded_futures
  _pendingDrop?.cancel();
  _pendingDrop = null;

  _objection ??= _runPhase!.raiseObjection('quiesce')
    // ignore: discarded_futures
    ..dropped.then((value) => logger.finest('Quiesce objection dropped'));

  if (timeout != null) {
    // ignore: discarded_futures
    _pendingTimeout?.cancel();
    // ignore: discarded_futures
    _pendingTimeout = CancelableOperation<void>.fromFuture(
      // ignore: discarded_futures
      timeout!(),
      // onCancel: () => logger.finest('Timeout avoided!'),
    );
    _pendingTimeout!.then((_) => logger.severe('Objection has timed out!'));
  }
}