close method

  1. @override
Future close(
  1. String? correlationId
)

Closes this endpoint and the REST server (service) that was opened earlier.

  • correlationId (optional) transaction id to trace execution through call chain. Return once the closing process is complete. Will be called with an error if one is raised.

Implementation

@override
Future close(String? correlationId) async {
  if (_server != null) {
    // Eat exceptions
    try {
      await _server!.close();
      // await _app.close();

      _logger.debug(correlationId, 'Closed REST service at %s', [_uri]);
    } catch (ex) {
      _logger
          .warn(correlationId, 'Failed while closing REST service: %s', [ex]);
      rethrow;
    }

    _server = null;
    _app = null;
    _uri = null;
  }
}