Stop a messaging engine

@param busName
@param name
@param mode
555003
private void stopMessagingEngine(String busName, String name, int mode)
                    throws Exception {

        String thisMethodName = CLASS_NAME
                                + ".stopMessagingEngine(String, String, int)";

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, thisMethodName, new Object[] { busName, name,
                                                          Integer.toString(mode) });
        }

        BaseMessagingEngineImpl me = (BaseMessagingEngineImpl) getMessagingEngine(
                                                                                  busName, name);
        if (me != null) {
            me.stopConditional(mode);
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Unable to locate engine <bus=" + busName
                                + " name=" + name + ">");
            throw new Exception("The messaging engine <bus=" + busName
                                + " name=" + name + "> does not exist");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, thisMethodName);
        }
    }
1128192
public void unsubscribeDurable(String subscriptionName)
            throws MessagingException {
        try {
            Session session =
                connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer consumer = durableSubscriptions.get(subscriptionName);
            if(consumer != null) {
                consumer.close();
            }
            session.unsubscribe(subscriptionName);
        } catch (JMSException jmse) {
            String errMsg = "Unable to unsubscribe from subscription with name: "
                          + subscriptionName + " due to exception: "
                          + jmse.getMessage();
            logger.debug(errMsg, jmse);
            throw new MessagingException(errMsg, jmse);
        }
    }
997377
public void signal(String name) throws UnknownTransitionException {

        // check that start state defined
        if (start == null) {
            throw new IllegalStateException("The start sate is not defined");
        }

        // check that end state defined
        if (end == null) {
            throw new IllegalStateException("The end sate is not defined");
        }

        // ignore any signals if fsm reaches end state
        // if (state == end) {
        // return;
        // }

        oldState = currentState;
        // switch to next state
        currentState = currentState.signal(name);
        if (logger.isDebugEnabled()) {
            logger.debug(String.format("%s Transition to=%s", toString(), name));
        }
    }
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");
    }
12519
public void stop() {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName beanName = null;
        try {
            beanName = getObjectName();
            server.unregisterMBean(beanName);
        } catch (InstanceNotFoundException e) {
            LOGGER.debug("JMX bean {0} not found", beanName);
        } catch (Exception e) {
            LOGGER.error(e, JcrI18n.cannotUnRegisterMBean, beanName);
        }
    }
872909
void deactivate() {

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

        _active = false;

        /*
         * Deregister the messaging engine listener
         */

        SibRaEngineComponent.deregisterMessagingEngineListener(this,
                _endpointConfiguration.getBusName());

        /*
         * Close all of the connections
         */

        synchronized (_connections) {

            for (final Iterator iterator = _connections.values().iterator(); iterator
                    .hasNext();) {

                final SibRaMessagingEngineConnection connection = (SibRaMessagingEngineConnection) iterator
                        .next();
                connection.close();

            }

            _connections.clear();

        }

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

    }
