// #3 This module's state is set to {@code STOPPING}
setState(State.STOPPING);
// #4 A module event of type {@link ModuleEvent#STOPPING} is fired.
RuntimeEventsManager eventHandler = getRuntime().adapt(RuntimeEventsManager.class);
eventHandler.fireModuleEvent(this, ModuleEvent.STOPPING);
// #5 The {@link ModuleActivator#stop(ModuleContext)} is called
Throwable stopException = null;
try {
ModuleActivator moduleActivator = getAttachment(MODULE_ACTIVATOR_KEY);