Search in sources :

Example 1 with PluginManagerListener

use of org.jivesoftware.openfire.container.PluginManagerListener in project Openfire by igniterealtime.

the class ConnectionManagerImpl method startListeners.

/**
     * Starts all listeners. This ensures that all those that are enabled will start accept connections.
     */
private synchronized void startListeners() {
    // Check if plugins have been loaded
    Log.debug("Received a request to start listeners. Have plugins been loaded?");
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    if (!pluginManager.isExecuted()) {
        Log.debug("Plugins not yet loaded. Waiting for plugins to be loaded...");
        pluginManager.addPluginManagerListener(new PluginManagerListener() {

            public void pluginsMonitored() {
                Log.debug("Received plugin monitor event! Plugins should now be loaded.");
                // Stop listening for plugin events
                XMPPServer.getInstance().getPluginManager().removePluginManagerListener(this);
                // Start listeners
                startListeners();
            }
        });
        return;
    }
    Log.debug("Starting listeners...");
    for (final ConnectionListener listener : getListeners()) {
        try {
            listener.start();
            Log.debug("Started '{}' (port {}) listener.", listener.getType(), listener.getPort());
        } catch (RuntimeException ex) {
            Log.error("An exception occurred while starting listener " + listener, ex);
        }
    }
    // Start the HTTP client listener.
    try {
        HttpBindManager.getInstance().start();
        Log.debug("Started HTTP client listener.");
    } catch (RuntimeException ex) {
        Log.error("An exception occurred while starting HTTP Bind listener ", ex);
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) PluginManagerListener(org.jivesoftware.openfire.container.PluginManagerListener)

Aggregations

PluginManager (org.jivesoftware.openfire.container.PluginManager)1 PluginManagerListener (org.jivesoftware.openfire.container.PluginManagerListener)1