X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fshutdown-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fshutdown%2Fimpl%2FShutdownServiceImpl.java;h=f9622192fec873f3fc01c1396aa4c06ccb8f1624;hb=0c931b8d1fa153991b10705a4358fe39f93181cd;hp=6cdcf605b04716537d73252d75443e92506b3a14;hpb=f35e990600d56b1d524cc9d9cfc44b725199b1a6;p=controller.git diff --git a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownServiceImpl.java b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownServiceImpl.java index 6cdcf605b0..f9622192fe 100644 --- a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownServiceImpl.java +++ b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownServiceImpl.java @@ -82,6 +82,7 @@ class Impl implements ShutdownService { class StopSystemBundleThread extends Thread { private static final Logger logger = LoggerFactory.getLogger(StopSystemBundleThread.class); + public static final String CONFIG_MANAGER_SYMBOLIC_NAME = "org.opendaylight.controller.config-manager"; private final Bundle systemBundle; StopSystemBundleThread(Bundle systemBundle) { @@ -94,6 +95,14 @@ class StopSystemBundleThread extends Thread { try { // wait so that JMX response is received Thread.sleep(1000); + // first try to stop config-manager + Bundle configManager = findConfigManager(); + if (configManager != null){ + logger.debug("Stopping config-manager"); + configManager.stop(); + Thread.sleep(1000); + } + logger.debug("Stopping system bundle"); systemBundle.stop(); } catch (BundleException e) { logger.warn("Can not stop OSGi server", e); @@ -101,6 +110,16 @@ class StopSystemBundleThread extends Thread { logger.warn("Shutdown process interrupted", e); } } + + private Bundle findConfigManager() { + for(Bundle bundle: systemBundle.getBundleContext().getBundles()){ + if (CONFIG_MANAGER_SYMBOLIC_NAME.equals(bundle.getSymbolicName())) { + return bundle; + } + } + return null; + } + } class CallSystemExitThread extends Thread { @@ -138,7 +157,7 @@ class CallSystemExitThread extends Thread { logger.warn("Thread dump:{}", sb); System.exit(1); } catch (InterruptedException e) { - logger.info("Interrupted, not going to call System.exit(1)"); + logger.warn("Interrupted, not going to call System.exit(1)"); } } }