/* (non-Javadoc)
@see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
512556
@Override
	public void stop(BundleContext context) throws Exception {
		final String sourceMethod = "stop"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(Activator.class.getName(), sourceMethod, new Object[]{context});
		}
		super.stop(context);
		// Shutdown the aggregator instances
		ServiceReference<?>[] refs = context.getServiceReferences(IAggregator.class.getName(), null);
		if (refs != null) {
			for (ServiceReference<?> ref : refs) {
				AggregatorImpl aggr = (AggregatorImpl)context.getService(ref);
				if (aggr != null) {
					try {
						aggr.shutdown();
					} catch (Exception e) {
						if (log.isLoggable(Level.SEVERE)) {
							log.log(Level.SEVERE, e.getMessage(), e);
						}
					}
				}
			}
		}

		for (ServiceRegistration<?> reg : serviceRegistrations) {
			reg.unregister();
		}
		if (executors != null) {
			executors.shutdown();
		}
		this.executors = null;
		Activator.context = null;

		if (isTraceLogging) {
			log.exiting(Activator.class.getName(), sourceMethod);
		}
	}
869638
public boolean shutdownService(Object service, BundleContext context)
    {
        if (service instanceof BaseServiceMessageTransport) // Always
            ((BaseServiceMessageTransport)service).free();
        return super.shutdownService(service, context);
    }
863475
@Override
    public void stop(BundleContext context) throws Exception {
        app.fire(new Stop(), Channel.BROADCAST);
        Components.awaitExhaustion();
    }
207867
@Override
    public void stopPlugins() {
        // stop started plugins in reverse order
        Collections.reverse(startedPlugins);
        Iterator<PluginWrapper> itr = startedPlugins.iterator();
        while (itr.hasNext()) {
            PluginWrapper pluginWrapper = itr.next();
            PluginState pluginState = pluginWrapper.getPluginState();
            if (PluginState.STARTED == pluginState) {
                try {
                    log.info("Stop plugin '{}'", getPluginLabel(pluginWrapper.getDescriptor()));
                    pluginWrapper.getPlugin().stop();
                    pluginWrapper.setPluginState(PluginState.STOPPED);
                    itr.remove();

                    firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
                } catch (PluginException e) {
                    log.error(e.getMessage(), e);
                }
            }
        }
    }
1206507
public void stop() {
		if (!PlatformUI.isWorkbenchRunning())
			return;
		final IWorkbench workbench = PlatformUI.getWorkbench();
		final Display display = workbench.getDisplay();
		display.syncExec(new Runnable() {
			public void run() {
				if (!display.isDisposed())
					workbench.close();
			}
		});
	}
699684
@Override
	public void stop(BundleContext context) throws Exception {
		hazelcastNode.shutdown();
		System.out.println("******************************** WebsocketActivator SHUTDOWN **********************************");
	}
676451
public synchronized void stop() {
        if (isRunning()) {
            running.set(false);
            DeviceFinder.getInstance().removeDeviceAnnouncementListener(announcementListener);
            dbServerPorts.clear();
            for (Client client : openClients.values()) {
                try {
                    client.close();
                } catch (Exception e) {
                    logger.warn("Problem closing " + client + " when stopping", e);
                }
            }
            openClients.clear();
            useCounts.clear();
            deliverLifecycleAnnouncement(logger, false);
        }
    }
859834
def stop(self):
        
        if self._state != Bundle.ACTIVE:
            # Invalid state
            return

        exception = None
        with self._lock:
            # Store the bundle current state
            previous_state = self._state

            # Stopping...
            self._state = Bundle.STOPPING
            self._fire_bundle_event(BundleEvent.STOPPING)

            # Call the activator, if any
            stopper = self.__get_activator_method("stop")
            if stopper is not None:
                try:
                    # Call the start method
                    stopper(self.__context)
                except (FrameworkException, BundleException) as ex:
                    # Restore previous state
                    self._state = previous_state

                    # Re-raise directly Pelix exceptions
                    _logger.exception(
                        "Pelix error raised by %s while stopping", self.__name
                    )
                    exception = ex
                except Exception as ex:
                    _logger.exception(
                        "Error raised by %s while stopping", self.__name
                    )
                    # Store the exception (raised after service clean up)
                    exception = BundleException(ex)

            # Hide remaining services
            self.__framework._hide_bundle_services(self)

            # Intermediate bundle event : activator should have cleaned up
            # everything, but some element could stay (iPOPO components, ...)
            self._fire_bundle_event(BundleEvent.STOPPING_PRECLEAN)

            # Remove remaining services (the hard way)
            self.__unregister_services()

            # Cleanup service usages
            self.__framework._unget_used_services(self)

            # Bundle is now stopped and all its services have been unregistered
            self._state = Bundle.RESOLVED
            self._fire_bundle_event(BundleEvent.STOPPED)

        # Raise the exception, if any
        # pylint: disable=E0702
        # Pylint seems to miss the "is not None" check below
        if exception is not None:
            raise exception
185312
protected void deactivate(ComponentContext context) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "deactivate");

        destroyConnectionFactories(true);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "deactivate", id + ' ' + context.getProperties().get(JNDI_NAME));
    }
289394
@InterfaceAudience.Public
    public void stop() {

        if (runningState.get() == false) {
            Log.d(Log.TAG_QUERY, "%s: stop() called, but runningState is already false.  Ignoring.", this);
            return;
        } else {
            Log.d(Log.TAG_QUERY, "%s: stop() called", this);
            runningState.set(false);
        }

        if (observing) {
            observing = false;
            getDatabase().removeChangeListener(this);
        }

        // slight diversion from iOS version -- cancel the queryFuture
        // regardless of the willUpdate value, since there can be an update in flight
        // with willUpdate set to false.  was needed to make testLiveQueryStop() unit test pass.
        if (queryFuture != null) {
            boolean cancelled = queryFuture.cancel(true);
            Log.v(Log.TAG_QUERY, "%s: cancelled queryFuture %s, returned: %s", this, queryFuture, cancelled);
        }

        if (rerunUpdateFuture != null) {
            boolean cancelled = rerunUpdateFuture.cancel(true);
            Log.d(Log.TAG_QUERY, "%s: cancelled rerunUpdateFuture %s, returned: %s", this, rerunUpdateFuture, cancelled);
        }

    }
692717
public void stop() {
      // This method might get called several times.
      if (stopped) return;
      if (needToUnregister) {
         try {
            unregisterMBeans(resourceDMBeans);
            needToUnregister = false;
         } catch (Exception e) {
            log.problemsUnregisteringMBeans(e);
         }
      }
      stopped = true;
   }
765706
@Override
    protected void onStop()
    {
        m_context.removeBundleListener( m_bundleListener );
        final Bundle[] toBeRemoved =
            m_mappings.keySet().toArray( new Bundle[m_mappings.keySet().size()] );
        for( Bundle bundle : toBeRemoved )
        {
            unregister( bundle );
        }

        m_bundleListener = null;
        m_mappings = null;
    }
1260125
@Override
	public final void stop() throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
    		checkNotClosed();
    		if (!started)
    			return;
    		started = false;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    	transportEndpoint.blockingRequest(new StopConnectionQuery());
    	waitForDeliverySync();
    }
985910
void stop() {
        try {
            dm.stop(getBundleContext());
        } catch (DirectoryMonitoringException e) {
            LOG.error("Failed to stop " + DirectoryMonitor.class.getName() + " for the directory " + monitoredDirectory, e);
        }
        declarationsFiles.clear();
        declarationRegistrationManager.unregisterAll();
    }
732789
void close() {
    final ContextStop contextStop = new ContextStopImpl(this.identifier);
    for (final EventHandler<ContextStop> stopHandler : this.contextStopHandlers) {
      stopHandler.onNext(contextStop);
    }
  }
573367
void handleStop(Bundle bundle) {
        if (bundle == null) {
            throw new IllegalArgumentException("Method argument bundle must not be null.");
        }

        this.logger.info("Removing infrastructure for bundle: " + bundle + "...");
            this.modelRegistrar.unregister(bundle);
            this.dispatcherServlet.disableMvc(bundle);

        this.logger.info("Infrastructure for {} removed.", bundle);
    }
77138
protected void deactivate(ComponentContext context) {
        transactionInflowManagerRef.deactivate(context);

        // TODO remove the following temporary code once the transaction manager provides a proper mechanism to prevent a transaction on multiple threads at once
        SuspendCount suspendCount = suspendCountRef.get();
        if (suspendCount != null)
            ((UOWCurrent) transactionManager).unsetUOWEventListener(suspendCount);
    }