JBossWeb SVN: r643 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-27 13:28:10 -0400 (Tue, 27 May 2008)
New Revision: 643
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml
Log:
- Forgot one JMX operation.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-27 14:50:21 UTC (rev 642)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-27 17:28:10 UTC (rev 643)
@@ -255,7 +255,7 @@
* Refresh configuration. To be used through JMX or similar.
*/
public void refresh() {
- // Set as error, and the periodic
+ // Set as error, and the periodic event will refresh the configuration
if (state == State.OK) {
state = State.ERROR;
}
Modified: trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml
===================================================================
--- trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml 2008-05-27 14:50:21 UTC (rev 642)
+++ trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml 2008-05-27 17:28:10 UTC (rev 643)
@@ -33,6 +33,11 @@
description="Connection timeout for communication with the proxy"
type="int"/>
+ <operation name="refresh"
+ description="Refresh configuration"
+ impact="ACTION"
+ returnType="void"/>
+
<operation name="reset"
description="Move the node out of an error state"
impact="ACTION"
16 years, 7 months
JBossWeb SVN: r642 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-27 10:50:21 -0400 (Tue, 27 May 2008)
New Revision: 642
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml
trunk/webapps/docs/changelog.xml
Log:
- Add 3 new JMX callbacks.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-27 13:47:39 UTC (rev 641)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-27 14:50:21 UTC (rev 642)
@@ -252,6 +252,49 @@
/**
+ * Refresh configuration. To be used through JMX or similar.
+ */
+ public void refresh() {
+ // Set as error, and the periodic
+ if (state == State.OK) {
+ state = State.ERROR;
+ }
+ }
+
+
+ /**
+ * Disable all webapps for all engines. To be used through JMX or similar.
+ */
+ public boolean disable() {
+ Service[] services = ServerFactory.getServer().findServices();
+ for (int i = 0; i < services.length; i++) {
+ Engine engine = (Engine) services[i].getContainer();
+ HashMap<String, String> parameters = new HashMap<String, String>();
+ parameters.put("JVMRoute", engine.getJvmRoute());
+ // Send DISABLE-APP * request
+ sendRequest("DISABLE-APP", true, parameters);
+ }
+ return (state == State.OK);
+ }
+
+
+ /**
+ * Enable all webapps for all engines. To be used through JMX or similar.
+ */
+ public boolean enable() {
+ Service[] services = ServerFactory.getServer().findServices();
+ for (int i = 0; i < services.length; i++) {
+ Engine engine = (Engine) services[i].getContainer();
+ HashMap<String, String> parameters = new HashMap<String, String>();
+ parameters.put("JVMRoute", engine.getJvmRoute());
+ // Send ENABLE-APP * request
+ sendRequest("ENABLE-APP", true, parameters);
+ }
+ return (state == State.OK);
+ }
+
+
+ /**
* Send commands to the front end server assocaited with the startup of the
* node.
*/
Modified: trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml
===================================================================
--- trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml 2008-05-27 13:47:39 UTC (rev 641)
+++ trunk/java/org/jboss/web/cluster/mbeans-descriptors.xml 2008-05-27 14:50:21 UTC (rev 642)
@@ -38,6 +38,16 @@
impact="ACTION"
returnType="void"/>
+ <operation name="disable"
+ description="Disable all webapps for all engines"
+ impact="ACTION"
+ returnType="boolean"/>
+
+ <operation name="enable"
+ description="Enable all webapps for all engines"
+ impact="ACTION"
+ returnType="boolean"/>
+
</mbean>
</mbeans-descriptors>
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-27 13:47:39 UTC (rev 641)
+++ trunk/webapps/docs/changelog.xml 2008-05-27 14:50:21 UTC (rev 642)
@@ -38,6 +38,9 @@
<fix>
Improve fault recovery of ClusterListener. (remm)
</fix>
+ <update>
+ Add JMX callbacks to refresh configuration, enable and disable all contexts. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
16 years, 7 months
JBossWeb SVN: r641 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-27 09:47:39 -0400 (Tue, 27 May 2008)
New Revision: 641
Modified:
trunk/build.properties.default
trunk/build.xml
trunk/webapps/docs/changelog.xml
Log:
- Some small cleanup.
- Update NSIS and JDT.
Modified: trunk/build.properties.default
===================================================================
--- trunk/build.properties.default 2008-05-26 14:34:28 UTC (rev 640)
+++ trunk/build.properties.default 2008-05-27 13:47:39 UTC (rev 641)
@@ -39,8 +39,8 @@
# ----- Eclipse JDT, version 3.2 or later -----
jdt.home=${base.path}/eclipse/plugins
jdt.lib=${jdt.home}
-jdt.jar=${jdt.lib}/org.eclipse.jdt.core_3.3.1.v_780_R33x.jar
-jdt.loc=http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.3.1-200709211145/eclipse-JDT-3.3.1.zip
+jdt.jar=${jdt.lib}/org.eclipse.jdt.core_3.3.3.v_793_R33x.jar
+jdt.loc=http://download.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800/eclipse-JDT-3.3.2.zip
# ----- Commons DBCP, version 1.1 or later -----
commons-dbcp.version=1.2.2
@@ -59,12 +59,12 @@
commons-collections-src.loc=${base-commons.loc}/collections/source/commons-collections-3.2-src.tar.gz
# ----- NSIS, version 2.0 or later -----
-nsis.home=${base.path}/nsis-2.36
+nsis.home=${base.path}/nsis-2.37
nsis.exe=${nsis.home}/makensis.exe
nsis.installoptions.dll=${nsis.home}/Plugins/InstallOptions.dll
nsis.nsexec.dll=${nsis.home}/Plugins/nsExec.dll
nsis.nsisdl.dll=${nsis.home}/Plugins/NSISdl.dll
-nsis.loc=${base-sf.loc}/nsis/nsis-2.36.zip
+nsis.loc=${base-sf.loc}/nsis/nsis-2.37.zip
# ----- JBoss Native, version 2.0 or later -----
jbossnative.home=${base.path}/jboss-native-2.0.3
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-05-26 14:34:28 UTC (rev 640)
+++ trunk/build.xml 2008-05-27 13:47:39 UTC (rev 641)
@@ -92,11 +92,12 @@
<!-- Compile internal server components -->
<javac srcdir="java" destdir="${tomcat.classes}"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- source="${compile.source}"
- optimize="${compile.optimize}"
- excludes="**/CVS/**,**/.svn/**">
+ debug="${compile.debug}"
+ optimize="${compile.optimize}"
+ deprecation="${compile.deprecation}"
+ source="${compile.source}"
+ target="${compile.target}"
+ excludes="**/CVS/**,**/.svn/**">
<!-- Comment this in to show unchecked warnings: <compilerarg value="-Xlint:unchecked"/> -->
<classpath refid="tomcat.classpath" />
</javac>
@@ -667,7 +668,9 @@
<target name="download"
description="Builds and download dependent components">
- <antcall target="downloadgz">
+ <mkdir dir="${base.path}" />
+
+ <antcall target="downloadgz">
<param name="sourcefile" value="${commons-daemon.loc}"/>
<param name="destfile" value="${commons-daemon.jar}"/>
</antcall>
@@ -688,6 +691,7 @@
<mkdir dir="${tomcat-dbcp.home}"/>
<antcall target="build-tomcat-dbcp">
<param name="basedir" value="${tomcat-dbcp.home}" />
+ <param name="destfile" value="${tomcat-dbcp.jar}" />
</antcall>
<!-- Build Jasper JDT bundle -->
@@ -715,7 +719,7 @@
</target>
- <target name="build-tomcat-dbcp">
+ <target name="build-tomcat-dbcp" unless="exist" depends="testexist">
<copy todir="${tomcat-dbcp.home}">
<!--
<fileset dir="${commons-collections.home}" >
@@ -757,12 +761,14 @@
</move>
<mkdir dir="${tomcat-dbcp.home}/classes"/>
<javac destdir="${tomcat-dbcp.home}/classes"
- optimize="off"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- source="${compile.source}"
- sourcepath="${tomcat-dbcp.home}/src/java"
- srcdir="${tomcat-dbcp.home}/src/java" >
+ sourcepath="${tomcat-dbcp.home}/src/java"
+ srcdir="${tomcat-dbcp.home}/src/java"
+ debug="${compile.debug}"
+ optimize="${compile.optimize}"
+ deprecation="${compile.deprecation}"
+ source="${compile.source}"
+ target="${compile.target}"
+ excludes="**/CVS/**,**/.svn/**">
<include name="**" />
</javac>
<jar jarfile="${tomcat-dbcp.jar}"
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-26 14:34:28 UTC (rev 640)
+++ trunk/webapps/docs/changelog.xml 2008-05-27 13:47:39 UTC (rev 641)
@@ -19,6 +19,12 @@
<section name="JBoss Web 2.1.1.CR4 (remm)">
<subsection name="General">
<changelog>
+ <update>
+ Update to NSIS 2.37. (remm)
+ </update>
+ <update>
+ Update to JDT 3.3.3. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Catalina">
16 years, 7 months
JBossWeb SVN: r640 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-26 10:34:28 -0400 (Mon, 26 May 2008)
New Revision: 640
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- More visible message for syntax errors.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-26 13:49:07 UTC (rev 639)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-26 14:34:28 UTC (rev 640)
@@ -714,10 +714,13 @@
if ("SYNTAX".equals(errorType)) {
// Syntax error means the protocol is incorrect, which cannot be automatically fixed
state = State.DOWN;
+ log.error("Unrecoverable sytax error sending: " + command + " Version: " + version
+ + " Error type: " + errorType + " Message: " + message);
} else {
state = State.ERROR;
+ log.info("Error sending: " + command + " Version: " + version + " Error type: "
+ + errorType + " Message: " + message);
}
- log.info("Error sending: " + command + " Version: " + version + " Error type: " + errorType + " Message: " + message);
}
} catch (IOException e) {
16 years, 7 months
JBossWeb SVN: r639 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-26 09:49:07 -0400 (Mon, 26 May 2008)
New Revision: 639
Modified:
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
trunk/webapps/docs/changelog.xml
Log:
- Prevent pipelining with Comet and sendfile.
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-05-26 13:16:14 UTC (rev 638)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-05-26 13:49:07 UTC (rev 639)
@@ -797,11 +797,11 @@
recycle();
return SocketState.CLOSED;
} else if (!comet) {
- inputBuffer.nextRequest();
+ boolean pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
recycleComet();
recycle();
- return SocketState.OPEN;
+ return (pipelined) ? SocketState.CLOSED : SocketState.OPEN;
} else {
return SocketState.LONG;
}
@@ -932,16 +932,17 @@
}
request.updateCounters();
+ boolean pipelined = false;
if (!comet) {
// Next request
- inputBuffer.nextRequest();
+ pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
}
// Do sendfile as needed: add socket to sendfile and end
if (sendfileData != null && !error) {
sendfileData.socket = socket;
- sendfileData.keepAlive = keepAlive;
+ sendfileData.keepAlive = keepAlive && !pipelined;
if (!endpoint.getSendfile().add(sendfileData)) {
openSocket = true;
break;
Modified: trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-26 13:16:14 UTC (rev 638)
+++ trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-26 13:49:07 UTC (rev 639)
@@ -323,8 +323,10 @@
* Note: All bytes of the current request should have been already
* consumed. This method only resets all the pointers so that we are ready
* to parse the next HTTP request.
+ *
+ * @return true if there is data left on input (most likely a pipelined request)
*/
- public void nextRequest() {
+ public boolean nextRequest() {
// Recycle Request object
request.recycle();
@@ -354,6 +356,8 @@
swallowInput = true;
nonBlocking = false;
+ return (lastValid > 0);
+
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-26 13:16:14 UTC (rev 638)
+++ trunk/webapps/docs/changelog.xml 2008-05-26 13:49:07 UTC (rev 639)
@@ -29,6 +29,9 @@
<update>
Register ClusterListener in JMX. (remm)
</update>
+ <fix>
+ Improve fault recovery of ClusterListener. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -41,6 +44,10 @@
After completing an asynchronous sendfile, the socket should be placed in the main poller
rather than assigned to a worker (where it would block). (remm)
</fix>
+ <fix>
+ Close the connection if there's an attempt to pipeline requests when using Comet or an
+ asynchronous sendfile is needed. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
16 years, 7 months
JBossWeb SVN: r638 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-26 09:16:14 -0400 (Mon, 26 May 2008)
New Revision: 638
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Set error flag if there's a communication error with the proxy.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 17:14:48 UTC (rev 637)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-26 13:16:14 UTC (rev 638)
@@ -721,6 +721,8 @@
}
} catch (IOException e) {
+ // Most likely this is a connection error with the proxy
+ state = State.ERROR;
log.info("Error sending: " + command, e);
} finally {
if (keyCC != null) {
@@ -759,6 +761,9 @@
*/
protected Socket getConnection()
throws IOException {
+ if (proxyPort == -1) {
+ // FIXME: Determine connection port and address automagically
+ }
if (proxyAddress == null) {
return new Socket(InetAddress.getLocalHost(), proxyPort);
} else {
16 years, 7 months
JBossWeb SVN: r637 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-22 13:14:48 -0400 (Thu, 22 May 2008)
New Revision: 637
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Extract connection logic (will be nice when SSL is added).
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 17:00:45 UTC (rev 636)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 17:14:48 UTC (rev 637)
@@ -280,12 +280,7 @@
// Automagical JVM route (address + port + engineName)
try {
if (localAddress == null) {
- Socket connection = null;
- if (proxyAddress == null) {
- connection = new Socket(InetAddress.getLocalHost(), proxyPort);
- } else {
- connection = new Socket(proxyAddress, proxyPort);
- }
+ Socket connection = getConnection();
localAddress = connection.getLocalAddress();
if (localAddress != null) {
IntrospectionUtils.setProperty(connector.getProtocolHandler(), "address", localAddress.getHostAddress());
@@ -655,11 +650,7 @@
}
// Then, connect to the proxy
- if (proxyAddress == null) {
- connection = new Socket("127.0.0.1", proxyPort);
- } else {
- connection = new Socket(proxyAddress, proxyPort);
- }
+ connection = getConnection();
connection.setSoTimeout(socketTimeout);
String requestLine = command + " " + ((wildcard) ? "*" : proxyURL) + " HTTP/1.0";
@@ -763,4 +754,17 @@
}
+ /**
+ * Return a connection to the proxy.
+ */
+ protected Socket getConnection()
+ throws IOException {
+ if (proxyAddress == null) {
+ return new Socket(InetAddress.getLocalHost(), proxyPort);
+ } else {
+ return new Socket(proxyAddress, proxyPort);
+ }
+ }
+
+
}
16 years, 7 months
JBossWeb SVN: r636 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-22 13:00:45 -0400 (Thu, 22 May 2008)
New Revision: 636
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Fix logic when there's an error connecting on startup to determine the jvmRoute or the local address.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 15:42:36 UTC (rev 635)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 17:00:45 UTC (rev 636)
@@ -272,6 +272,7 @@
services[i].getContainer().addContainerListener(this);
Engine engine = (Engine) services[i].getContainer();
+ ((Lifecycle) engine).addLifecycleListener(this);
Connector connector = findProxyConnector(engine.getService().findConnectors());
InetAddress localAddress =
(InetAddress) IntrospectionUtils.getProperty(connector.getProtocolHandler(), "address");
@@ -308,11 +309,12 @@
log.info("Engine [" + engine.getName() + "] will use jvmRoute value: [" + jvmRoute + "]");
}
} catch (Exception e) {
- throw new IllegalStateException("JVMRoute and Address must be set on the connector", e);
+ state = State.ERROR;
+ log.info("Error connecting to proxy to determine Engine.JVMRoute or Connector.address", e);
+ return;
}
}
- ((Lifecycle) engine).addLifecycleListener(this);
config(engine);
Container[] children = engine.findChildren();
for (int j = 0; j < children.length; j++) {
@@ -337,7 +339,7 @@
try {
Registry.getRegistry(null, null).unregisterComponent(oname);
} catch (Exception e) {
- log.error("Error registering ",e);
+ log.error("Error unregistering ",e);
}
}
@@ -405,11 +407,14 @@
log.debug("Stop: " + engine.getName());
}
- HashMap<String, String> parameters = new HashMap<String, String>();
- parameters.put("JVMRoute", engine.getJvmRoute());
+ // JVMRoute can be null here if nothing was ever initialized
+ if (engine.getJvmRoute() != null) {
+ HashMap<String, String> parameters = new HashMap<String, String>();
+ parameters.put("JVMRoute", engine.getJvmRoute());
- // Send REMOVE-APP * request
- sendRequest("REMOVE-APP", true, parameters);
+ // Send REMOVE-APP * request
+ sendRequest("REMOVE-APP", true, parameters);
+ }
}
@@ -478,12 +483,16 @@
((Lifecycle) context).removeLifecycleListener(this);
HashMap<String, String> parameters = new HashMap<String, String>();
- parameters.put("JVMRoute", getJvmRoute(context));
- parameters.put("Context", ("".equals(context.getPath())) ? "/" : context.getPath());
- parameters.put("Alias", getHost(context));
+ String jvmRoute = getJvmRoute(context);
+ // JVMRoute can be null here if nothing was ever initialized
+ if (jvmRoute != null) {
+ parameters.put("JVMRoute", jvmRoute);
+ parameters.put("Context", ("".equals(context.getPath())) ? "/" : context.getPath());
+ parameters.put("Alias", getHost(context));
- // Send REMOVE-APP
- sendRequest("REMOVE-APP", false, parameters);
+ // Send REMOVE-APP
+ sendRequest("REMOVE-APP", false, parameters);
+ }
}
16 years, 7 months
JBossWeb SVN: r635 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-22 11:42:36 -0400 (Thu, 22 May 2008)
New Revision: 635
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Remove usage of toString.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-21 13:44:21 UTC (rev 634)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-22 15:42:36 UTC (rev 635)
@@ -599,7 +599,7 @@
// Should not happen
return "127.0.0.1";
} else {
- return inetAddress.toString();
+ return inetAddress.getHostAddress();
}
}
16 years, 7 months
JBossWeb SVN: r634 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-05-21 09:44:21 -0400 (Wed, 21 May 2008)
New Revision: 634
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Modify a bit the code to find the local address along with the jvmRoute.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-21 11:51:36 UTC (rev 633)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-05-21 13:44:21 UTC (rev 634)
@@ -103,8 +103,8 @@
* JMX registration information.
*/
protected ObjectName oname;
-
-
+
+
// ------------------------------------------------------------- Properties
@@ -125,7 +125,9 @@
public void setAddress(InetAddress proxyAddress) { this.proxyAddress = proxyAddress; }
- // FIXME: probably useless
+ /**
+ * Most likely only useful for testing.
+ */
protected String proxyURL = "/";
public String getProxyURL() { return proxyURL; }
public void setProxyURL(String proxyURL) { this.proxyURL = proxyURL; }
@@ -270,33 +272,43 @@
services[i].getContainer().addContainerListener(this);
Engine engine = (Engine) services[i].getContainer();
- if (engine.getJvmRoute() == null) {
+ Connector connector = findProxyConnector(engine.getService().findConnectors());
+ InetAddress localAddress =
+ (InetAddress) IntrospectionUtils.getProperty(connector.getProtocolHandler(), "address");
+ if (engine.getJvmRoute() == null || localAddress == null) {
// Automagical JVM route (address + port + engineName)
try {
- Connector connector = findProxyConnector(engine.getService().findConnectors());
- InetAddress localAddress =
- (InetAddress) IntrospectionUtils.getProperty(connector.getProtocolHandler(), "address");
- String hostName = null;
if (localAddress == null) {
Socket connection = null;
if (proxyAddress == null) {
- connection = new Socket("127.0.0.1", proxyPort);
+ connection = new Socket(InetAddress.getLocalHost(), proxyPort);
} else {
connection = new Socket(proxyAddress, proxyPort);
}
localAddress = connection.getLocalAddress();
+ if (localAddress != null) {
+ IntrospectionUtils.setProperty(connector.getProtocolHandler(), "address", localAddress.getHostAddress());
+ } else {
+ // Should not happen
+ IntrospectionUtils.setProperty(connector.getProtocolHandler(), "address", "127.0.0.1");
+ }
+ connection.close();
+ log.info("Detected local adress: [" + localAddress.getHostAddress() + "]");
}
- if (localAddress != null) {
- hostName = localAddress.getHostName();
- } else {
- // Fallback
- hostName = "127.0.0.1";
+ if (engine.getJvmRoute() == null) {
+ String hostName = null;
+ if (localAddress != null) {
+ hostName = localAddress.getHostName();
+ } else {
+ // Fallback
+ hostName = "127.0.0.1";
+ }
+ String jvmRoute = hostName + ":" + connector.getPort() + ":" + engine.getName();
+ engine.setJvmRoute(jvmRoute);
+ log.info("Engine [" + engine.getName() + "] will use jvmRoute value: [" + jvmRoute + "]");
}
- String jvmRoute = hostName + ":" + connector.getPort() + ":" + engine.getName();
- engine.setJvmRoute(jvmRoute);
- log.info("Engine [" + engine.getName() + "] will use jvmRoute value: [" + jvmRoute + "]");
} catch (Exception e) {
- throw new IllegalStateException("JVMRoute must be set, automatic generation failed", e);
+ throw new IllegalStateException("JVMRoute and Address must be set on the connector", e);
}
}
@@ -584,7 +596,7 @@
InetAddress inetAddress =
(InetAddress) IntrospectionUtils.getProperty(connector.getProtocolHandler(), "address");
if (inetAddress == null) {
- // FIXME: Return local address ? This is hard ...
+ // Should not happen
return "127.0.0.1";
} else {
return inetAddress.toString();
16 years, 7 months