Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 11 package org.eclipse.core.internal.jobs; 12 13 import java.util.Hashtable ; 14 import org.eclipse.core.runtime.jobs.IJobManager; 15 import org.osgi.framework.*; 16 17 20 public class JobActivator implements BundleActivator { 21 22 26 private static final String PROP_REGISTER_JOB_SERVICE = "eclipse.service.jobs"; 28 31 private static BundleContext bundleContext; 32 33 36 private ServiceRegistration jobManagerService = null; 37 38 41 public void start(BundleContext context) throws Exception { 42 bundleContext = context; 43 JobOSGiUtils.getDefault().openServices(); 44 45 boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); if (shouldRegister) 47 registerServices(); 48 } 49 50 53 public void stop(BundleContext context) throws Exception { 54 unregisterServices(); 55 JobManager.shutdown(); 56 JobOSGiUtils.getDefault().closeServices(); 57 bundleContext = null; 58 } 59 60 static BundleContext getContext() { 61 return bundleContext; 62 } 63 64 private void registerServices() { 65 jobManagerService = bundleContext.registerService(IJobManager.class.getName(), JobManager.getInstance(), new Hashtable ()); 66 } 67 68 private void unregisterServices() { 69 if (jobManagerService != null) { 70 jobManagerService.unregister(); 71 jobManagerService = null; 72 } 73 } 74 } 75
| Popular Tags
|