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(); }
/** * This method is called upon plug-in activation */ @Override public void start(BundleContext context) throws Exception { bundleContext = context; JobOSGiUtils.getDefault().openServices(); boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); //$NON-NLS-1$ if (shouldRegister) registerServices(); }
/** * This method is called when the plug-in is stopped */ @Override public void stop(BundleContext context) throws Exception { unregisterServices(); JobManager.shutdown(); JobOSGiUtils.getDefault().closeServices(); bundleContext = null; }
/** * This method is called when the plug-in is stopped */ public void stop(BundleContext context) throws Exception { unregisterServices(); JobManager.shutdown(); JobOSGiUtils.getDefault().closeServices(); bundleContext = null; }
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(); }
/** * This method is called upon plug-in activation */ @Override public void start(BundleContext context) throws Exception { bundleContext = context; JobOSGiUtils.getDefault().openServices(); boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); //$NON-NLS-1$ if (shouldRegister) registerServices(); }
/** * This method is called when the plug-in is stopped */ public void stop(BundleContext context) throws Exception { unregisterServices(); JobManager.shutdown(); JobOSGiUtils.getDefault().closeServices(); bundleContext = null; }
/** * 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$ } }
/** * This method is called upon plug-in activation */ public void start(BundleContext context) throws Exception { bundleContext = context; JobOSGiUtils.getDefault().openServices(); boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); //$NON-NLS-1$ if (shouldRegister) registerServices(); }
/** * This method is called when the plug-in is stopped */ @Override public void stop(BundleContext context) throws Exception { unregisterServices(); JobManager.shutdown(); JobOSGiUtils.getDefault().closeServices(); bundleContext = null; }
/** * 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$ } }
/** * This method is called upon plug-in activation */ public void start(BundleContext context) throws Exception { bundleContext = context; JobOSGiUtils.getDefault().openServices(); boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); //$NON-NLS-1$ if (shouldRegister) registerServices(); }
/** * 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$ } }
/** * 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$ } }
@SuppressWarnings("unchecked") void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } // register debug options listener Hashtable<String, String> properties = new Hashtable<String, String>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, JobManager.PI_JOBS); debugRegistration = context.registerService(DebugOptionsListener.class, JobManager.getInstance(), properties); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
@SuppressWarnings("unchecked") void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } // register debug options listener Hashtable<String, String> properties = new Hashtable<>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, JobManager.PI_JOBS); debugRegistration = context.registerService(DebugOptionsListener.class, JobManager.getInstance(), properties); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }