Author: remy.maucherat(a)jboss.com
Date: 2008-05-30 11:01:58 -0400 (Fri, 30 May 2008)
New Revision: 649
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
trunk/java/org/jboss/web/cluster/LocalStrings.properties
Log:
- Clear up bugs introduced by allowing multiple proxies.
- Fix startup failure if a proxy name cannot be resolved.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-29 17:50:07 UTC (rev
648)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-30 15:01:58 UTC (rev
649)
@@ -318,7 +318,8 @@
proxy.address = InetAddress.getByName(address);
}
} catch (Exception e) {
- throw new IllegalArgumentException(e);
+
log.error(sm.getString("clusterListener.error.invalidHost", address), e);
+ continue;
}
proxyList.add(proxy);
}
@@ -575,6 +576,28 @@
/**
+ * Reset configuration for a particular proxy following an error.
+ */
+ protected void reset(int pos) {
+
+ Service[] services = ServerFactory.getServer().findServices();
+ for (int i = 0; i < services.length; i++) {
+ Engine engine = (Engine) services[i].getContainer();
+ removeAll((Engine) services[i].getContainer(), pos);
+ config(engine, pos);
+ Container[] children = engine.findChildren();
+ for (int j = 0; j < children.length; j++) {
+ Container[] children2 = children[j].findChildren();
+ for (int k = 0; k < children2.length; k++) {
+ addContext((Context) children2[k], pos);
+ }
+ }
+ }
+
+ }
+
+
+ /**
* Send the configuration for the specified engine to the proxy.
*
* @param engine
@@ -674,7 +697,7 @@
parameters.put("JVMRoute", engine.getJvmRoute());
// Send REMOVE-APP * request
- sendRequest("REMOVE-APP", true, parameters);
+ sendRequest("REMOVE-APP", true, parameters, pos);
}
}
@@ -691,8 +714,7 @@
if (local[i].state == State.ERROR) {
local[i].state = State.OK;
// Something went wrong in a status at some point, so fully restore the
configuration
- stopServer(ServerFactory.getServer(), i);
- startServer(ServerFactory.getServer(), i);
+ reset(i);
} else if (local[i].state == State.OK) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("clusterListener.status",
engine.getName()));
@@ -729,7 +751,7 @@
// Send ENABLE-APP if state is started
if (context.isStarted()) {
- sendRequest("ENABLE-APP", false, parameters);
+ sendRequest("ENABLE-APP", false, parameters, pos);
}
}
@@ -755,7 +777,7 @@
parameters.put("Alias", getHost(context));
// Send REMOVE-APP
- sendRequest("REMOVE-APP", false, parameters);
+ sendRequest("REMOVE-APP", false, parameters, pos);
}
}
@@ -776,7 +798,7 @@
parameters.put("Alias", getHost(context));
// Send ENABLE-APP
- sendRequest("ENABLE-APP", false, parameters);
+ sendRequest("ENABLE-APP", false, parameters, pos);
}
@@ -796,7 +818,7 @@
parameters.put("Alias", getHost(context));
// Send STOP-APP
- sendRequest("STOP-APP", false, parameters);
+ sendRequest("STOP-APP", false, parameters, pos);
}
Modified: trunk/java/org/jboss/web/cluster/LocalStrings.properties
===================================================================
--- trunk/java/org/jboss/web/cluster/LocalStrings.properties 2008-05-29 17:50:07 UTC (rev
648)
+++ trunk/java/org/jboss/web/cluster/LocalStrings.properties 2008-05-30 15:01:58 UTC (rev
649)
@@ -12,6 +12,7 @@
# Error messages
clusterListener.error.addressJvmRoute=Error connecting to proxy to determine
Engine.JVMRoute or Connector.address
+clusterListener.error.invalidHost=Invalid host specified: {0}
clusterListener.error.io=IO error sending command {0} to proxy {1}
clusterListener.error.jmxRegister=Error during JMX registration
clusterListener.error.jmxUnregister=Error during JMX unregistration