Notifies the listener that the given messaging engine is being destroyed.

@param messagingEngine
the messaging engine
342293
public void messagingEngineDestroyed(final 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; attempt to connect to a remote messaging engine
             * instead
             */

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

            _remoteDestination = true;

            // Synchronized so that other threads will see that we're connecting to a remote ME
            synchronized(this) {
                _remoteMessagingEngine = true;
            }

            createRemoteListenerDeactivateOnException(true);

        }

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

    }
198700
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
        checkNotNull(messageListenerDefinition);

        ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
        if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
            throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
                    .put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        try {
            createMessageConsumer(messageListenerDefinition);
        } catch (JMSException e) {
            throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
            throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }
    }
365883
private synchronized void notifyConnectionLost(final IoSession session) {
        new Thread("Connection-Closed-Notifier") {
            @Override
            public void run() {
                // todo: sml: should consider rationalising these so they're all HandlerListeners..
                if (connectedObjectManager != null) {
                    connectedObjectManager.sessionTerminated(session);
                }
                for (HandlerListener listener : handlerListeners) {
                    listener.sessionClosed(session);
                }
                RequestResponseManager requestResponseManager = (RequestResponseManager) session.getAttribute(RequestResponseManager.SESSION_KEY);
                if (requestResponseManager != null) {
                    requestResponseManager.sessionClosed(session);
                }
            }
        }.start();
    }
793692
@MainThread
    @ObjectiveCName("unsubscribeWithListener:")
    public synchronized void unsubscribe(@NotNull ModelChangedListener<GroupVM> listener) {
        listeners.remove(listener);
    }
341760
public static synchronized void registerEngine(RenderEngine engine) {
    if (null == availableEngines) {
      availableEngines = new HashMap();
    }
    availableEngines.put(engine.getName(), engine);
  }
1171031
public boolean removeNotificationListener(String mbeanName, NotificationListener listener) throws Exception {
        if (isConnected()) {
            ObjectName objectName = new ObjectName(mbeanName);
            mbsc.removeNotificationListener(objectName, listener, null, null);
            jmxc.removeConnectionNotificationListener(listener);
            return true;
        } else {
            return false;
        }
    }
1071751
void messagingEngineTerminated(
            final SibRaMessagingEngineConnection connection) {

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

        /*
         * Close the connection - any future work will attempt to create a new
         * connection
         */

        closeConnection(connection.getConnection().getMeUuid(), true);

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

    }
1275723
protected final void closeConnection(final JsMessagingEngine messagingEngine) {

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

        closeConnection(messagingEngine.getUuid().toString());

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

    }
673585
public static boolean isMessagingEngineReloading(final String meUuid) {

        final String methodName = "isMessagingEngineReloading";
        if (TRACE.isEntryEnabled()) {
            SibTr.entry(TRACE, methodName, meUuid);
        }

        final boolean reloading = RELOADING_MESSAGING_ENGINES.contains(meUuid);

        if (TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, methodName, Boolean.valueOf(reloading));
        }
        return reloading;

    }
1283162
@Override
    public void engineReloaded(Object messagingEngine)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "engineReloaded");

        // Defect 337421.1
        // Our config has been reloaded so we need to essentially
        // re-initialize so that the next time that we run start()
        // we pick up any changes.
        initialize((JsMessagingEngine) messagingEngine, true);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "engineReloaded");
    }
832058
public void setEngine(final ActionEngine engine) {
	if (!Objects.equals(this.engine, engine)) { // Only if changed
	    synchronized (contexts) {
		contexts.clear();
	    }
	}
	this.engine = engine;
    }
