Commit 16a1835d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Small optimization.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8696 b35dd754-fafc-0310-a699-88a17e54d16e
parent 451866aa
...@@ -97,7 +97,6 @@ public class XMPPServer { ...@@ -97,7 +97,6 @@ public class XMPPServer {
private String name; private String name;
private Version version; private Version version;
private Date startDate; private Date startDate;
private Date stopDate;
private boolean initialized = false; private boolean initialized = false;
private NodeID nodeID; private NodeID nodeID;
private static final NodeID DEFAULT_NODE_ID = new NodeID(new byte[0]); private static final NodeID DEFAULT_NODE_ID = new NodeID(new byte[0]);
...@@ -133,6 +132,7 @@ public class XMPPServer { ...@@ -133,6 +132,7 @@ public class XMPPServer {
private static final String WRAPPER_CLASSNAME = private static final String WRAPPER_CLASSNAME =
"org.tanukisoftware.wrapper.WrapperManager"; "org.tanukisoftware.wrapper.WrapperManager";
private boolean shuttingDown; private boolean shuttingDown;
private XMPPServerInfoImpl xmppServerInfo;
/** /**
* Returns a singleton instance of XMPPServer. * Returns a singleton instance of XMPPServer.
...@@ -164,7 +164,7 @@ public class XMPPServer { ...@@ -164,7 +164,7 @@ public class XMPPServer {
if (!initialized) { if (!initialized) {
throw new IllegalStateException("Not initialized yet"); throw new IllegalStateException("Not initialized yet");
} }
return new XMPPServerInfoImpl(name, version, startDate, stopDate, getConnectionManager()); return xmppServerInfo;
} }
/** /**
...@@ -417,6 +417,10 @@ public class XMPPServer { ...@@ -417,6 +417,10 @@ public class XMPPServer {
try { try {
initialize(); initialize();
startDate = new Date();
// Store server info
xmppServerInfo = new XMPPServerInfoImpl(name, version, startDate, getConnectionManager());
// Create PluginManager now (but don't start it) so that modules may use it // Create PluginManager now (but don't start it) so that modules may use it
File pluginDir = new File(openfireHome, "plugins"); File pluginDir = new File(openfireHome, "plugins");
pluginManager = new PluginManager(pluginDir); pluginManager = new PluginManager(pluginDir);
...@@ -444,8 +448,6 @@ public class XMPPServer { ...@@ -444,8 +448,6 @@ public class XMPPServer {
Log.info(startupBanner); Log.info(startupBanner);
System.out.println(startupBanner); System.out.println(startupBanner);
startDate = new Date();
stopDate = null;
// Notify server listeners that the server has been started // Notify server listeners that the server has been started
for (XMPPServerListener listener : listeners) { for (XMPPServerListener listener : listeners) {
listener.serverStarted(); listener.serverStarted();
...@@ -638,7 +640,6 @@ public class XMPPServer { ...@@ -638,7 +640,6 @@ public class XMPPServer {
} }
else { else {
shutdownServer(); shutdownServer();
stopDate = new Date();
Thread shutdownThread = new ShutdownThread(); Thread shutdownThread = new ShutdownThread();
shutdownThread.setDaemon(true); shutdownThread.setDaemon(true);
shutdownThread.start(); shutdownThread.start();
...@@ -648,7 +649,6 @@ public class XMPPServer { ...@@ -648,7 +649,6 @@ public class XMPPServer {
// Close listening socket no matter what the condition is in order to be able // Close listening socket no matter what the condition is in order to be able
// to be restartable inside a container. // to be restartable inside a container.
shutdownServer(); shutdownServer();
stopDate = new Date();
} }
} }
......
...@@ -54,14 +54,6 @@ public interface XMPPServerInfo { ...@@ -54,14 +54,6 @@ public interface XMPPServerInfo {
*/ */
public Date getLastStarted(); public Date getLastStarted();
/**
* Obtain the date when the server was last stopped.
*
* @return the date the server was stopped or null if server has not been
* started or is still running
*/
public Date getLastStopped();
/** /**
* Obtain the server ports active on this server. * Obtain the server ports active on this server.
* *
......
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
package org.jivesoftware.openfire.spi; package org.jivesoftware.openfire.spi;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Version;
import org.jivesoftware.openfire.ConnectionManager; import org.jivesoftware.openfire.ConnectionManager;
import org.jivesoftware.openfire.ServerPort; import org.jivesoftware.openfire.ServerPort;
import org.jivesoftware.openfire.XMPPServerInfo; import org.jivesoftware.openfire.XMPPServerInfo;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Version;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
...@@ -30,7 +30,6 @@ import java.util.Date; ...@@ -30,7 +30,6 @@ import java.util.Date;
public class XMPPServerInfoImpl implements XMPPServerInfo { public class XMPPServerInfoImpl implements XMPPServerInfo {
private Date startDate; private Date startDate;
private Date stopDate;
private String name; private String name;
private Version ver; private Version ver;
private ConnectionManager connectionManager; private ConnectionManager connectionManager;
...@@ -42,17 +41,12 @@ public class XMPPServerInfoImpl implements XMPPServerInfo { ...@@ -42,17 +41,12 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
* @param version the server's version number. * @param version the server's version number.
* @param startDate the server's last start time (can be null indicating * @param startDate the server's last start time (can be null indicating
* it hasn't been started). * it hasn't been started).
* @param stopDate the server's last stop time (can be null indicating it
* is running or hasn't been started).
* @param connectionManager the object that keeps track of the active ports. * @param connectionManager the object that keeps track of the active ports.
*/ */
public XMPPServerInfoImpl(String serverName, Version version, Date startDate, Date stopDate, public XMPPServerInfoImpl(String serverName, Version version, Date startDate, ConnectionManager connectionManager) {
ConnectionManager connectionManager)
{
this.name = serverName; this.name = serverName;
this.ver = version; this.ver = version;
this.startDate = startDate; this.startDate = startDate;
this.stopDate = stopDate;
this.connectionManager = connectionManager; this.connectionManager = connectionManager;
} }
...@@ -78,10 +72,6 @@ public class XMPPServerInfoImpl implements XMPPServerInfo { ...@@ -78,10 +72,6 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
return startDate; return startDate;
} }
public Date getLastStopped() {
return stopDate;
}
public Collection<ServerPort> getServerPorts() { public Collection<ServerPort> getServerPorts() {
if (connectionManager == null) { if (connectionManager == null) {
return Collections.emptyList(); return Collections.emptyList();
......
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