modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
| 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
| 58 ++++++++--
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
| 9 +
3 files changed, 56 insertions(+), 15 deletions(-)
New commits:
commit ca7c3763fd627f0c26a8f6cfd48f3e929f64e2be
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 22 15:58:36 2011 -0500
[BZ 759640] this also appears related to BZ 765670 - have the installer ping the
startup servlet to know if the server is fully installed and ready
diff --git a/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
b/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
index 673b018..7c04d9d 100644
--- a/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
+++ b/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
@@ -20,7 +20,7 @@
<c:if test="<%= new ServerInformation().isFullyDeployed() &&
request.getRequestURI().indexOf("installer/start") == -1 %>">
<script type="text/javascript" language="JavaScript">
- var startPage = '/Dashboard.do';
+ var startPage = '/startupstatus';
var xmlRequest = false;
function doLoad()
@@ -49,7 +49,7 @@
}
xmlRequest.onreadystatechange = processStateChange;
- xmlRequest.open('GET', startPage, true);
+ xmlRequest.open('HEAD', startPage, true);
xmlRequest.send(null);
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
index bc3942a..3add80f 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.startup;
+import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Connection;
@@ -31,6 +32,8 @@ import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@@ -44,7 +47,6 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.cloud.Server;
import org.rhq.core.domain.cloud.Server.OperationMode;
import org.rhq.core.domain.common.ProductInfo;
-import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.domain.configuration.PropertyDynamicType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.gui.configuration.helper.PropertyRenderingUtility;
@@ -65,7 +67,17 @@ import
org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.scheduler.jobs.*;
+import org.rhq.enterprise.server.scheduler.jobs.AsyncResourceDeleteJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForSuspectedAgentsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutConfigUpdatesJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutContentRequestsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutOperationsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CloudManagerJob;
+import org.rhq.enterprise.server.scheduler.jobs.DataPurgeJob;
+import org.rhq.enterprise.server.scheduler.jobs.DynaGroupAutoRecalculationJob;
+import org.rhq.enterprise.server.scheduler.jobs.PurgePluginsJob;
+import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
+import org.rhq.enterprise.server.scheduler.jobs.SavedSearchResultCountRecalculationJob;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.concurrent.AlertSerializer;
import org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
@@ -73,6 +85,8 @@ import
org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
/**
* This servlet is ensured to be initialized after the rest of the RHQ Server has been
deployed and started.
* Specifically, we know that at {@link #init()} time, all EJBs have been deployed and
available.
+ *
+ * This also accepts requests and responds with information regarding the state of the
startup.
*/
public class StartupServlet extends HttpServlet {
@@ -80,6 +94,20 @@ public class StartupServlet extends HttpServlet {
private Log log = LogFactory.getLog(this.getClass());
+ private boolean initialized = false;
+
+ /**
+ * This merely returns an HTTP status code to indicate the status of the startup.
+ * Under normal conditions, this will always return a 200 status code.
+ */
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException {
+ resp.setHeader("Cache-Control", "no-cache, no-store");
+ resp.setHeader("Expires", "-1");
+ resp.setHeader("Pragma", "no-cache");
+ resp.setStatus(initialized ? HttpServletResponse.SC_OK :
HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+ }
+
/**
* Performs the final RHQ Server initialization work that needs to talk place. EJBs
are available in this method.
*
@@ -87,6 +115,8 @@ public class StartupServlet extends HttpServlet {
*/
@Override
public void init() throws ServletException {
+ initialized = false;
+
log.info("All business tier deployments are complete - finishing the
startup...");
// As a security measure, make sure the installer has been undeployed
@@ -138,6 +168,7 @@ public class StartupServlet extends HttpServlet {
logServerStartedMessage();
+ initialized = true;
return;
}
@@ -339,8 +370,12 @@ public class StartupServlet extends HttpServlet {
try {
ServerCommunicationsServiceUtil.getService().startCommunicationServices();
-
ServerCommunicationsServiceUtil.getService().getServiceContainer().addCommandListener(
- new
ExternalizableStrategyCommandListener(org.rhq.core.server.ExternalizableStrategy.Subsystem.AGENT));
+ ServerCommunicationsServiceUtil
+ .getService()
+ .getServiceContainer()
+ .addCommandListener(
+ new ExternalizableStrategyCommandListener(
+ org.rhq.core.server.ExternalizableStrategy.Subsystem.AGENT));
} catch (Exception e) {
throw new ServletException("Cannot start the server-side communications
services.", e);
}
@@ -574,19 +609,19 @@ public class StartupServlet extends HttpServlet {
Server server = LookupUtil.getServerManager().getServer();
if (agentAddress == null || agentAddress.trim().equals(""))
{
-
overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
server
- .getAddress());
+
overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
+ server.getAddress());
}
if (serverAddress == null ||
serverAddress.trim().equals("")) {
overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS,
server.getAddress());
}
if (serverPort == null || serverPort.trim().equals("")) {
if (SecurityUtil.isTransportSecure(serverTransport)) {
-
overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
Integer.toString(server
- .getSecurePort()));
+
overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
+ Integer.toString(server.getSecurePort()));
} else {
-
overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
Integer.toString(server
- .getPort()));
+
overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
+ Integer.toString(server.getPort()));
}
}
@@ -684,7 +719,8 @@ public class StartupServlet extends HttpServlet {
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
ProductInfo productInfo =
LookupUtil.getSystemManager().getProductInfo(overlord);
log.info("--------------------------------------------------"); // 50
dashes
- log.info(productInfo.getFullName() + " " + productInfo.getVersion() +
" (build " + productInfo.getBuildNumber() + ") Server started.");
+ log.info(productInfo.getFullName() + " " + productInfo.getVersion() +
" (build " + productInfo.getBuildNumber()
+ + ") Server started.");
log.info("--------------------------------------------------"); // 50
dashes
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index 1beef97..7528dd9 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -457,13 +457,18 @@
<url-pattern>/client/download</url-pattern>
</servlet-mapping>
+ <!-- provides startup progress information (mainly for the installer) -->
+ <servlet-mapping>
+ <servlet-name>initializer</servlet-name>
+ <url-pattern>/startupstatus</url-pattern>
+ </servlet-mapping>
+
+ <!-- TODO what is this for? -->
<servlet-mapping>
<servlet-name>sessionAccess</servlet-name>
<url-pattern>/sessionAccess</url-pattern>
</servlet-mapping>
-
-
<!-- The download servlet; this URI /downloads will effectively look like its
pointing to rhq-downloads -->
<servlet-mapping>
<servlet-name>DownloadServlet</servlet-name>