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 {
private String name;
private Version version;
private Date startDate;
private Date stopDate;
private boolean initialized = false;
private NodeID nodeID;
private static final NodeID DEFAULT_NODE_ID = new NodeID(new byte[0]);
......@@ -133,6 +132,7 @@ public class XMPPServer {
private static final String WRAPPER_CLASSNAME =
"org.tanukisoftware.wrapper.WrapperManager";
private boolean shuttingDown;
private XMPPServerInfoImpl xmppServerInfo;
/**
* Returns a singleton instance of XMPPServer.
......@@ -164,7 +164,7 @@ public class XMPPServer {
if (!initialized) {
throw new IllegalStateException("Not initialized yet");
}
return new XMPPServerInfoImpl(name, version, startDate, stopDate, getConnectionManager());
return xmppServerInfo;
}
/**
......@@ -417,6 +417,10 @@ public class XMPPServer {
try {
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
File pluginDir = new File(openfireHome, "plugins");
pluginManager = new PluginManager(pluginDir);
......@@ -444,8 +448,6 @@ public class XMPPServer {
Log.info(startupBanner);
System.out.println(startupBanner);
startDate = new Date();
stopDate = null;
// Notify server listeners that the server has been started
for (XMPPServerListener listener : listeners) {
listener.serverStarted();
......@@ -638,7 +640,6 @@ public class XMPPServer {
}
else {
shutdownServer();
stopDate = new Date();
Thread shutdownThread = new ShutdownThread();
shutdownThread.setDaemon(true);
shutdownThread.start();
......@@ -648,7 +649,6 @@ public class XMPPServer {
// Close listening socket no matter what the condition is in order to be able
// to be restartable inside a container.
shutdownServer();
stopDate = new Date();
}
}
......
......@@ -54,14 +54,6 @@ public interface XMPPServerInfo {
*/
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.
*
......
......@@ -11,11 +11,11 @@
package org.jivesoftware.openfire.spi;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Version;
import org.jivesoftware.openfire.ConnectionManager;
import org.jivesoftware.openfire.ServerPort;
import org.jivesoftware.openfire.XMPPServerInfo;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Version;
import java.util.Collection;
import java.util.Collections;
......@@ -30,7 +30,6 @@ import java.util.Date;
public class XMPPServerInfoImpl implements XMPPServerInfo {
private Date startDate;
private Date stopDate;
private String name;
private Version ver;
private ConnectionManager connectionManager;
......@@ -42,17 +41,12 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
* @param version the server's version number.
* @param startDate the server's last start time (can be null indicating
* 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.
*/
public XMPPServerInfoImpl(String serverName, Version version, Date startDate, Date stopDate,
ConnectionManager connectionManager)
{
public XMPPServerInfoImpl(String serverName, Version version, Date startDate, ConnectionManager connectionManager) {
this.name = serverName;
this.ver = version;
this.startDate = startDate;
this.stopDate = stopDate;
this.connectionManager = connectionManager;
}
......@@ -78,10 +72,6 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
return startDate;
}
public Date getLastStopped() {
return stopDate;
}
public Collection<ServerPort> getServerPorts() {
if (connectionManager == null) {
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