[jboss-cvs] JBossAS SVN: r96677 - in trunk: component-matrix and 28 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 21 01:23:10 EST 2009


Author: pferraro
Date: 2009-11-21 01:23:10 -0500 (Sat, 21 Nov 2009)
New Revision: 96677

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/
   trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/HAModClusterServiceTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java
   trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml
   trunk/testsuite/src/resources/test-configs/mod_cluster-0/
   trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/
   trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/
   trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   trunk/testsuite/src/resources/test-configs/mod_cluster-1/
   trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/
   trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/
   trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/
   trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   trunk/tomcat/src/resources/mod_cluster-jboss-beans.xml
Modified:
   trunk/build/build.xml
   trunk/component-matrix/pom.xml
   trunk/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml
   trunk/testsuite/imports/config/tests-clustering.xml
   trunk/testsuite/imports/server-config.xml
   trunk/tomcat/pom.xml
   trunk/tomcat/src/resources/jboss-beans.xml
   trunk/tomcat/src/resources/server.xml
Log:
[JBAS-7242] Ported mod_cluster integration from Branch_5_x, add test for HA case.

Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/build/build.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -1562,9 +1562,10 @@
     <copy todir="${install.server}/all/deploy">
       <fileset dir="${tomcat.module.output}/deploy">
         <include name="cluster/**"/>
+        <!-- Copy the mod_cluster.sar -->
+        <include name="mod_cluster.sar/**"/>
       </fileset>
     </copy>
-
   </target>
 
   <target name="module-tomcat-all" depends="module-tomcat">

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/component-matrix/pom.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -104,6 +104,7 @@
     <version.org.jboss.metadata.rar>2.0.0.Alpha</version.org.jboss.metadata.rar>
     <version.org.jboss.metadata.war>2.0.0.Alpha12</version.org.jboss.metadata.war>
     <version.org.jboss.microcontainer>2.0.9.GA</version.org.jboss.microcontainer>
+    <version.org.jboss.mod_cluster>1.1.0.Beta1</version.org.jboss.mod_cluster>
     <version.org.jboss.mx>6.0.0.Beta1</version.org.jboss.mx>
     <version.org.jboss.naming>5.0.4.GA</version.org.jboss.naming>
     <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
@@ -779,6 +780,18 @@
       </dependency>
       
       <dependency>
+        <groupId>org.jboss.mod_cluster</groupId>
+        <artifactId>mod_cluster</artifactId>
+        <version>${version.org.jboss.mod_cluster}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      
+      <dependency>
         <groupId>org.jboss.mx</groupId>
         <artifactId>jboss-j2se</artifactId>
         <version>${version.org.jboss.mx}</version>

Modified: trunk/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -350,6 +350,30 @@
                 <property name="description">Socket used to provide unique process id for JBossTS. The address configuration is ignored; will always use localhost/127.0.0.1</property>
             </bean>
 
+            <!-- ********************* deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml **************** -->
+            
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">ModClusterService</property>
+                <property name="bindingName">AdvertiseGroup</property>
+                <property name="hostName">${jboss.mod_cluster.advertise.address,jboss.partition.udpGroup:224.0.1.105}</property>
+                <property name="port">${jboss.mod_cluster.advertise.port:23364}</property>
+                <property name="description">Multicast address/port on which to listen for mod_cluster proxy advertisements</property>
+                <!-- This address should not be changed between different 
+                     binding sets; all nodes need to listen on the same 
+                     multicast address -->
+                <property name="fixedHostName">true</property>
+                <!-- This port should not be changed between different 
+                     binding sets; all nodes need to listen on the same port -->
+                <property name="fixedPort">true</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">ModClusterService</property>
+               <property name="bindingName">AdvertiseGroupInterface</property>
+               <property name="hostName">${jboss.bind.address}</property>
+               <property name="description">Interface for multicast socket on which to listen for mod_cluster proxy advertisements</property>
+            </bean>
+
             <!-- ********************* deploy/hsqldb-ds.xml **************** -->
 
             <!-- Commented out as tcp/ip access to Hypersonic is not enabled by default -->

Modified: trunk/testsuite/imports/config/tests-clustering.xml
===================================================================
--- trunk/testsuite/imports/config/tests-clustering.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/testsuite/imports/config/tests-clustering.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -64,7 +64,13 @@
   </patternset>
   <patternset id="cluster.ustxsticky.includes">
     <include name="org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.class"/>
-  </patternset>    
+  </patternset>
+  <patternset id="cluster.mod_cluster.includes">
+    <include name="org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.class"/>
+  </patternset>
+  <patternset id="cluster.ha-mod_cluster.includes">
+    <include name="org/jboss/test/cluster/mod_cluster/HAModClusterServiceTestCase.class"/>
+  </patternset>
   <patternset id="cluster.excludes">
     <exclude name="org/jboss/test/cluster/**/*TestCase.class"/>
   </patternset>
@@ -357,6 +363,52 @@
 		    
   </target> 
 
+  <target name="tests-mod_cluster" depends="init">
+
+    <mkdir dir="${build.reports}"/>
+    <mkdir dir="${build.testlog}"/>
+    
+    <create-cluster-node conf="mod_cluster-0"/>
+    <create-cluster-node conf="mod_cluster-1"/>
+    
+    <server:start name="mod_cluster-0"/>
+    <server:start name="mod_cluster-1"/>
+
+    <antcall target="tests-clustering-unit" inheritRefs="true">
+      <param name="cluster.includes.refid" value="cluster.mod_cluster.includes"/>
+      <param name="jboss-junit-configuration" value="ModClusterService"/>
+      <param name="jbosstest.cluster.node0.config" value="mod_cluster-0"/>
+      <param name="jbosstest.cluster.node1.config" value="mod_cluster-1"/>
+    </antcall>
+
+    <server:stop name="mod_cluster-0"/>
+    <server:stop name="mod_cluster-1"/>
+
+  </target> 
+
+  <target name="tests-ha-mod_cluster" depends="init">
+
+    <mkdir dir="${build.reports}"/>
+    <mkdir dir="${build.testlog}"/>
+    
+    <create-cluster-node conf="ha-mod_cluster-0"/>
+    <create-cluster-node conf="ha-mod_cluster-1"/>
+    
+    <server:start name="ha-mod_cluster-0"/>
+    <server:start name="ha-mod_cluster-1"/>
+
+    <antcall target="tests-clustering-unit" inheritRefs="true">
+      <param name="cluster.includes.refid" value="cluster.ha-mod_cluster.includes"/>
+      <param name="jboss-junit-configuration" value="HAModClusterService"/>
+      <param name="jbosstest.cluster.node0.config" value="ha-mod_cluster-0"/>
+      <param name="jbosstest.cluster.node1.config" value="ha-mod_cluster-1"/>
+    </antcall>
+
+    <server:stop name="ha-mod_cluster-0"/>
+    <server:stop name="ha-mod_cluster-1"/>
+
+  </target> 
+
   <target name="tests-clustered-ustxsticky" depends="init">
 
     <mkdir dir="${build.reports}"/>

Modified: trunk/testsuite/imports/server-config.xml
===================================================================
--- trunk/testsuite/imports/server-config.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/testsuite/imports/server-config.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -942,6 +942,54 @@
          <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
          <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
       </server>
+      
+      <server name="mod_cluster-0" host="${node0}">
+        <jvmarg value="-Xms128m" />
+        <jvmarg value="-Xmx512m" />
+        <jvmarg value="-XX:MaxPermSize=512m" />
+        <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+        <sysproperty key="java.net.preferIPv4Stack" value="true" />
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+        <sysproperty key="jboss.messaging.ServerPeerID" value="0" />
+      </server>
+       
+      <server name="mod_cluster-1" host="${node1}">
+        <jvmarg value="-Xms128m" />
+        <jvmarg value="-Xmx512m" />
+        <jvmarg value="-XX:MaxPermSize=512m" />
+        <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+        <sysproperty key="java.net.preferIPv4Stack" value="true" />
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+        <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
+      </server>
+      
+      <server name="ha-mod_cluster-0" host="${node1}">
+        <jvmarg value="-Xms128m" />
+        <jvmarg value="-Xmx512m" />
+        <jvmarg value="-XX:MaxPermSize=512m" />
+        <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+        <sysproperty key="java.net.preferIPv4Stack" value="true" />
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+        <sysproperty key="jboss.messaging.ServerPeerID" value="0" />
+      </server>
+       
+      <server name="ha-mod_cluster-1" host="${node0}">
+        <jvmarg value="-Xms128m" />
+        <jvmarg value="-Xmx512m" />
+        <jvmarg value="-XX:MaxPermSize=512m" />
+        <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+        <sysproperty key="java.net.preferIPv4Stack" value="true" />
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+        <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
+      </server>
    	
     </server:config>
   

