X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2Fosgi%2FOsgiRuntimeContext.java;h=ecfeca74ee839a66b8b1df9dd9f9539752f79d9a;hb=01da06d541cdb4ad614579a37be64b5de900bc20;hp=b7079f60e87fa7611bbf936bd3603fd78a52e3d7;hpb=6bfcb81dd21d8fdd9094610c00f5f8ad9c6a36a7;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.init/src/org/argeo/init/osgi/OsgiRuntimeContext.java b/org.argeo.init/src/org/argeo/init/osgi/OsgiRuntimeContext.java index b7079f60e..ecfeca74e 100644 --- a/org.argeo.init/src/org/argeo/init/osgi/OsgiRuntimeContext.java +++ b/org.argeo.init/src/org/argeo/init/osgi/OsgiRuntimeContext.java @@ -95,7 +95,13 @@ public class OsgiRuntimeContext implements RuntimeContext, AutoCloseable { new Hashtable<>(Collections.singletonMap(Constants.SERVICE_PID, "argeo.logging.publisher"))); } OsgiBoot osgiBoot = new OsgiBoot(bundleContext); - osgiBoot.bootstrap(config); + String frameworkUuuid = bundleContext.getProperty(Constants.FRAMEWORK_UUID); + new Thread("OSGi boot framework " + frameworkUuuid) { + @Override + public void run() { + osgiBoot.bootstrap(config); + } + }.start(); } public void update() { @@ -151,28 +157,19 @@ public class OsgiRuntimeContext implements RuntimeContext, AutoCloseable { public void close() throws Exception { if (framework == null) return; -// Bundle scrBundle = osgiBoot.getBundlesBySymbolicName().get(); -// if (scrBundle != null && scrBundle.getState() > Bundle.RESOLVED) { -// scrBundle.stop(); -// while (!(scrBundle.getState() <= Bundle.RESOLVED)) { -// Thread.sleep(500); + // TODO make shutdown of dynamic service more robust +// for (Bundle scrBundle : framework.getBundleContext().getBundles()) { +// if (scrBundle.getSymbolicName().equals(SYMBOLIC_NAME_FELIX_SCR)) { +// if (scrBundle.getState() > Bundle.RESOLVED) { +// scrBundle.stop(); +// while (!(scrBundle.getState() <= Bundle.RESOLVED)) { +// Thread.sleep(100); +// } +// Thread.sleep(500); +// } // } -// Thread.sleep(1000); // } - // TODO make shutdown of dynamic service more robust - for (Bundle scrBundle : framework.getBundleContext().getBundles()) { - if (scrBundle.getSymbolicName().equals(SYMBOLIC_NAME_FELIX_SCR)) { - if (scrBundle.getState() > Bundle.RESOLVED) { - scrBundle.stop(); - while (!(scrBundle.getState() <= Bundle.RESOLVED)) { - Thread.sleep(100); - } - Thread.sleep(100); - } - } - } - stop(); waitForStop(CLOSE_TIMEOUT); framework = null;