Dear list.

My aim is a graceful stop of the OSGi framework and all OSGi blueprint components.

If I stop the OSGi framework, the OSGi blueprint components are not destroyed (destroy methods are not called). Why is this the case and how can I destroy them. I have my own OSGi launcher implementation. I'm using a shutdown hook and then stop the OSGi framework:

Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
        Launcher.logService.log(LogService.LOG_WARNING, "HANDLE SHUTDOWN");
        if(Launcher.framework != null) {
            try {
                Launcher.framework.stop();
            } catch (BundleException e) {
                Launcher.logService.log(LogService.LOG_ERROR, "Shutdown" + ((Launcher.framework != null) ? " of " + Launcher.framework.getSymbolicName() + " " : " ") + "failed!", e);
                System.exit(-1);
            }
        }
    }
});

Thanks and kind regards,

Martin

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to