Added: trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/HAModClusterServiceTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/HAModClusterServiceTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/HAModClusterServiceTestCase.java	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.mod_cluster;
+
+import java.net.InetAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Assert;
+
+import org.jboss.test.JBossClusteredTestCase;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class HAModClusterServiceTestCase extends JBossClusteredTestCase
+{
+   private static final String JVM_ROUTE_PATTERN = "%s:8009:jboss.web";
+   
+   private MockProxy proxy = new MockProxy(2);
+   
+   /**
+    * Create a new ModClusterServiceTestCase.
+    * 
+    * @param name
+    */
+   public HAModClusterServiceTestCase(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      this.proxy.start();
+   }
+   
+   @Override
+   protected void tearDown() throws Exception
+   {
+      this.proxy.stop();
+      
+      super.tearDown();
+   }
+   
+   public void testInfo() throws Exception
+   {
+      MBeanServerConnection[] servers = this.getAdaptors();
+      
+      ObjectName name = ObjectName.getInstance("jboss.web:service=ModCluster");
+      
+      servers[0].invoke(name, "addProxy", new Object[] { "127.0.0.1", this.proxy.getPort() }, new String[] { String.class.getName(), Integer.TYPE.getName() });
+      
+      // Wait the duration of at least 1 status interval
+      Thread.sleep(20000);
+
+      // Proxy should have received:
+      // 1. INFO - to establish proxy connectivity
+      // 2. CONFIG - to configure proxy
+      // 3. STATUS - periodic status
+      
+      List<Map.Entry<String, Map<String, String>>> requests = new LinkedList<Map.Entry<String, Map<String, String>>>();
+      
+      int count = this.proxy.getRequests().drainTo(requests);
+
+      Assert.assertEquals(1, count);
+
+      for (Map.Entry<String, Map<String, String>> infoRequest: requests)
+      {
+         String command = infoRequest.getKey();
+         Map<String, String> parameters = infoRequest.getValue();
+         
+         Assert.assertTrue(command, command.startsWith("INFO"));
+         Assert.assertFalse(command.contains("*"));
+         Assert.assertTrue(parameters.isEmpty());
+      }
+      
+      String[] hosts = this.getServers();
+      
+      for (int i = 0; i < hosts.length; ++i)
+      {
+         String host = InetAddress.getByName(hosts[i]).getHostAddress();
+         
+         requests.clear();
+
+         count = this.proxy.getRequests(String.format(JVM_ROUTE_PATTERN, host)).drainTo(requests);
+
+         Assert.assertTrue(Integer.toString(count), count >= 2);
+         
+         Map.Entry<String, Map<String, String>> configRequest = requests.get(0);
+         String command = configRequest.getKey();
+         Map<String, String> parameters = configRequest.getValue();
+
+         Assert.assertTrue(command, command.startsWith("CONFIG"));
+         Assert.assertFalse(command.contains("*"));
+         Assert.assertEquals(5, parameters.size());
+         Assert.assertEquals("8009", parameters.get("Port"));
+         Assert.assertEquals(host, parameters.get("Host"));
+         Assert.assertEquals("ajp", parameters.get("Type"));
+         Assert.assertEquals(String.format(JVM_ROUTE_PATTERN, host), parameters.get("JVMRoute"));
+         Assert.assertEquals("No", parameters.get("StickySessionForce"));
+         
+         for (Map.Entry<String, Map<String, String>> statusRequest: requests.subList(1, requests.size()))
+         {
+            command = statusRequest.getKey();
+            parameters = statusRequest.getValue();
+            
+            Assert.assertTrue(command, command.startsWith("STATUS"));
+            Assert.assertFalse(command.contains("*"));
+            Assert.assertEquals(2, parameters.size());
+            Assert.assertEquals(String.format(JVM_ROUTE_PATTERN, host), parameters.get("JVMRoute"));
+            String value = parameters.get("Load");
+            Assert.assertNotNull(value);
+            int load = Integer.parseInt(value);
+            Assert.assertTrue(0 <= load);
+            Assert.assertTrue(load <= 100);
+         }
+      }
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,244 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.mod_cluster;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.net.URLDecoder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * Mock httpd proxy that queues all received messages
+ * @author Paul Ferraro
+ */
+ at SuppressWarnings("boxing")
+public class MockProxy implements Runnable
+{
+   private final BlockingQueue<Map.Entry<String, Map<String, String>>> requests = new LinkedBlockingQueue<Map.Entry<String, Map<String, String>>>();
+   private final ConcurrentMap<String, BlockingQueue<Map.Entry<String, Map<String, String>>>> requestMap = new ConcurrentHashMap<String, BlockingQueue<Map.Entry<String, Map<String, String>>>>();
+   
+   private ServerSocket server;
+   private Thread[] workers;
+   
+   private volatile boolean healthy = true;
+   
+   public MockProxy(int threads)
+   {
+      this.workers = new Thread[threads];
+   }
+   
+   public void run()
+   {
+      try
+      {
+         while (!Thread.currentThread().isInterrupted())
+         {
+            try
+            {
+               Socket socket = this.server.accept();
+               socket.setSoTimeout(15000);
+               
+               try
+               {
+                  BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+                  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
+
+                  String line = reader.readLine();
+                  
+                  while ((line != null) && !Thread.currentThread().isInterrupted())
+                  {
+                     if (line.length() == 0)
+                     {
+                        line = reader.readLine();
+                        continue;
+                     }
+
+                     String command = line;
+                     
+                     line = reader.readLine();
+                     
+                     while ((line != null) && (line.length() > 0))
+                     {
+                        // Ignore headers
+                        line = reader.readLine();
+                     }
+                     
+                     if (line != null)
+                     {
+                        line = reader.readLine();
+                     }
+
+                     Map<String, String> parameters = new HashMap<String, String>();
+                     
+                     if (line != null)
+                     {
+                        if (line.length() > 0)
+                        {
+                           for (String parameter: line.split("&"))
+                           {
+                              String[] parts = parameter.split("=");
+                              
+                              String name = parts[0];
+                              String value = URLDecoder.decode(parts[1], "UTF-8");
+                              
+                              parameters.put(name, value);
+                           }
+                        }
+                        
+                        if (this.healthy)
+                        {
+                           writer.write("HTTP/1.0 200 OK");
+                        }
+                        else
+                        {
+                           writer.write("HTTP/1.0 500 ERROR");
+                        }
+                        
+                        writer.newLine();
+                        writer.newLine();
+                        writer.flush();
+                        
+                        line = reader.readLine();
+                     }
+                     
+                     Map.Entry<String, Map<String, String>> request = Collections.singletonMap(command, parameters).entrySet().iterator().next();
+                     
+                     String jvmRoute = parameters.get("JVMRoute");
+
+                     if (jvmRoute == null)
+                     {
+                        this.requests.add(request);
+                     }
+                     else
+                     {
+                        this.getRequests(jvmRoute).add(request);
+                     }
+                  }
+               }
+               finally
+               {
+                  if (socket.isConnected())
+                  {
+                     try
+                     {
+                        socket.close();
+                     }
+                     catch (IOException e)
+                     {
+                        e.printStackTrace(System.err);
+                     }
+                  }
+               }
+            }
+            catch (SocketTimeoutException e)
+            {
+               System.out.println("Socket accept timeout");
+            }
+         }
+      }
+      catch (Throwable e)
+      {
+         e.printStackTrace(System.err);
+      }
+   }
+   
+   public void setHealty(boolean healthy)
+   {
+      this.healthy = healthy;
+   }
+   
+   public BlockingQueue<Map.Entry<String, Map<String, String>>> getRequests()
+   {
+      return this.requests;
+   }
+   
+   public BlockingQueue<Map.Entry<String, Map<String, String>>> getRequests(String jvmRoute)
+   {
+      BlockingQueue<Map.Entry<String, Map<String, String>>> newQueue = new LinkedBlockingQueue<Map.Entry<String, Map<String, String>>>();
+      BlockingQueue<Map.Entry<String, Map<String, String>>> queue = this.requestMap.putIfAbsent(jvmRoute, newQueue);
+      return (queue != null) ? queue : newQueue;
+   }
+   
+   public int getPort()
+   {
+      return this.server.getLocalPort();
+   }
+   
+   public void start() throws Exception
+   {
+      this.server = new ServerSocket(0, 200, null);
+      this.server.setSoTimeout(15000);
+      
+      for (int i = 0; i < this.workers.length; ++i)
+      {
+         this.workers[i] = new Thread(this);
+         this.workers[i].start();
+      }
+   }
+   
+   public void stop() throws IOException
+   {
+      for (int i = 0; i < this.workers.length; ++i)
+      {
+         Thread worker = this.workers[i];
+         
+         if (worker != null)
+         {
+            worker.interrupt();
+         }
+      }
+
+      if (this.server != null) this.server.close();
+
+      for (int i = 0; i < this.workers.length; ++i)
+      {
+         Thread worker = this.workers[i];
+         
+         if (worker != null)
+         {
+            try
+            {
+               worker.join();
+            }
+            catch (InterruptedException e)
+            {
+               Thread.currentThread().interrupt();
+            }
+         }
+      }
+      
+      this.requestMap.clear();
+      this.requests.clear();
+   }
+}
\ No newline at end of file

Added: trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.mod_cluster;
+
+import java.net.InetAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Assert;
+
+import org.jboss.test.JBossClusteredTestCase;
+
+/**
+ * A ModClusterServiceTestCase.
+ * 
+ * @author Paul Ferraro
+ */
+public class ModClusterServiceTestCase extends JBossClusteredTestCase
+{
+   private static final String JVM_ROUTE_PATTERN = "%s:8009:jboss.web";
+   
+   private MockProxy proxy = new MockProxy(2);
+   
+   /**
+    * Create a new ModClusterServiceTestCase.
+    * 
+    * @param name
+    */
+   public ModClusterServiceTestCase(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      this.proxy.start();
+   }
+   
+   @Override
+   protected void tearDown() throws Exception
+   {
+      this.proxy.stop();
+      
+      super.tearDown();
+   }
+   
+   public void testInfo() throws Exception
+   {
+      MBeanServerConnection[] servers = this.getAdaptors();
+      
+      ObjectName name = ObjectName.getInstance("jboss.web:service=ModCluster");
+      
+      String[] hosts = this.getServers();
+      
+      for (int i = 0; i < hosts.length; ++i)
+      {
+         String host = InetAddress.getByName(hosts[i]).getHostAddress();
+         
+         servers[i].invoke(name, "addProxy", new Object[] { "127.0.0.1", this.proxy.getPort() }, new String[] { String.class.getName(), Integer.TYPE.getName() });
+         
+         // Wait the duration of at least 1 status interval
+         Thread.sleep(20000);
+         
+         // Proxy should have received:
+         // 1. INFO - to establish proxy connectivity
+         // 2. CONFIG - to configure proxy
+         // 3. STATUS - periodic status
+         
+         List<Map.Entry<String, Map<String, String>>> requests = new LinkedList<Map.Entry<String, Map<String, String>>>();
+         
+         int count = this.proxy.getRequests().drainTo(requests);
+
+         Assert.assertEquals(1, count);
+
+         for (Map.Entry<String, Map<String, String>> infoRequest: requests)
+         {
+            String command = infoRequest.getKey();
+            Map<String, String> parameters = infoRequest.getValue();
+            
+            Assert.assertTrue(command, command.startsWith("INFO"));
+            Assert.assertFalse(command.contains("*"));
+            Assert.assertTrue(parameters.isEmpty());
+         }
+         
+         requests.clear();
+         
+         count = this.proxy.getRequests(String.format(JVM_ROUTE_PATTERN, host)).drainTo(requests);
+         
+         Assert.assertTrue(Integer.toString(count), count >= 2);
+         
+         Map.Entry<String, Map<String, String>> configRequest = requests.get(0);
+         String command = configRequest.getKey();
+         Map<String, String> parameters = configRequest.getValue();
+
+         Assert.assertTrue(command, command.startsWith("CONFIG"));
+         Assert.assertFalse(command.contains("*"));
+         Assert.assertEquals(5, parameters.size());
+         Assert.assertEquals("8009", parameters.get("Port"));
+         Assert.assertEquals(host, parameters.get("Host"));
+         Assert.assertEquals("ajp", parameters.get("Type"));
+         Assert.assertEquals(String.format(JVM_ROUTE_PATTERN, host), parameters.get("JVMRoute"));
+         Assert.assertEquals("No", parameters.get("StickySessionForce"));
+         
+         for (Map.Entry<String, Map<String, String>> statusRequest: requests.subList(1, requests.size()))
+         {
+            command = statusRequest.getKey();
+            parameters = statusRequest.getValue();
+            
+            Assert.assertTrue(command, command.startsWith("STATUS"));
+            Assert.assertFalse(command.contains("*"));
+            Assert.assertEquals(2, parameters.size());
+            Assert.assertEquals(String.format(JVM_ROUTE_PATTERN, host), parameters.get("JVMRoute"));
+            String value = parameters.get("Load");
+            Assert.assertNotNull(value);
+            int load = Integer.parseInt(value);
+            Assert.assertTrue(0 <= load);
+            Assert.assertTrue(load <= 100);
+         }
+      }
+   }
+}

Added: trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="WebServer"
+         class="org.jboss.web.tomcat.service.deployers.TomcatService">
+         
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=WebServer", exposedInterface=org.jboss.web.tomcat.service.deployers.TomcatServiceMBean.class,registerDirectly=true)</annotation>
+
+      <!-- Only needed if the org.jboss.web.tomcat.service.jca.CachedConnectionValve
+           is enabled in the tomcat server.xml file.
+      -->
+      <depends>jboss.jca:service=CachedConnectionManager</depends>
+
+      <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!-- Uncomment to enable mod_cluster integration -->
+      <depends>ModClusterListener</depends>
+
+      <!-- Inject the TomcatDeployer -->
+      <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
+      <!-- Set the securityManagerService used to flush the auth cache on session expiration -->
+      <property name="securityManagerService">
+         <inject bean="jboss.security:service=JaasSecurityManager" />
+      </property>
+      <!-- 
+         Do not configure other JMX attributes via this file.
+         Use the WarDeployer bean in deployers/jboss-web.deployer/war-deployers-beans.xml
+      -->
+
+   </bean>
+   
+   <bean name="WebServerMO"
+      class="org.jboss.web.tomcat.service.management.WebServer">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>service</key>
+               <value>WebServer</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+
+   <bean name="ConnectorBean-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ConnectorBean">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>GlobalRequestProcessor</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="ThreadPool-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ThreadPool">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>ThreadPool</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="${jboss.bind.address}-MO"
+      class="org.jboss.web.tomcat.service.management.Host">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>Host</value>
+            </entry>
+         <entry>
+            <key>host</key>
+            <value>
+               <value-factory bean="ServiceBindingManager"
+                  method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+            </value>
+         </entry>
+         </map>
+      </property>
+   </bean>
+
+   
+</deployment>

Added: trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/ha-mod_cluster-0/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Beans that provide JBoss AS-side functionality for mod_cluster. These
+  beans are all "On Demand", i.e. that are not installed unless requested.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- To enable mod_cluster, uncomment the matching <depends/> within the WebServer bean located in:
+       deploy/jbossweb.sar/META-INF/jboss-beans.xml
+       The configured mod_cluster service must start before (and stop after) the WebServer bean. -->
+  <bean name="ModClusterListener" class="org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter" mode="On Demand">
+    <constructor>
+      <!-- To use the HA singleton version of mod_cluster, change this injection to HAModClusterService -->
+      <parameter><inject bean="HAModClusterService"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- The core mod_cluster service -->
+  <bean name="ModClusterService" class="org.jboss.modcluster.ModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+    </constructor>
+  </bean>
+        
+  <!-- The core mod_cluster service, implemented as an HA singleton -->
+  <!-- The HA partition allows mod_cluster to detect and handle crashed members -->
+  <bean name="HAModClusterService" class="org.jboss.modcluster.ha.HAModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ha.HAModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+      <parameter><inject bean="HAPartition"/></parameter>
+      <parameter><bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- Configure this node's communication with the load balancer -->
+  <bean name="ModClusterConfig" class="org.jboss.modcluster.config.ha.HAModClusterConfig" mode="On Demand">
+    
+    <!-- Comma separated list of address:port listing the httpd servers
+         where mod_cluster is running. -->
+    <property name="proxyList">${jboss.mod_cluster.proxyList:}</property>
+    
+    <!-- URL prefix to send with commands to mod_cluster.  Default is no prefix. -->
+    <!--property name="proxyURL"></property-->
+    
+    <!-- mod_advertise is a small httpd module that advertises the 
+         availability of httpd servers via multicast, allowing 
+         ModClusterService to discover the httpd front-end instead of/in 
+         addition to having them defined in proxyList. -->
+    <!-- Whether to listen for advertise messages -->
+    <property name="advertise">${jboss.mod_cluster.advertise.enabled:false}</property>
+    
+    <!-- Multicast address on which to listen for advertisements -->
+    <property name="advertiseGroupAddress">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    <!-- Port on which to listen for advertisements -->
+    <property name="advertisePort">
+      <value-factory bean="ServiceBindingManager" method="getIntBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+      </value-factory>
+    </property>
+    <!-- Network interface address on which to listen for advertisements -->
+    <property name="advertiseInterface">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroupInterface</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    
+    <!-- Override the java.util.concurrent.ThreadFactory used by the advertise listener -->
+    <!--property name="advertiseThreadFactory"></property-->
+    
+    <!-- Comma delimited list of contexts that should *not* be auto-registered with httpd. -->
+    <!-- ROOT indicates the root context. -->
+    <!-- Context may be qualified by host using a colon, e.g. host1:context1 -->
+    <!-- If no host is defined, localhost is assumed. -->
+    <property name="excludedContexts">${jboss.mod_cluster.excludedContexts:ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console}</property>
+    
+    <!-- Security key the proxy is going to send with advertise messages. 
+         Default is none. -->
+    <!--property name="advertiseSecurityKey"></property-->
+    
+    <!-- Whether to use SSL to communicate with mod_cluster. Note this
+         has nothing to do with handling of https requests by JBoss Web -->
+    <property name="ssl">false</property>
+    
+    <!-- Use domains to group nodes into fail-over groups -->
+    <!-- Requests stuck to a node that is no longer available with fail over to a node within the same domain, if possible -->
+    <!-- Typically used in concert with sticky sessions and buddy replication -->
+    <!--property name="domain"></property-->
+    
+    <!-- Should we use an HA singleton per domain? -->
+    <!--property name="masterPerDomain"></property-->
+    
+    <!-- Configuration values for the load balancer itself (must be the
+         same on all nodes in the cluster). These will be passed to the 
+         load balancer. -->
+    <property name="stickySession">true</property>
+    <property name="stickySessionForce">false</property>
+    <property name="stickySessionRemove">false</property>
+    <property name="maxAttempts">-1</property>
+    <property name="workerTimeout">-1</property>
+  </bean>
+  
+  <!-- Provides information to ModClusterService informing it how much load 
+       this server should take.  This impl calculates the load factor from a 
+       number of metrics and adjusts the value periodically based on runtime
+       conditions, using the JBossWeb engine's backgroundProcessorDelay. -->
+  <bean name="DynamicLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean.class)</annotation>
+    <constructor>
+      <parameter>
+        <!-- Define the load metrics to use in your load balance factor calculation here -->
+        <set elementClass="org.jboss.modcluster.load.metric.LoadMetric">
+          <inject bean="AverageSystemLoadMetric"/>
+          <inject bean="BusyConnectorsLoadMetric"/>
+        </set>
+      </parameter>
+    </constructor>
+    <!-- The number of historical load values used to determine load factor -->
+    <!--property name="history">9</property-->
+    <!-- The exponential decay factor for historical load values -->
+    <!--property name="decayFactor">2</property-->
+  </bean>
+
+  <!-- Default load metrics/sources -->
+
+  <!-- CPU usage -->
+  <!-- Perhaps the best metric for determining system load - but only available on Java 1.6 or later -->
+  <bean name="AverageSystemLoadMetric" class="org.jboss.modcluster.load.metric.impl.AverageSystemLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=AverageSystemLoad",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+    <!-- The weight determines the significance of this metric with respect
+         to others in the overall load balance factor calculation -->
+    <property name="weight">2</property>
+  </bean>
+  <!-- Uses the platform's OperatingSystemMXBean -->
+  <bean name="OperatingSystemLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.OperatingSystemLoadMetricSource" mode="On Demand"></bean>
+
+  <!-- The JBossWeb connector thread pool usage as a ratio of busy threads to max thread pool size -->
+  <!-- Analogous to method=B in mod_jk -->
+  <bean name="BusyConnectorsLoadMetric" class="org.jboss.modcluster.load.metric.impl.BusyConnectorsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=BusyConnectors",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ThreadPoolLoadMetricSource"/></parameter>
+    </constructor>
+    <property name="weight">1</property>
+  </bean>
+  <!-- Queries all JBossWeb ThreadPool mbeans -->
+  <bean name="ThreadPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ThreadPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.web:type=ThreadPool,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- Alternative load balance factor providers -->
+  
+  <!-- Basic impl that returns a static load balance factor.
+       This would replace the DynamicLoadBalanceFactorProvider
+       used above.
+   -->
+  <bean name="SimpleLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProviderMBean.class)</annotation>
+    <property name="loadBalanceFactor">1</property>
+  </bean>
+
+  <!-- 
+       Alternative load metrics, grouped by source. 
+       To use these, inject them into the set passed to the
+       DynamicLoadBalanceFactorProvider bean's constructor above.
+   -->
+  
+  <!-- The system memory usage as ratio of used memory to total memory size -->
+  <!-- Requires com.sun.management.OperatingSystemMXBean -->
+  <bean name="SystemMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.SystemMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SystemMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+  </bean>
+
+  
+  <!-- The heap memory usage as a ratio of used heap to max heap size -->
+  <!-- N.B. This load metric is its own source -->
+  <bean name="HeapMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.HeapMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=HeapMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+  </bean>
+
+
+  <!-- The number of requests/sec processed by the JBossWeb connectors, with respect to the defined capacity -->
+  <!-- Analogous to method=R in mod_jk -->
+  <bean name="RequestCountLoadMetric" class="org.jboss.modcluster.load.metric.impl.RequestCountLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=RequestCount",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>requestCount</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. maximum capacity of 1000 requests/sec -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- The incoming traffic received by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <!-- Analogous to method=T in mod_jk -->
+  <bean name="ReceiveTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.ReceiveTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ReceiveTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesReceived</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1024 KB/s -->
+    <property name="capacity">1024</property>
+  </bean>
+  <!-- The outgoing traffic sent by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <bean name="SendTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.SendTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SendTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesSent</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 512 KB/s -->
+    <property name="capacity">512</property>
+  </bean>
+  <!-- Queries all JBossWeb GlobalRequestProcessor mbeans -->
+  <bean name="RequestProcessorLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.RequestProcessorLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for request processors -->
+      <!--parameter>jboss.web:type=GlobalRequestProcessor,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- The number of active sessions, with respect to the defined capacity -->
+  <!-- Analogous to method=S in mod_jk -->
+  <bean name="ActiveSessionsLoadMetric" class="org.jboss.modcluster.load.metric.impl.ActiveSessionsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ActiveSessions",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="SessionLoadMetricSource"/></parameter>
+      <!--parameter>activeSessions</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1000 active sessions -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- Queries all JBossWeb session manager mbeans -->
+  <bean name="SessionLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.SessionLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for session managers -->
+      <!--parameter>jboss.web:type=Manager,*</parameter-->
+    </constructor>
+  </bean>
+
+  
+  <!-- Returns the connection pool usage as a ratio of used to max pool size -->
+  <bean name="ConnectionPoolUsageMetric" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ConnectionPoolUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ConnectionPoolLoadMetricSource"/></parameter>
+      <!--parameter>InUseConnectionCount</parameter-->
+      <!--parameter>MaxSize</parameter-->
+    </constructor>
+  </bean>
+  <!-- Queries all JCA connection pools -->
+  <bean name="ConnectionPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.jca:service=ManagedConnectionPool,*</parameter-->
+    </constructor>
+  </bean>
+
+  <!-- Generic load metrics/sources -->
+  
+  <!-- Uses the sum of the values of the specified attribute for each
+       mbean matching the query, with respect to a defined capacity. -->
+  <bean name="MBeanAttributeLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttribute",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- mbean attribute --></parameter>
+    </constructor>
+    <property name="capacity">1</property>
+  </bean>
+  <!-- Uses the ratio of the sum of the values of the specified dividend attribute,
+       to the sum of the values of the specified divisor attribute for each mbean
+       matching the query. -->
+  <bean name="MBeanAttributeRatioLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeRatioLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttributeRatio",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- dividend attribute --></parameter>
+      <parameter><!-- divisor attribute --></parameter>
+    </constructor>
+  </bean>
+  <!-- Queries for mbeans matching the specified pattern -->
+  <bean name="MBeanQueryLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.MBeanQueryLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter><!-- ObjectName pattern --></parameter>
+      <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+    </constructor>
+  </bean>
+
+</deployment>
\ No newline at end of file

Added: trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="WebServer"
+         class="org.jboss.web.tomcat.service.deployers.TomcatService">
+         
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=WebServer", exposedInterface=org.jboss.web.tomcat.service.deployers.TomcatServiceMBean.class,registerDirectly=true)</annotation>
+
+      <!-- Only needed if the org.jboss.web.tomcat.service.jca.CachedConnectionValve
+           is enabled in the tomcat server.xml file.
+      -->
+      <depends>jboss.jca:service=CachedConnectionManager</depends>
+
+      <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!-- Uncomment to enable mod_cluster integration -->
+      <depends>ModClusterListener</depends>
+
+      <!-- Inject the TomcatDeployer -->
+      <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
+      <!-- Set the securityManagerService used to flush the auth cache on session expiration -->
+      <property name="securityManagerService">
+         <inject bean="jboss.security:service=JaasSecurityManager" />
+      </property>
+      <!-- 
+         Do not configure other JMX attributes via this file.
+         Use the WarDeployer bean in deployers/jboss-web.deployer/war-deployers-beans.xml
+      -->
+
+   </bean>
+   
+   <bean name="WebServerMO"
+      class="org.jboss.web.tomcat.service.management.WebServer">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>service</key>
+               <value>WebServer</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+
+   <bean name="ConnectorBean-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ConnectorBean">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>GlobalRequestProcessor</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="ThreadPool-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ThreadPool">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>ThreadPool</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="${jboss.bind.address}-MO"
+      class="org.jboss.web.tomcat.service.management.Host">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>Host</value>
+            </entry>
+         <entry>
+            <key>host</key>
+            <value>
+               <value-factory bean="ServiceBindingManager"
+                  method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+            </value>
+         </entry>
+         </map>
+      </property>
+   </bean>
+
+   
+</deployment>

Added: trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/ha-mod_cluster-1/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Beans that provide JBoss AS-side functionality for mod_cluster. These
+  beans are all "On Demand", i.e. that are not installed unless requested.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- To enable mod_cluster, uncomment the matching <depends/> within the WebServer bean located in:
+       deploy/jbossweb.sar/META-INF/jboss-beans.xml
+       The configured mod_cluster service must start before (and stop after) the WebServer bean. -->
+  <bean name="ModClusterListener" class="org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter" mode="On Demand">
+    <constructor>
+      <!-- To use the HA singleton version of mod_cluster, change this injection to HAModClusterService -->
+      <parameter><inject bean="HAModClusterService"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- The core mod_cluster service -->
+  <bean name="ModClusterService" class="org.jboss.modcluster.ModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+    </constructor>
+  </bean>
+        
+  <!-- The core mod_cluster service, implemented as an HA singleton -->
+  <!-- The HA partition allows mod_cluster to detect and handle crashed members -->
+  <bean name="HAModClusterService" class="org.jboss.modcluster.ha.HAModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ha.HAModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+      <parameter><inject bean="HAPartition"/></parameter>
+      <parameter><bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- Configure this node's communication with the load balancer -->
+  <bean name="ModClusterConfig" class="org.jboss.modcluster.config.ha.HAModClusterConfig" mode="On Demand">
+    
+    <!-- Comma separated list of address:port listing the httpd servers
+         where mod_cluster is running. -->
+    <property name="proxyList">${jboss.mod_cluster.proxyList:}</property>
+    
+    <!-- URL prefix to send with commands to mod_cluster.  Default is no prefix. -->
+    <!--property name="proxyURL"></property-->
+    
+    <!-- mod_advertise is a small httpd module that advertises the 
+         availability of httpd servers via multicast, allowing 
+         ModClusterService to discover the httpd front-end instead of/in 
+         addition to having them defined in proxyList. -->
+    <!-- Whether to listen for advertise messages -->
+    <property name="advertise">${jboss.mod_cluster.advertise.enabled:false}</property>
+    
+    <!-- Multicast address on which to listen for advertisements -->
+    <property name="advertiseGroupAddress">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    <!-- Port on which to listen for advertisements -->
+    <property name="advertisePort">
+      <value-factory bean="ServiceBindingManager" method="getIntBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+      </value-factory>
+    </property>
+    <!-- Network interface address on which to listen for advertisements -->
+    <property name="advertiseInterface">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroupInterface</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    
+    <!-- Override the java.util.concurrent.ThreadFactory used by the advertise listener -->
+    <!--property name="advertiseThreadFactory"></property-->
+    
+    <!-- Comma delimited list of contexts that should *not* be auto-registered with httpd. -->
+    <!-- ROOT indicates the root context. -->
+    <!-- Context may be qualified by host using a colon, e.g. host1:context1 -->
+    <!-- If no host is defined, localhost is assumed. -->
+    <property name="excludedContexts">${jboss.mod_cluster.excludedContexts:ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console}</property>
+    
+    <!-- Security key the proxy is going to send with advertise messages. 
+         Default is none. -->
+    <!--property name="advertiseSecurityKey"></property-->
+    
+    <!-- Whether to use SSL to communicate with mod_cluster. Note this
+         has nothing to do with handling of https requests by JBoss Web -->
+    <property name="ssl">false</property>
+    
+    <!-- Use domains to group nodes into fail-over groups -->
+    <!-- Requests stuck to a node that is no longer available with fail over to a node within the same domain, if possible -->
+    <!-- Typically used in concert with sticky sessions and buddy replication -->
+    <!--property name="domain"></property-->
+    
+    <!-- Should we use an HA singleton per domain? -->
+    <!--property name="masterPerDomain"></property-->
+    
+    <!-- Configuration values for the load balancer itself (must be the
+         same on all nodes in the cluster). These will be passed to the 
+         load balancer. -->
+    <property name="stickySession">true</property>
+    <property name="stickySessionForce">false</property>
+    <property name="stickySessionRemove">false</property>
+    <property name="maxAttempts">-1</property>
+    <property name="workerTimeout">-1</property>
+  </bean>
+  
+  <!-- Provides information to ModClusterService informing it how much load 
+       this server should take.  This impl calculates the load factor from a 
+       number of metrics and adjusts the value periodically based on runtime
+       conditions, using the JBossWeb engine's backgroundProcessorDelay. -->
+  <bean name="DynamicLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean.class)</annotation>
+    <constructor>
+      <parameter>
+        <!-- Define the load metrics to use in your load balance factor calculation here -->
+        <set elementClass="org.jboss.modcluster.load.metric.LoadMetric">
+          <inject bean="AverageSystemLoadMetric"/>
+          <inject bean="BusyConnectorsLoadMetric"/>
+        </set>
+      </parameter>
+    </constructor>
+    <!-- The number of historical load values used to determine load factor -->
+    <!--property name="history">9</property-->
+    <!-- The exponential decay factor for historical load values -->
+    <!--property name="decayFactor">2</property-->
+  </bean>
+
+  <!-- Default load metrics/sources -->
+
+  <!-- CPU usage -->
+  <!-- Perhaps the best metric for determining system load - but only available on Java 1.6 or later -->
+  <bean name="AverageSystemLoadMetric" class="org.jboss.modcluster.load.metric.impl.AverageSystemLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=AverageSystemLoad",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+    <!-- The weight determines the significance of this metric with respect
+         to others in the overall load balance factor calculation -->
+    <property name="weight">2</property>
+  </bean>
+  <!-- Uses the platform's OperatingSystemMXBean -->
+  <bean name="OperatingSystemLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.OperatingSystemLoadMetricSource" mode="On Demand"></bean>
+
+  <!-- The JBossWeb connector thread pool usage as a ratio of busy threads to max thread pool size -->
+  <!-- Analogous to method=B in mod_jk -->
+  <bean name="BusyConnectorsLoadMetric" class="org.jboss.modcluster.load.metric.impl.BusyConnectorsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=BusyConnectors",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ThreadPoolLoadMetricSource"/></parameter>
+    </constructor>
+    <property name="weight">1</property>
+  </bean>
+  <!-- Queries all JBossWeb ThreadPool mbeans -->
+  <bean name="ThreadPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ThreadPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.web:type=ThreadPool,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- Alternative load balance factor providers -->
+  
+  <!-- Basic impl that returns a static load balance factor.
+       This would replace the DynamicLoadBalanceFactorProvider
+       used above.
+   -->
+  <bean name="SimpleLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProviderMBean.class)</annotation>
+    <property name="loadBalanceFactor">1</property>
+  </bean>
+
+  <!-- 
+       Alternative load metrics, grouped by source. 
+       To use these, inject them into the set passed to the
+       DynamicLoadBalanceFactorProvider bean's constructor above.
+   -->
+  
+  <!-- The system memory usage as ratio of used memory to total memory size -->
+  <!-- Requires com.sun.management.OperatingSystemMXBean -->
+  <bean name="SystemMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.SystemMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SystemMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+  </bean>
+
+  
+  <!-- The heap memory usage as a ratio of used heap to max heap size -->
+  <!-- N.B. This load metric is its own source -->
+  <bean name="HeapMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.HeapMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=HeapMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+  </bean>
+
+
+  <!-- The number of requests/sec processed by the JBossWeb connectors, with respect to the defined capacity -->
+  <!-- Analogous to method=R in mod_jk -->
+  <bean name="RequestCountLoadMetric" class="org.jboss.modcluster.load.metric.impl.RequestCountLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=RequestCount",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>requestCount</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. maximum capacity of 1000 requests/sec -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- The incoming traffic received by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <!-- Analogous to method=T in mod_jk -->
+  <bean name="ReceiveTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.ReceiveTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ReceiveTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesReceived</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1024 KB/s -->
+    <property name="capacity">1024</property>
+  </bean>
+  <!-- The outgoing traffic sent by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <bean name="SendTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.SendTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SendTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesSent</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 512 KB/s -->
+    <property name="capacity">512</property>
+  </bean>
+  <!-- Queries all JBossWeb GlobalRequestProcessor mbeans -->
+  <bean name="RequestProcessorLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.RequestProcessorLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for request processors -->
+      <!--parameter>jboss.web:type=GlobalRequestProcessor,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- The number of active sessions, with respect to the defined capacity -->
+  <!-- Analogous to method=S in mod_jk -->
+  <bean name="ActiveSessionsLoadMetric" class="org.jboss.modcluster.load.metric.impl.ActiveSessionsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ActiveSessions",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="SessionLoadMetricSource"/></parameter>
+      <!--parameter>activeSessions</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1000 active sessions -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- Queries all JBossWeb session manager mbeans -->
+  <bean name="SessionLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.SessionLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for session managers -->
+      <!--parameter>jboss.web:type=Manager,*</parameter-->
+    </constructor>
+  </bean>
+
+  
+  <!-- Returns the connection pool usage as a ratio of used to max pool size -->
+  <bean name="ConnectionPoolUsageMetric" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ConnectionPoolUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ConnectionPoolLoadMetricSource"/></parameter>
+      <!--parameter>InUseConnectionCount</parameter-->
+      <!--parameter>MaxSize</parameter-->
+    </constructor>
+  </bean>
+  <!-- Queries all JCA connection pools -->
+  <bean name="ConnectionPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.jca:service=ManagedConnectionPool,*</parameter-->
+    </constructor>
+  </bean>
+
+  <!-- Generic load metrics/sources -->
+  
+  <!-- Uses the sum of the values of the specified attribute for each
+       mbean matching the query, with respect to a defined capacity. -->
+  <bean name="MBeanAttributeLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttribute",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- mbean attribute --></parameter>
+    </constructor>
+    <property name="capacity">1</property>
+  </bean>
+  <!-- Uses the ratio of the sum of the values of the specified dividend attribute,
+       to the sum of the values of the specified divisor attribute for each mbean
+       matching the query. -->
+  <bean name="MBeanAttributeRatioLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeRatioLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttributeRatio",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- dividend attribute --></parameter>
+      <parameter><!-- divisor attribute --></parameter>
+    </constructor>
+  </bean>
+  <!-- Queries for mbeans matching the specified pattern -->
+  <bean name="MBeanQueryLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.MBeanQueryLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter><!-- ObjectName pattern --></parameter>
+      <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+    </constructor>
+  </bean>
+
+</deployment>
\ No newline at end of file

Added: trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="WebServer"
+         class="org.jboss.web.tomcat.service.deployers.TomcatService">
+         
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=WebServer", exposedInterface=org.jboss.web.tomcat.service.deployers.TomcatServiceMBean.class,registerDirectly=true)</annotation>
+
+      <!-- Only needed if the org.jboss.web.tomcat.service.jca.CachedConnectionValve
+           is enabled in the tomcat server.xml file.
+      -->
+      <depends>jboss.jca:service=CachedConnectionManager</depends>
+
+      <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!-- Uncomment to enable mod_cluster integration -->
+      <depends>ModClusterListener</depends>
+
+      <!-- Inject the TomcatDeployer -->
+      <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
+      <!-- Set the securityManagerService used to flush the auth cache on session expiration -->
+      <property name="securityManagerService">
+         <inject bean="jboss.security:service=JaasSecurityManager" />
+      </property>
+      <!-- 
+         Do not configure other JMX attributes via this file.
+         Use the WarDeployer bean in deployers/jboss-web.deployer/war-deployers-beans.xml
+      -->
+
+   </bean>
+   
+   <bean name="WebServerMO"
+      class="org.jboss.web.tomcat.service.management.WebServer">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>service</key>
+               <value>WebServer</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+
+   <bean name="ConnectorBean-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ConnectorBean">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>GlobalRequestProcessor</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="ThreadPool-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ThreadPool">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>ThreadPool</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="${jboss.bind.address}-MO"
+      class="org.jboss.web.tomcat.service.management.Host">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>Host</value>
+            </entry>
+         <entry>
+            <key>host</key>
+            <value>
+               <value-factory bean="ServiceBindingManager"
+                  method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+            </value>
+         </entry>
+         </map>
+      </property>
+   </bean>
+
+   
+</deployment>

Added: trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="WebServer"
+         class="org.jboss.web.tomcat.service.deployers.TomcatService">
+         
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=WebServer", exposedInterface=org.jboss.web.tomcat.service.deployers.TomcatServiceMBean.class,registerDirectly=true)</annotation>
+
+      <!-- Only needed if the org.jboss.web.tomcat.service.jca.CachedConnectionValve
+           is enabled in the tomcat server.xml file.
+      -->
+      <depends>jboss.jca:service=CachedConnectionManager</depends>
+
+      <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!-- Uncomment to enable mod_cluster integration -->
+      <depends>ModClusterListener</depends>
+
+      <!-- Inject the TomcatDeployer -->
+      <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
+      <!-- Set the securityManagerService used to flush the auth cache on session expiration -->
+      <property name="securityManagerService">
+         <inject bean="jboss.security:service=JaasSecurityManager" />
+      </property>
+      <!-- 
+         Do not configure other JMX attributes via this file.
+         Use the WarDeployer bean in deployers/jboss-web.deployer/war-deployers-beans.xml
+      -->
+
+   </bean>
+   
+   <bean name="WebServerMO"
+      class="org.jboss.web.tomcat.service.management.WebServer">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>service</key>
+               <value>WebServer</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+
+   <bean name="ConnectorBean-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ConnectorBean">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>GlobalRequestProcessor</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" >
+            <parameter>jboss.web:service=WebServer</parameter>
+         </value-factory>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="ThreadPool-http-${jboss.bind.address}-8080MO"
+      class="org.jboss.web.tomcat.service.management.ThreadPool">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>ThreadPool</value>
+            </entry>
+         </map>
+      </property>
+      <property name="port">
+         <value-factory bean="ServiceBindingManager"
+            method="getIntBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="address">
+         <value-factory bean="ServiceBindingManager"
+            method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+      </property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </bean>
+   <bean name="${jboss.bind.address}-MO"
+      class="org.jboss.web.tomcat.service.management.Host">
+      <property name="domain">jboss.web</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>Host</value>
+            </entry>
+         <entry>
+            <key>host</key>
+            <value>
+               <value-factory bean="ServiceBindingManager"
+                  method="getStringBinding" parameter="jboss.web:service=WebServer"/>
+            </value>
+         </entry>
+         </map>
+      </property>
+   </bean>
+
+   
+</deployment>

Modified: trunk/tomcat/pom.xml
===================================================================
--- trunk/tomcat/pom.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/tomcat/pom.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -138,7 +138,14 @@
                 <mkdir dir="${output.deploy}/cluster"/>
                 <copy todir="${output.deploy}/cluster"
                       file="${output.lib}/jbossweb-cluster.aop"/>
-            
+
+                <!-- mod_cluster service -->
+                <mkdir dir="${output.deploy}/mod_cluster.sar/META-INF"/>
+                <copy file="${maven.dependency.org.jboss.mod_cluster.mod_cluster.jar.path}"
+                      tofile="${output.deploy}/mod_cluster.sar/mod_cluster.jar"/>
+                <copy file="${output.resources}/mod_cluster-jboss-beans.xml"
+                      todir="${output.deploy}/mod_cluster.sar/META-INF"/>
+
              </tasks>
             </configuration>
           </execution>
@@ -383,6 +390,11 @@
        <groupId>org.jboss.mc-int</groupId>
        <artifactId>jboss-mc-int-servlet</artifactId>
     </dependency>
+    <dependency>
+       <groupId>org.jboss.mod_cluster</groupId>
+       <artifactId>mod_cluster</artifactId>
+       <scope>runtime</scope>
+    </dependency>
   </dependencies>
   
 </project>

Modified: trunk/tomcat/src/resources/jboss-beans.xml
===================================================================
--- trunk/tomcat/src/resources/jboss-beans.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/tomcat/src/resources/jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -14,6 +14,9 @@
       <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
       <depends>jboss:service=TransactionManager</depends>
 
+      <!-- Uncomment to enable mod_cluster integration -->
+      <!--depends>ModClusterListener</depends-->
+      
       <!-- Inject the TomcatDeployer -->
       <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
       <!-- Set the securityManagerService used to flush the auth cache on session expiration -->

Added: trunk/tomcat/src/resources/mod_cluster-jboss-beans.xml
===================================================================
--- trunk/tomcat/src/resources/mod_cluster-jboss-beans.xml	                        (rev 0)
+++ trunk/tomcat/src/resources/mod_cluster-jboss-beans.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Beans that provide JBoss AS-side functionality for mod_cluster. These
+  beans are all "On Demand", i.e. that are not installed unless requested.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- To enable mod_cluster, uncomment the matching <depends/> within the WebServer bean located in:
+       deploy/jbossweb.sar/META-INF/jboss-beans.xml
+       The configured mod_cluster service must start before (and stop after) the WebServer bean. -->
+  <bean name="ModClusterListener" class="org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter" mode="On Demand">
+    <constructor>
+      <!-- To use the HA singleton version of mod_cluster, change this injection to HAModClusterService -->
+      <parameter><inject bean="ModClusterService"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- The core mod_cluster service -->
+  <bean name="ModClusterService" class="org.jboss.modcluster.ModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+    </constructor>
+  </bean>
+        
+  <!-- The core mod_cluster service, implemented as an HA singleton -->
+  <!-- The HA partition allows mod_cluster to detect and handle crashed members -->
+  <bean name="HAModClusterService" class="org.jboss.modcluster.ha.HAModClusterService" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ha.HAModClusterServiceMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ModClusterConfig"/></parameter>
+      <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
+      <parameter><inject bean="HAPartition"/></parameter>
+      <parameter><bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"/></parameter>
+    </constructor>
+  </bean>
+  
+  <!-- Configure this node's communication with the load balancer -->
+  <bean name="ModClusterConfig" class="org.jboss.modcluster.config.ha.HAModClusterConfig" mode="On Demand">
+    
+    <!-- Comma separated list of address:port listing the httpd servers
+         where mod_cluster is running. -->
+    <property name="proxyList">${jboss.mod_cluster.proxyList:}</property>
+    
+    <!-- URL prefix to send with commands to mod_cluster.  Default is no prefix. -->
+    <!--property name="proxyURL"></property-->
+    
+    <!-- mod_advertise is a small httpd module that advertises the 
+         availability of httpd servers via multicast, allowing 
+         ModClusterService to discover the httpd front-end instead of/in 
+         addition to having them defined in proxyList. -->
+    <!-- Whether to listen for advertise messages -->
+    <property name="advertise">${jboss.mod_cluster.advertise.enabled:false}</property>
+    
+    <!-- Multicast address on which to listen for advertisements -->
+    <property name="advertiseGroupAddress">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    <!-- Port on which to listen for advertisements -->
+    <property name="advertisePort">
+      <value-factory bean="ServiceBindingManager" method="getIntBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroup</parameter>
+      </value-factory>
+    </property>
+    <!-- Network interface address on which to listen for advertisements -->
+    <property name="advertiseInterface">
+      <value-factory bean="ServiceBindingManager" method="getStringBinding">
+        <parameter>ModClusterService</parameter>
+        <parameter>AdvertiseGroupInterface</parameter>
+        <parameter><null/></parameter>
+      </value-factory>
+    </property>
+    
+    <!-- Override the java.util.concurrent.ThreadFactory used by the advertise listener -->
+    <!--property name="advertiseThreadFactory"></property-->
+    
+    <!-- Comma delimited list of contexts that should *not* be auto-registered with httpd. -->
+    <!-- ROOT indicates the root context. -->
+    <!-- Context may be qualified by host using a colon, e.g. host1:context1 -->
+    <!-- If no host is defined, localhost is assumed. -->
+    <property name="excludedContexts">${jboss.mod_cluster.excludedContexts:ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console}</property>
+    
+    <!-- Security key the proxy is going to send with advertise messages. 
+         Default is none. -->
+    <!--property name="advertiseSecurityKey"></property-->
+    
+    <!-- Whether to use SSL to communicate with mod_cluster. Note this
+         has nothing to do with handling of https requests by JBoss Web -->
+    <property name="ssl">false</property>
+    
+    <!-- Use domains to group nodes into fail-over groups -->
+    <!-- Requests stuck to a node that is no longer available with fail over to a node within the same domain, if possible -->
+    <!-- Typically used in concert with sticky sessions and buddy replication -->
+    <!--property name="domain"></property-->
+    
+    <!-- Should we use an HA singleton per domain? -->
+    <!--property name="masterPerDomain"></property-->
+    
+    <!-- Configuration values for the load balancer itself (must be the
+         same on all nodes in the cluster). These will be passed to the 
+         load balancer. -->
+    <property name="stickySession">true</property>
+    <property name="stickySessionForce">false</property>
+    <property name="stickySessionRemove">false</property>
+    <property name="maxAttempts">-1</property>
+    <property name="workerTimeout">-1</property>
+  </bean>
+  
+  <!-- Provides information to ModClusterService informing it how much load 
+       this server should take.  This impl calculates the load factor from a 
+       number of metrics and adjusts the value periodically based on runtime
+       conditions, using the JBossWeb engine's backgroundProcessorDelay. -->
+  <bean name="DynamicLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean.class)</annotation>
+    <constructor>
+      <parameter>
+        <!-- Define the load metrics to use in your load balance factor calculation here -->
+        <set elementClass="org.jboss.modcluster.load.metric.LoadMetric">
+          <inject bean="AverageSystemLoadMetric"/>
+          <inject bean="BusyConnectorsLoadMetric"/>
+        </set>
+      </parameter>
+    </constructor>
+    <!-- The number of historical load values used to determine load factor -->
+    <!--property name="history">9</property-->
+    <!-- The exponential decay factor for historical load values -->
+    <!--property name="decayFactor">2</property-->
+  </bean>
+
+  <!-- Default load metrics/sources -->
+
+  <!-- CPU usage -->
+  <!-- Perhaps the best metric for determining system load - but only available on Java 1.6 or later -->
+  <bean name="AverageSystemLoadMetric" class="org.jboss.modcluster.load.metric.impl.AverageSystemLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=AverageSystemLoad",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+    <!-- The weight determines the significance of this metric with respect
+         to others in the overall load balance factor calculation -->
+    <property name="weight">2</property>
+  </bean>
+  <!-- Uses the platform's OperatingSystemMXBean -->
+  <bean name="OperatingSystemLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.OperatingSystemLoadMetricSource" mode="On Demand"></bean>
+
+  <!-- The JBossWeb connector thread pool usage as a ratio of busy threads to max thread pool size -->
+  <!-- Analogous to method=B in mod_jk -->
+  <bean name="BusyConnectorsLoadMetric" class="org.jboss.modcluster.load.metric.impl.BusyConnectorsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=BusyConnectors",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ThreadPoolLoadMetricSource"/></parameter>
+    </constructor>
+    <property name="weight">1</property>
+  </bean>
+  <!-- Queries all JBossWeb ThreadPool mbeans -->
+  <bean name="ThreadPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ThreadPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.web:type=ThreadPool,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- Alternative load balance factor providers -->
+  
+  <!-- Basic impl that returns a static load balance factor.
+       This would replace the DynamicLoadBalanceFactorProvider
+       used above.
+   -->
+  <bean name="SimpleLoadBalanceFactorProvider" class="org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProvider" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor",exposedInterface=org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProviderMBean.class)</annotation>
+    <property name="loadBalanceFactor">1</property>
+  </bean>
+
+  <!-- 
+       Alternative load metrics, grouped by source. 
+       To use these, inject them into the set passed to the
+       DynamicLoadBalanceFactorProvider bean's constructor above.
+   -->
+  
+  <!-- The system memory usage as ratio of used memory to total memory size -->
+  <!-- Requires com.sun.management.OperatingSystemMXBean -->
+  <bean name="SystemMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.SystemMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SystemMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
+    </constructor>
+  </bean>
+
+  
+  <!-- The heap memory usage as a ratio of used heap to max heap size -->
+  <!-- N.B. This load metric is its own source -->
+  <bean name="HeapMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metric.impl.HeapMemoryUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=HeapMemoryUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+  </bean>
+
+
+  <!-- The number of requests/sec processed by the JBossWeb connectors, with respect to the defined capacity -->
+  <!-- Analogous to method=R in mod_jk -->
+  <bean name="RequestCountLoadMetric" class="org.jboss.modcluster.load.metric.impl.RequestCountLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=RequestCount",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>requestCount</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. maximum capacity of 1000 requests/sec -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- The incoming traffic received by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <!-- Analogous to method=T in mod_jk -->
+  <bean name="ReceiveTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.ReceiveTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ReceiveTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesReceived</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1024 KB/s -->
+    <property name="capacity">1024</property>
+  </bean>
+  <!-- The outgoing traffic sent by JBossWeb connectors in KB/sec, with respect to the defined capacity -->
+  <bean name="SendTrafficLoadMetric" class="org.jboss.modcluster.load.metric.impl.SendTrafficLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=SendTraffic",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="RequestProcessorLoadMetricSource"/></parameter>
+      <!--parameter>bytesSent</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 512 KB/s -->
+    <property name="capacity">512</property>
+  </bean>
+  <!-- Queries all JBossWeb GlobalRequestProcessor mbeans -->
+  <bean name="RequestProcessorLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.RequestProcessorLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for request processors -->
+      <!--parameter>jboss.web:type=GlobalRequestProcessor,*</parameter-->
+    </constructor>
+  </bean>
+
+
+  <!-- The number of active sessions, with respect to the defined capacity -->
+  <!-- Analogous to method=S in mod_jk -->
+  <bean name="ActiveSessionsLoadMetric" class="org.jboss.modcluster.load.metric.impl.ActiveSessionsLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ActiveSessions",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="SessionLoadMetricSource"/></parameter>
+      <!--parameter>activeSessions</parameter-->
+    </constructor>
+    <!-- This metric requires an explicit capacity, e.g. max capacity of 1000 active sessions -->
+    <property name="capacity">1000</property>
+  </bean>
+  <!-- Queries all JBossWeb session manager mbeans -->
+  <bean name="SessionLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.SessionLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for session managers -->
+      <!--parameter>jboss.web:type=Manager,*</parameter-->
+    </constructor>
+  </bean>
+
+  
+  <!-- Returns the connection pool usage as a ratio of used to max pool size -->
+  <bean name="ConnectionPoolUsageMetric" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolUsageLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=ConnectionPoolUsage",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="ConnectionPoolLoadMetricSource"/></parameter>
+      <!--parameter>InUseConnectionCount</parameter-->
+      <!--parameter>MaxSize</parameter-->
+    </constructor>
+  </bean>
+  <!-- Queries all JCA connection pools -->
+  <bean name="ConnectionPoolLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.ConnectionPoolLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter class="javax.management.MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+      <!-- Object name pattern for connector thread pools -->
+      <!--parameter>jboss.jca:service=ManagedConnectionPool,*</parameter-->
+    </constructor>
+  </bean>
+
+  <!-- Generic load metrics/sources -->
+  
+  <!-- Uses the sum of the values of the specified attribute for each
+       mbean matching the query, with respect to a defined capacity. -->
+  <bean name="MBeanAttributeLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttribute",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- mbean attribute --></parameter>
+    </constructor>
+    <property name="capacity">1</property>
+  </bean>
+  <!-- Uses the ratio of the sum of the values of the specified dividend attribute,
+       to the sum of the values of the specified divisor attribute for each mbean
+       matching the query. -->
+  <bean name="MBeanAttributeRatioLoadMetric" class="org.jboss.modcluster.load.metric.impl.MBeanAttributeRatioLoadMetric" mode="On Demand">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster,provider=LoadBalanceFactor,metric=MBeanAttributeRatio",exposedInterface=org.jboss.modcluster.load.metric.LoadMetricMBean.class)</annotation>
+    <constructor>
+      <parameter><inject bean="MBeanQueryLoadMetricSource"/></parameter>
+      <parameter><!-- dividend attribute --></parameter>
+      <parameter><!-- divisor attribute --></parameter>
+    </constructor>
+  </bean>
+  <!-- Queries for mbeans matching the specified pattern -->
+  <bean name="MBeanQueryLoadMetricSource" class="org.jboss.modcluster.load.metric.impl.MBeanQueryLoadMetricSource" mode="On Demand">
+    <constructor>
+      <parameter><!-- ObjectName pattern --></parameter>
+      <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+    </constructor>
+  </bean>
+
+</deployment>
\ No newline at end of file

Modified: trunk/tomcat/src/resources/server.xml
===================================================================
--- trunk/tomcat/src/resources/server.xml	2009-11-21 04:25:36 UTC (rev 96676)
+++ trunk/tomcat/src/resources/server.xml	2009-11-21 06:23:10 UTC (rev 96677)
@@ -5,6 +5,9 @@
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
    <Listener className="org.apache.catalina.core.JasperListener" />
+   <!-- Required for mod_cluster integration, will be ignored if mod_cluster is not enabled -->
+   <Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener"
+             delegateBeanName="ModClusterListener" failIfBeanMissing="false" warnIfBeanMissing="false"/>
 
    <Service name="jboss.web">
 




More information about the jboss-cvs-commits mailing list