Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
   */
  public void stop(final BundleContext context) throws Exception {
    // TODO-mkuppe here we should do something like a deregisterAll(), but see ungetService(...);
    if (serviceRegistration != null && serviceFactory.isActive()) {
      ServiceReference reference = serviceRegistration.getReference();
      IDiscoveryLocator aLocator = (IDiscoveryLocator) context.getService(reference);

      serviceRegistration.unregister();

      IContainer container = (IContainer) aLocator.getAdapter(IContainer.class);
      container.disconnect();
      container.dispose();

      serviceRegistration = null;
    }
    plugin = null;
    bundleContext = null;
    if (advertiserSt != null) {
      advertiserSt.close();
      advertiserSt = null;
    }
    if (locatorSt != null) {
      locatorSt.close();
      locatorSt = null;
    }
  }
 protected void shutdown() {
   if (datashareAdapter != null) {
     datashareAdapter.removeChannel(testChannel.getID());
     testChannel = null;
     datashareAdapter = null;
   }
   if (container != null) {
     container.dispose();
     getContainerManager().removeAllContainers();
     container = null;
   }
   if (containerManagerTracker != null) {
     containerManagerTracker.close();
     containerManagerTracker = null;
   }
   synchronized (appLock) {
     done = true;
     appLock.notifyAll();
   }
   bundleContext = null;
 }