Improve shutdown sequence
The order in which modules of Openfire get shut down when Openfire is being terminated should be improved.
The order in which modules are started is strictly defined. It starts with the 'core' modules, before going on to less important modules. Lastly, the connection manager is loaded, allowing connections to be established only after all modules are started.
The shutdown order should reverse this order, allowing the 'core' modules to be available to provide their functionality to the lesser modules, before eventually shutting down themselves.
The objective is to tackle an issue with MUC: when Openfire is being shut down, all MUC occupants should receive a notification (allowing their client to rejoin the MUC, which is of particular interest to clients joined through S2S). Currently, this notification is implemented, but does not arrive. The assumption is that this is caused by the RoutingTable module being shut down before the MUC module, preventing these notifications from being delivered.