code: public synchronized void messagingEngineStopping(
              final JsMessagingEngine messagingEngine, final int mode) {
  
          final String methodName = "messagingEngineStopping";
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
              SibTr.entry(this, TRACE, methodName, new Object[] {
                      messagingEngine, mode });
          }
  
          super.messagingEngineStopping(messagingEngine, mode);
  
          try {
  
              /*
               * If a connection to any messaging engine is required, there are
               * now no connections but there are still other messaging engines
               * available, then connect to another one at random
               */
  
              final Set requiredMessagingEngines = getRequiredMessagingEngines(messagingEngine);
              final JsMessagingEngine[] activeMessagingEngines = SibRaEngineComponent
                      .getActiveMessagingEngines(_endpointConfiguration
                              .getBusName());
  
              if ((requiredMessagingEngines.size() == 0)
                      && (_connections.size() == 0)) {
  
                  if (activeMessagingEngines.length > 0) {
  
                      final int randomIndex = _random
                              .nextInt(activeMessagingEngines.length);
  
                      createListener(activeMessagingEngines[randomIndex]);
  
                  } else {
  
                      SibTr.info(TRACE, "LAST_ME_CWSIV0768", new Object[] {
                              messagingEngine.getName(),
                              messagingEngine.getBus(), this });
  
                  }
  
              }
  
          } catch (final ResourceException exception) {
  
              FFDCFilter.processException(exception, CLASS_NAME + "."
                      + methodName, FFDC_PROBE_4, 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);
          }
  
      }
docs: Overrides the parent method so that, if the messaging engine that is
  stopping was the any one messaging engine to which a connection had been
  made, if there are still active messaging engines then connect to one of
  those instead.
  
  @param messagingEngine
  the messaging engine that is stopping
  @param mode
  the mode with which the engine is stopping