Source:
private int activate() throws Exception { Policy.setPolicy(new AllPolicy()); systemBundle = createFramework(); if (systemBundle == null) return LauncherConstants.ERROR; startLevelhandler.beforeStart(systemBundle); frameworkWiring = systemBundle.adapt(FrameworkWiring.class); active.set(true); doTimeoutHandler(); doSecurity(); int result = LauncherConstants.OK; BundleContext systemContext = systemBundle.getBundleContext(); systemContext.addServiceListener(this, "(&(|(objectclass=" + Runnable.class.getName() + ")(objectclass=" + Callable.class.getName() + "))(main.thread=true))"); List<BundleActivator> startBeforeBundleStart = new LinkedList<>(); List<BundleActivator> startAfterBundleStart = new LinkedList<>(); trace("start embedded activators"); if (parms.activators != null) { ClassLoader loader = getClass().getClassLoader(); for (Object token : parms.activators) { try { Class<?> clazz = loader.loadClass((String) token); BundleActivator activator = (BundleActivator) newInstance(clazz); if (isAfterBundleStart(activator)) { result = start(systemContext, result, activator); } else if (isBeforeBundleStart(activator)) { startBeforeBundleStart.add(activator); } else { startAfterBundleStart.add(activator); } trace("adding activator %s", activator); } catch (Exception e) { throw new IllegalArgumentException("Embedded Bundle Activator incorrect: " + token, e); } } } List<Bundle> tobestarted = update(System.currentTimeMillis() + 100); for (BundleActivator activator : startBeforeBundleStart) { result = start(systemContext, result, activator); } startBundles(tobestarted); for (BundleActivator activator : startAfterBundleStart) { result = start(systemContext, result, activator); } systemBundle.start(); trace("system bundle started ok"); startLevelhandler.afterStart(); if (parms.trace) { report(out); } return result; }

Target:
private int activate() throws Exception { Policy.setPolicy(new AllPolicy()); systemBundle = createFramework(); if (systemBundle == null) return LauncherConstants.ERROR; startLevelhandler.beforeStart(systemBundle); frameworkWiring = systemBundle.adapt(FrameworkWiring.class); active.set(true); doTimeoutHandler(); doSecurity(); int result = LauncherConstants.OK; BundleContext systemContext = systemBundle.getBundleContext(); systemContext.addServiceListener(this, "(&(|(objectclass=" + Runnable.class.getName() + ")(objectclass=" + Callable.class.getName() + "))(main.thread=true))"); List<BundleActivator> startBeforeBundleStart = new LinkedList<>(); List<BundleActivator> startAfterBundleStart = new LinkedList<>(); trace("start embedded activators"); if (parms.activators != null) { ClassLoader loader = getClass().getClassLoader(); for (Object token : parms.activators) { try { Class<?> clazz = loader.loadClass((String) token); BundleActivator activator = (BundleActivator) newInstance(clazz); if (isAfterFrameworkInit(activator)) { result = start(systemContext, result, activator); } else if (isBeforeBundlesStart(activator)) { startBeforeBundleStart.add(activator); } else { startAfterBundleStart.add(activator); } trace("adding activator %s", activator); } catch (Exception e) { throw new IllegalArgumentException("Embedded Bundle Activator incorrect: " + token, e); } } } List<Bundle> tobestarted = update(System.currentTimeMillis() + 100); for (BundleActivator activator : startBeforeBundleStart) { result = start(systemContext, result, activator); } startBundles(tobestarted); for (BundleActivator activator : startAfterBundleStart) { result = start(systemContext, result, activator); } systemBundle.start(); trace("system bundle started ok"); startLevelhandler.afterStart(); if (parms.trace) { report(out); } return result; }