- if (log.isDebugEnabled())
- log.debug("Launch unique flow " + flow
- + " from module " + module);
- try {
- OsgiBundle osgiBundle = bundlesManager
- .findFromPattern(module);
- Bundle moduleBundle = bundlesManager
- .findRelatedBundle(osgiBundle);
- bundlesManager.startSynchronous(moduleBundle);
- RealizedFlow lastLaunch = findRealizedFlow(module, flow);
- if (lastLaunch == null)
- throw new SlcException("Cannot find launch for "
- + module + " " + flow);
- execute(lastLaunch);
- } catch (Exception e) {
- log.error("Error in unique flow " + flow
- + " from module " + module, e);
- } finally {
- if (log.isDebugEnabled())
- log.debug("Shutdown OSGi runtime...");
- Framework framework = (Framework) bundlesManager
- .getBundleContext().getBundle(0);
- try {
- // shutdown framework
- framework.stop();
- // wait 1 min for shutdown
- framework.waitForStop(60 * 1000);
- // close VM
- System.exit(0);
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(1);
- }
- }