/* (non-Javadoc)
@see com.ibm.ws.sib.msgstore.persistence.Dispatcher#stop(int)
558219
public void stop(int mode)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "stop", Integer.valueOf(mode));

        boolean performingTheStop = false;

        // First change the state of the dispatcher
        synchronized(this)
        {
            if (_running && !_stopRequested)
            {
                performingTheStop = true;

                // Make sure that the dispatcher threads notice that we are stopping
                _stopRequested = true;
            }
        } // end synchronized


        // Are we performing the stop or is it stopping already?
        if (performingTheStop)
        {
            for (int i = 0; i < _maxThreads; i++)
            {
                _workers[i].cleanup();
            }

            // Now wait for the dispatcher threads to stop.
            // They should stop quickly unless they're stuck inside JDBC so
            // we only allow 60 seconds in total to join all of the threads
            long limitStopMillis = System.currentTimeMillis() + 60000;

            for (int i = 0; i < _maxThreads; i++)
            {
                long remainingStopDelay = limitStopMillis - System.currentTimeMillis();
                if (remainingStopDelay <= 0)
                {
                    remainingStopDelay = 1;
                }

                try
                {
                    if (_threads[i] != null)
                    {
                        _threads[i].join(remainingStopDelay);
                        if (_threads[i].isAlive())
                        {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Cannot join dispatcher thread " + _workers[i]);
                        }
                    }
                }
                catch (InterruptedException ie)
                {
                    //No FFDC Code Needed.
                }
            }
        } // end if (performingTheStop)


        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "stop");
    }
876905
@Override
  public void stop() {
    logger().log("Server stopping...");

    failTimedOutMissingContentRequests();

    channel.stop();
    channel.close();

    for (final Dispatcher dispatcher : dispatcherPool) {
      dispatcher.stop();
    }

    logger().log("Server stopped.");

    super.stop();
  }
1223192
@Override
  public boolean stop()
  {
    if (! _lifecycle.toStopping())
      return false;

    log.finest(this + " stopping");

    closeConnections();

    destroy();

    return true;
  }
710919
@Override
   public final void stop() {
      // Trying to stop() from FAILED is valid, but may not work
      boolean failed;

      synchronized (this) {
         try {
            while (state == ComponentStatus.STOPPING) {
               wait();
            }
            if (!state.stopAllowed()) {
               getLog().debugf("Ignoring call to stop() as current state is %s", state);
               return;
            }

            failed = state == ComponentStatus.FAILED;
            state = ComponentStatus.STOPPING;
         } catch (InterruptedException e) {
            throw new CacheException("Interrupted waiting for the component registry to stop");
         }
      }

      preStop();

      try {
         internalStop();

         postStop();
      } catch (Throwable t) {
         if (failed) {
            getLog().failedToCallStopAfterFailure(t);
         } else {
            handleLifecycleTransitionFailure(t);
         }
      } finally {
         synchronized (this) {
            state = ComponentStatus.TERMINATED;
         }
      }
   }
244547
@Override
  public void stop() {
    if (!stopped.compareAndSet(false, true)) return;

    sweep();

    int retries = 0;
    while (count() > 1 && ++retries < 10) {
      try { Thread.sleep(10L); } catch (Exception e) {}
    }

    scheduler.close();
  }
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);
        }
    }
686891
private void stopScript(String line, DispatchCallback callback) {
    try {
      sqlLine.getScriptOutputFile().close();
    } catch (Exception e) {
      sqlLine.handleException(e);
    }

    sqlLine.output(sqlLine.loc("script-closed", sqlLine.getScriptOutputFile()));
    sqlLine.setScriptOutputFile(null);
    callback.setToSuccess();
  }
565589
void close() {

        final String methodName = "close";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        /*
         * Cancel any ongoing dispatch
         */
        _cancelled = true;

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
686303
@Override
    public void stop() {
        String command = "sudo service apache2 stop";
        newScript(STOPPING)
                .body.append(command).execute();
    }
1343251
public void stop()
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "stop");
        ivIsInitialized = false;
        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "stop");
    }
