void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); // $NON-NLS-1$ return; } debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null); debugTracker.open(); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
/** * Calculates whether the job plugin should set worker threads to be daemon threads. When workers * are daemon threads, the job plugin does not need to be explicitly shut down because the VM can * exit while workers are still alive. * * @return <code>true</code> if all worker threads should be daemon threads, and <code>false * </code> otherwise. */ boolean useDaemonThreads() { BundleContext context = JobActivator.getContext(); if (context == null) { // we are running stand-alone, so consult global system property String value = System.getProperty(IJobManager.PROP_USE_DAEMON_THREADS); // default to use daemon threads if property is absent if (value == null) return true; return "true".equalsIgnoreCase(value); // $NON-NLS-1$ } // only use daemon threads if the property is defined final String value = context.getProperty(IJobManager.PROP_USE_DAEMON_THREADS); // if value is absent, don't use daemon threads to maintain legacy behaviour if (value == null) return false; return "true".equalsIgnoreCase(value); // $NON-NLS-1$ }