1358296
public void messagingEngineDestroyed(JsMessagingEngine messagingEngine)
    {
        final String methodName = "messagingEngineDestroyed";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, messagingEngine);
        }

        /*
         * If there are no longer any local messaging engines on the required
         * bus, switch to a remote messaging engine
         */

        final JsMessagingEngine[] localMessagingEngines = SibRaEngineComponent
                .getMessagingEngines(_endpointConfiguration.getBusName());

        if (0 == localMessagingEngines.length)
        {
            /*
             * The last local messaging engine for the required bus has been
             * destroyed; we may be able to now connect remotely so kick off
             * a check.
             */

            SibTr.info(TRACE, "ME_DESTROYED_CWSIV0779", new Object[] {
                    messagingEngine.getName(),
                    _endpointConfiguration.getBusName() });

          try
          {
                clearTimer ();
                timerLoop ();
            }
          catch (final ResourceException exception)
          {

                FFDCFilter.processException(exception, CLASS_NAME + "."
                        + methodName, FFDC_PROBE_1, this);
                SibTr.error(TRACE, "MESSAGING_ENGINE_STOPPING_CWSIV0765",
                        new Object[] { exception, messagingEngine.getName(),
                                messagingEngine.getBusName() });
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
309241
public final synchronized void stop() {
		LaunchingMessageKind.IJMX0003.format();
		unRegisterMBeans();

		try {
			if (this.jmxConnectorServer != null) {
				this.jmxConnectorServer.stop();
			}
		} catch (IOException e1) {
			// Do nothing
		}
		try {
			UnicastRemoteObject.unexportObject(register, true);
		} catch (NoSuchObjectException e) {
			// Do nothing
		}
	}
137661
public void cancel(final String eventName) {

        BurstEvent oe = m_memory.remove(eventName);
        if (oe != null) {
            // disable the old event.
            oe.getTimer().cancel();
        }
    }
1278857
@Override
    public void stop(int mode) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "stop, mode ", mode);

        // Now force state to STOPPING - regardless of how we got here
        setState(STATE_STOPPING);

        // Reset MP Admin
        _localizer.clearMPAdmin();
        _mpAdmin = null;
        _messageProcessor.stop(mode);
        _messageStore.stop(mode);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "Messaging Engine " + _name + " finished stop phases");

        setState(STATE_STOPPED);
        SibTr.debug(tc, "Messaging Engine stopped");
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "Messaging Engine " + _name + " has been stopped before dynamic config cycle completed.");

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.debug(tc, "stop");
    }
1074519
public boolean stop(ShutdownModeAmp mode)
  {
    Objects.requireNonNull(mode);
    
    if (! _lifecycle.toStop()) {
      return false;
    }
    
    _shutdownMode = mode;

    /*
    if (_podBuilder != null) {
      ServiceRefAmp.toServiceRef(_podBuilder).shutdown(mode);
      ServiceRefAmp.toServiceRef(_podsDeployService).shutdown(mode);
      ServiceRefAmp.toServiceRef(_podsConfigService).shutdown(mode);
    }
    */

    return true;
  }
409314
public void stop(String name)
    {
        GVRAnimator anim = findAnimation(name);

        if (anim != null)
        {
            mIsRunning = false;
            anim.stop();
        }
    }
127169
@Override
    public void stop(int mode) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "stop", new Integer(mode));

        try {
            // Check whether the stop is from COMMS server to stop MP
            // connection. In that case just call closeConnection and return
            if (mode == JsConstants.ME_STOP_COMMS_CONNECTIONS) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc,
                                "Stop request from Comms server for COMMS connections");
                closeConnections(JsConstants.ME_STOP_QUIESCE,
                                 SIMPConstants.MP_VIACOMMS_CONNECTION);
                return;
            }

            if (mode == JsConstants.ME_STOP_COMMS_SSL_CONNECTIONS) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc,
                                "Stop request from Comms server for COMMS SSL connections");
                closeConnections(JsConstants.ME_STOP_QUIESCE,
                                 SIMPConstants.MP_VIACOMMSSSL_CONNECTION);
                return;
            }
        } catch (Exception e) {
            //Absorb the exception and log in trace
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                if (mode == JsConstants.ME_STOP_COMMS_CONNECTIONS)
                    SibTr.debug(tc, "Failure in closing COMMS connections", e);
                else
                    SibTr.debug(tc, "Failure in closing COMMS over SSL connections", e);

            }
            return;
        }

        try {
            // Tell everything we control that MP is stopping now.
            announceMPStopping();

            // Block all new create Connection calls and all calls to
            // connection.close by obtaining the exclusive lock
            _connectionsLockManager.lockExclusive();

            synchronized (_mpStartStopLock) {
                if (_starting) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isDebugEnabled())
                        SibTr.debug(tc, "Stop waiting until start complete");

                    try {
                        _mpStartStopLock.wait();
                    } catch (InterruptedException e) {
                        // No FFDC code needed
                        if (TraceComponent
                                        .isAnyTracingEnabled()
                            && tc.isDebugEnabled())
                            SibTr.exception(tc, e);
                    }
                }

                if (!_started) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isEntryEnabled())
                        SibTr.exit(tc, "stop", "Returning as not started.");
                    return;
                }

                _started = false;

                // Stop the mpio to stop processing any more remote messages.
                _mpio.stop();

                // Stop all the threads that have been started
                _stoppableThreadCache.stopAllThreads();

                // Stop expiry first - while stopping we don't want any messages
                // to
                // expire.
                _msgStore.expirerStop();

                _msgStore.deliveryDelayManagerStop();

                // If the destination manager was not found at startup, then
                // this
                // object will be null.
                if (_destinationManager == null) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isEntryEnabled())
                        SibTr.exit(tc, "stop", "Null DM");
                    return;
                }

                _destinationManager.stop(mode);

                //close all in-process connections .
                closeConnections(mode, SIMPConstants.MP_INPROCESS_CONNECTION);

                // Stop the administrator
                _administrator.stop();

                // Tell MFP that the message store is about to be stopped.
                SchemaStore.messageStoreStoppingNotify(_msgStore);

            } // end sync
        } finally {
            _connectionsLockManager.unlockExclusive();
            // _persistentStore=null is not needed as during reconstitute it is created from messagestore store as a fresh object.
            if (_consumerThreadPool != null) {
                _consumerThreadPool.shutdownNow();
                _consumerThreadPool = null;
            }
            if (_systemThreadPool != null) {
                _systemThreadPool.shutdownNow();
                _systemThreadPool = null;
            }

        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "stop");
    }