1334677
public void stop(int mode)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "stop");

        // Prevent any new async deletion activity kicking off a new background thread.
        setIsAsyncDeletionThreadStartable(false);

        // stop the async deletion thread if it's currently running.
        synchronized (deletionThreadLock)
        {
            if (asynchDeletionThread != null)
            {
                asynchDeletionThread.stopThread(messageProcessor.getStoppableThreadCache());
            }
        }

        //Make sure that this is null, so that unittests that only restart MP dont
        //see a half stopped asynch deletion thread.
        asynchDeletionThread = null;

        // Propogate the stop stimulus to the destination handlers...
        DestinationTypeFilter destFilter = new DestinationTypeFilter();
        destFilter.LOCAL = Boolean.TRUE;
        SIMPIterator itr = destinationIndex.iterator(destFilter);
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.stop(mode);
        }
        itr.finished();

        //busses
        itr = foreignBusIndex.iterator();
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.stop(mode);
        }
        itr.finished();

        //links
        LinkTypeFilter linkFilter = new LinkTypeFilter();
        linkFilter.LOCAL = Boolean.TRUE;
        itr = linkIndex.iterator(linkFilter); //d266910
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.stop(mode);
        }
        itr.finished();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "stop");
    }
1342873
public void stop() {
        if (cacheDispatcher != null) {
            cacheDispatcher.quit();
            addMarker(EVENT_CACHE_DISPATCHER_STOP, cacheDispatcher);

        }
        for (NetworkDispatcher netDispatcher : networkDispatchers) {
            if (netDispatcher != null) {
                netDispatcher.quit();
                addMarker(EVENT_NETWORK_DISPATCHER_STOP, netDispatcher);

            }
        }
    }
448974
public void stop()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "stop");

    if(started)
    {
      started = false;
      if(keyGroup != null)
        keyGroup.stopMember();
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "stop");
  }
680787
protected void stop(boolean close) throws IOException {
        if(!thread.isInterrupted()) {
            thread.interrupt();
        }

        conHandler.onDisconnected();

        if(close) con.close();
    }
773838
func Stop() {
	if dispatcher == nil {
		return
	}
	if err := dispatcher.Stop(); err != nil {
		fmt.Println("failed to stop:", err.Error())
	}
}
905643
void close(boolean alreadyClosed) {

        final String methodName = "close";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, alreadyClosed);
        }

        _closed = true;

        /*
         * 238811:
         * Stop all of the listeners - do not close them as the dispatchers
         * might still be using them. Close them after the dispatchers have
         * stopped.
         */

        /*
         * We close dispatchers as soon as they are finished with so no longer have to
         * close them here.
         */

        if (!alreadyClosed) {
            for (final Iterator iterator = _listeners.values().iterator(); iterator
                            .hasNext();) {
                final SibRaListener listener = (SibRaListener) iterator.next();
                listener.stop();
            }
        }

        // The connection is closing so throw away the connection name
        SibRaDispatcher.resetMEName();

        // We want this thread to wait until all the dispatchers have finished their work
        // (which will happen when the dispatcherCount hits 0. We put the thread into a
        // wait state if there are any dispatchers still going, the thread will be notified
        // each time a dispatcher closes (when it has finished its work).
        synchronized (_dispatcherCount) {
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                SibTr.debug(this, TRACE, "There are still " + _dispatcherCount.get() + " open dispatchers");
            }

            if (_dispatcherCount.get() > 0) {
                Long mdbQuiescingTimeout = getMDBQuiescingTimeoutProperty();
                waitForDispatchersToFinish(mdbQuiescingTimeout);
            }
        }

        /*
         * Close all of the listeners
         */
        if (!alreadyClosed) {
            for (final Iterator iterator = _listeners.values().iterator(); iterator
                            .hasNext();) {
                final SibRaListener listener = (SibRaListener) iterator.next();
                listener.close();
            }
        }
        _listeners.clear();

        /*
         * Close the connection
         */

        try {

            _connection.removeConnectionListener(_connectionListener);
            // It should be ok to call close on an already closed connection but comms
            // FFDCs thjis (processor seems ok with it though). No need to close the connection
            // again anyway so we'll check and if we are being called as part of MeTerminated or
            // connectionError then the connection will have been closed so dont close again.
            if (!alreadyClosed) {
                _connection.close();
            }

        } catch (final SIException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                                                   + methodName, "1:1023:1.59", this);
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                SibTr.exception(this, TRACE, exception);
            }

        } catch (final SIErrorException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                                                   + methodName, "1:1031:1.59", this);
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                SibTr.exception(this, TRACE, exception);
            }

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
1351180
@Override
  public void stop() throws IOException {
    if (jettyServer != null) {
      try {
        jettyServer.stop();
      } catch (IOException e) {
        throw e;
      } catch (Exception e) {
        throw new IOException(e);
      }
    }
  }