MBeanRegistrar.unregisterAllMBeans();
CarbonContextHolderBase.unloadTenant(MultitenantConstants.SUPER_TENANT_ID);
ClusteringAgent clusteringAgent =
serverConfigContext.getAxisConfiguration().getClusteringAgent();
if (clusteringAgent != null) {
clusteringAgent.finalize();
}
if (!CarbonUtils.isRunningInStandaloneMode()) {
int waitFor = 5;
log.info("Waiting for " + waitFor + " sec before initiating restart");
Thread.sleep(waitFor * 1000); // The H2 DB connections do not get closed if this is not done