286952
synchronized protected void addMessagingEngine(
            final JsMessagingEngine messagingEngine) {

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

        SibRaMessagingEngineConnection connection = null;
        try {

            /*
             * Get a connection for the messaging engine
             */

            connection = getConnection(messagingEngine);
            final SICoreConnection coreConnection = connection.getConnection();

            if (coreConnection instanceof SICoreConnection) {

                /*
                 * Create destination listener
                 */

                final DestinationListener destinationListener = new SibRaDestinationListener(
                        connection, _messageEndpointFactory);

                /*
                 * Determine destination type
                 */

                final DestinationType destinationType = _endpointConfiguration
                        .getDestinationType();

                /*
                 * Register destination listener
                 */

                final SIDestinationAddress[] destinations = coreConnection
                        .addDestinationListener(null,
                                destinationListener,
                                destinationType,
                                DestinationAvailability.RECEIVE);

                /*
                 * Create a listener for each destination ...
                 */

                for (int j = 0; j < destinations.length; j++) {

                    try {

                        connection.createListener(destinations[j], _messageEndpointFactory);

                    } catch (final ResourceException exception) {

                        FFDCFilter.processException(exception, CLASS_NAME + "."
                                + methodName, FFDC_PROBE_1, this);
                        SibTr.error(TRACE, "CREATE_LISTENER_FAILED_CWSIV0803",
                                new Object[] { exception,
                                        destinations[j].getDestinationName(),
                                        messagingEngine.getName(),
                                        messagingEngine.getBusName() });

                    }

                }

            }

        } catch (final SIException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                    + methodName, FFDC_PROBE_2, this);
            SibTr.error(TRACE, "ADD_DESTINATION_LISTENER_FAILED_CWSIV0804",
                    new Object[] { exception, messagingEngine.getName(),
                            messagingEngine.getBusName() });
            closeConnection(messagingEngine);

        } catch (final ResourceException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                    + methodName, FFDC_PROBE_3, this);
            SibTr.error(TRACE, "CREATE_CONNECTION_FAILED_CWSIV0801",
                    new Object[] { exception, messagingEngine.getName(),
                            messagingEngine.getBusName() });
            closeConnection(messagingEngine);

        }

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

    }
1361017
public void messagingEngineReloaded(final JsMessagingEngine engine) {

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

        boolean engineStarted = false;
        // Get all the active ME's that are on the same bus as the reloaded ME
        JsMessagingEngine[] engines = SibRaEngineComponent.getActiveMessagingEngines(engine.getBusName());

        for (int i = 0; i < engines.length; i++)
        {
          // Now check if the reloaded ME is part of the active ME's (i.e. a started ME
          if (engines[i].equals(engine))
          {
            //It is active so lets mark the engine as started
            engineStarted = true;
            break;
          }
        }

        // Only do this logic on a started engine. If the engine isn't started then when
        // the start is called we will do the same logic of trying to create a listener,
        // so there is no need to wait here till it starts.
        if (engineStarted)
        {
          try
          {

            /*
             * If there is not already a connection to the messaging engine and
             * a listener is still required given the new configuration, create
             * one now
             */

            if (!_connections.containsKey(engine.getUuid().toString())
                    && isListenerRequired(engine)) {

                createListener(engine);

            }

          }
          catch (final ResourceException exception)
          {

            // No FFDC code needed

            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                SibTr.exception(this, TRACE, exception);
            }

            SibTr.error(TRACE, "RELOAD_FAILED_CWSIV0773", new Object[] {
                    exception, engine.getName(), engine.getBusName(), this });

          }
        } // end of if(engineStarted)

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

    }
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");
    }
1152520
private void callListeners(final CFMLEngine engine) {
	final Iterator<EngineChangeListener> it = listeners.iterator();
	while (it.hasNext())
	    it.next().onUpdate();
    }
317872
public void close()
    {
        if (forwardEngine != null)
            forwardEngine.close();
        if (reverseEngine != null)
            reverseEngine.close();

        forwardEngine = null;
        reverseEngine = null;
    }
912052
public void removeListener(final TypingListener typingListener) {
        MessagingListener messagingListener = typingListeners.get(typingListener);
        if (messagingListener != null) {
            client.removeListener(messagingListener);
            typingListeners.remove(typingListener);
        }
    }