stopService method
void
stopService()
inherited
Implementation
void stopService() {
if (!(_state == ServiceState.online)) {
throw Exception("$name Service cannot be stopped while $state");
}
PrecisionStopwatch p = PrecisionStopwatch.start();
_state = ServiceState.stopping;
verbose("Stopping $name Service");
try {
onStop();
_state = ServiceState.offline;
} catch (e, es) {
_state = ServiceState.offline;
error("Failed while stopping $name Service: $e");
error(es);
}
if (_state == ServiceState.failed) {
warn("Failed to stop $name Service! It is still marked as offline.");
} else {
success("Stopped $name Service in ${p.getMilliseconds()}ms");
}
}