891667
void onContextStopped(Context context) {
		TinyBus bus = mBuses.get(context);
		if (bus != null) {
			bus.getLifecycleCallbacks().onStop();
		}
		if (DEBUG) Log.d(TAG, " ### STOPPED, bus count: " + mBuses.size());
	}
1324500
public void stop(int mode)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "stop", "Mode="+mode);

        // Defect 363755
        // Stop any new work coming in as soon as we start stopping.
        // This way we make sure nothing is attempted during the
        // (possibly long) time it takes for the OM to shutdown.
        _available = false;

  

        // Defect 496893
        // Set the shutdown flag so we can tell if the callback from
        // the object manager was requested or not.
        _shutdownRequested = true;

        // Defect 549131
        // Check to see if we have an active startup thread
        if (_starting)
        {
            // Synchronize with the startup thread
            synchronized(this)
            {
                // We have an active startup thread so we need 
                // to inform it that it should give up.
                _starting = false;
    
                // We may need to wake up the startup thread for
                // it to check the flag so notify.
                notify();
            }
        }

        // Defect 530772
        // Stop spill dispatcher first so that it
        // can flush it's buffers before we stop the
        // object manager.
        if (_spillDispatcher != null)
        {
            _spillDispatcher.stop(mode);

            _spillDispatcher = null;
        }

        _batchingContextFactory = null;

        if (_objectManager != null)
        {
            try
            {
                _objectManager.shutdown();
            }
            catch (ObjectManagerException ome)
            {
                com.ibm.ws.ffdc.FFDCFilter.processException(ome, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.stop", "1:764:1.81.1.6", this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Unexpected exception caught stopping persistent message store!", ome);
            }

            _objectManager  = null;
            _permanentStore = null;
            _temporaryStore = null;
        }

        if (_uniqueKeyManager != null)
        {
            _uniqueKeyManager.stop();

            _uniqueKeyManager = null;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "stop");
    }
11914
def stop(name, call=None):
    '''
    
    '''
    conn = get_conn()
    node = get_node(conn, name)  # pylint: disable=not-callable
    log.debug('Node of Cloud VM: %s', node)

    status = conn.ex_shutdown_graceful(node)
    log.debug('Status of Cloud VM: %s', status)

    return status
44569
@Override
  public void stop(ShutdownModeAmp mode)
  {
    _lifecycle.toDestroy();
    
    _activeService.set(null);
    
    FailSafeHaltThread failSafeThread = _failSafeHaltThread;
    
    if (failSafeThread != null) {
      failSafeThread.wake();
    }
    
    FailSafeMemoryFreeThread memoryFreeThread = _failSafeMemoryFreeThread;
    
    if (memoryFreeThread != null)
      memoryFreeThread.startShutdown();
    
    ShutdownThread shutdownThread = _shutdownThread;
    
    if (shutdownThread != null)
      shutdownThread.wake();
  }