Commit 167b23dd authored by Guus der Kinderen's avatar Guus der Kinderen Committed by daryl herzmann

Minor improvements: more logging and removal of dead code. (#651)

* OF-1147: More debug logging.

* Removed unreachable code.
parent 7bbf9ef7
......@@ -560,19 +560,15 @@ public class XMPPServer {
private void initModules() {
for (Module module : modules.values()) {
boolean isInitialized = false;
try {
module.initialize(this);
isInitialized = true;
}
catch (Exception e) {
e.printStackTrace();
// Remove the failed initialized module
this.modules.remove(module.getClass());
if (isInitialized) {
module.stop();
module.destroy();
}
module.stop();
module.destroy();
logger.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
}
......@@ -585,16 +581,12 @@ public class XMPPServer {
*/
private void startModules() {
for (Module module : modules.values()) {
boolean started = false;
try {
logger.debug( "Starting module: " + module.getName() );
module.start();
}
catch (Exception e) {
if (started && module != null) {
module.stop();
module.destroy();
}
logger.error(LocaleUtils.getLocalizedString("admin.error"), e);
logger.error( "An exception occurred while starting module '{}'.", module.getName(), e );
}
}
}
......
......@@ -20,24 +20,19 @@
package org.jivesoftware.openfire.spi;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.util.*;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.jivesoftware.openfire.*;
import org.jivesoftware.openfire.Connection;
import org.jivesoftware.openfire.ConnectionManager;
import org.jivesoftware.openfire.ServerPort;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.BasicModule;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.container.PluginManagerListener;
import org.jivesoftware.openfire.http.HttpBindManager;
import org.jivesoftware.openfire.keystore.CertificateStoreManager;
import org.jivesoftware.openfire.net.*;
import org.jivesoftware.openfire.net.SocketSendingTracker;
import org.jivesoftware.openfire.session.ConnectionSettings;
import org.jivesoftware.util.CertificateEventListener;
import org.jivesoftware.util.CertificateManager;
......@@ -46,6 +41,13 @@ import org.jivesoftware.util.PropertyEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.util.*;
public class ConnectionManagerImpl extends BasicModule implements ConnectionManager, CertificateEventListener, PropertyEventListener
{
public static final String EXECUTOR_FILTER_NAME = "threadModel";
......@@ -274,24 +276,32 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
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()) {
pluginManager.addPluginManagerListener(new PluginManagerListener() {
public void pluginsMonitored() {
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);
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 )
{
......@@ -303,6 +313,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
try
{
HttpBindManager.getInstance().start();
Log.debug( "Started HTTP client listener." );
}
catch ( RuntimeException ex )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment