[jboss-cvs] JBossAS SVN: r95980 - in branches/Branch_5_x: component-matrix and 18 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 3 17:41:11 EST 2009


Author: pferraro
Date: 2009-11-03 17:41:10 -0500 (Tue, 03 Nov 2009)
New Revision: 95980

Added:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java
   branches/Branch_5_x/testsuite/src/resources/cluster/mod_cluster/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/
   branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
   branches/Branch_5_x/tomcat/src/resources/mod_cluster-jboss-beans.xml
Modified:
   branches/Branch_5_x/build/build-distr.xml
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml
   branches/Branch_5_x/testsuite/imports/config/tests-clustering.xml
   branches/Branch_5_x/testsuite/imports/server-config.xml
   branches/Branch_5_x/thirdparty/pom.xml
   branches/Branch_5_x/tomcat/build.xml
   branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml
   branches/Branch_5_x/tomcat/src/resources/server.xml
Log:
[JBAS-7242] mod_cluster integration

Modified: branches/Branch_5_x/build/build-distr.xml
===================================================================
--- branches/Branch_5_x/build/build-distr.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/build/build-distr.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -1338,13 +1338,13 @@
     <copy tofile="${install.server}/all/deployers/war-clustering-deployers-jboss-beans.xml"
       file="${project.root}/${_module.name}/src/resources/war-clustering-deployers-jboss-beans.xml" overwrite="true"/>
     -->
-  	
-  	 <!-- Copy the webserver runtime sar -->
-  	 <mkdir dir="${install.server}/all/deploy/jbossweb.sar"/>
+    
+    <!-- Copy the webserver runtime sar -->
+    <mkdir dir="${install.server}/all/deploy/jbossweb.sar"/>
     <copy todir="${install.server}/all/deploy/jbossweb.sar">
       <fileset dir="${_module.output}/deploy/jbossweb.sar"/>
     </copy>
-  	
+    
     <!-- Copy the ROOT.war -->
     <copy todir="${install.server}/all/deploy" filtering="no">
       <fileset dir="${_module.output}/deploy">
@@ -1357,7 +1357,21 @@
         <include name="cluster/**"/>
       </fileset>
     </copy>
-
+    
+    <!-- Copy mod_cluster service -->
+  	<mkdir dir="${install.server}/all/deploy/mod_cluster.sar"/>
+    <copy todir="${install.server}/all/deploy/mod_cluster.sar">
+      <fileset dir="${jboss.mod_cluster.lib}">
+        <exclude name="*-sources.jar"/>
+        <exclude name="*-javadoc.jar"/>
+      </fileset>
+    </copy>
+  	<mkdir dir="${install.server}/all/deploy/mod_cluster.sar/META-INF"/>
+    <copy todir="${install.server}/all/deploy/mod_cluster.sar/META-INF">
+      <fileset dir="${_module.output}/deploy">
+        <include name="mod_cluster-*.xml"/>
+      </fileset>
+    </copy>
   </target>
 
   <target name="_module-tomcat-all" depends="_module-tomcat-most">

Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -102,6 +102,7 @@
     <version.org.jboss.mdr>2.0.2.GA</version.org.jboss.mdr>
     <version.org.jboss.metadata>1.0.2.Beta2</version.org.jboss.metadata>
     <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.naming>5.0.3.GA</version.org.jboss.naming>
     <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
     <version.org.jboss.remoting>2.5.2</version.org.jboss.remoting>
@@ -2014,8 +2015,20 @@
          </exclusion>
        </exclusions>
     </dependency>
-    
-    <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.integration</groupId>
         <artifactId>jboss-profileservice-spi</artifactId>
         <version>${version.org.jboss.integration}</version>
@@ -2329,7 +2342,7 @@
         <artifactId>xmlunit</artifactId>
         <version>1.0</version>
       </dependency>
-
+      
     </dependencies>
 
   </dependencyManagement>

Modified: branches/Branch_5_x/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/server/src/etc/conf/all/bindingservice.beans/META-INF/bindings-jboss-beans.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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: branches/Branch_5_x/testsuite/imports/config/tests-clustering.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/config/tests-clustering.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/testsuite/imports/config/tests-clustering.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -62,7 +62,10 @@
   </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/*TestCase.class"/>
+  </patternset>
   <patternset id="cluster.excludes">
     <exclude name="org/jboss/test/cluster/**/*TestCase.class"/>
   </patternset>
@@ -354,6 +357,29 @@
 		    
   </target> 
 
+  <target name="tests-mod_cluster">
+
+    <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">
+      <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-clustered-ustxsticky">
 
     <mkdir dir="${build.reports}"/>

Modified: branches/Branch_5_x/testsuite/imports/server-config.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/server-config.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/testsuite/imports/server-config.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -932,6 +932,30 @@
          <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
       </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:config>
 
     <!-- A macro for printing sleep before going into sleep

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/MockProxy.java	2009-11-03 22:41:10 UTC (rev 95980)
@@ -0,0 +1,193 @@
+/*
+ * 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.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<Map.Entry<String, Boolean>, Map<String, String>>> requests = new LinkedBlockingQueue<Map.Entry<Map.Entry<String, Boolean>, Map<String, String>>>();
+   private final int port;
+   private final int socketTimeout = 10000;
+   
+   private ServerSocket server;
+   private Thread worker;
+   
+   private volatile boolean healthy = true;
+   
+   public MockProxy(int port)
+   {
+      this.port = port;
+   }
+   
+   public void run()
+   {
+      try
+      {
+         while (!Thread.currentThread().isInterrupted())
+         {
+            try
+            {
+               Socket socket = this.server.accept();
+               System.out.println("Socket connection accepted");
+               socket.setSoTimeout(this.socketTimeout);
+               
+               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[] parts = line.split("\\s");
+                     
+                     Map.Entry<String, Boolean> command = Collections.singletonMap(parts[0], parts[1].endsWith("*")).entrySet().iterator().next();
+
+                     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("&"))
+                           {
+                              parts = parameter.split("=");
+                              
+                              String name = parts[0];
+                              String value = URLDecoder.decode(parts[1], "UTF-8");
+                              
+                              parameters.put(name, value);
+                           }
+                        }
+                        
+                        this.requests.add(Collections.singletonMap(command, parameters).entrySet().iterator().next());
+                        
+                        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();
+                     }
+                  }
+               }
+               finally
+               {
+                  socket.close();
+               }
+            }
+            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<Map.Entry<String, Boolean>, Map<String, String>>> getRequests()
+   {
+      return this.requests;
+   }
+   
+   public void start() throws Exception
+   {
+      this.server = new ServerSocket(this.port, 50, null);
+      this.server.setSoTimeout(this.socketTimeout);
+      
+      this.worker = new Thread(this);
+      this.worker.start();
+   }
+   
+   public void stop() throws IOException
+   {
+      if (this.worker != null) this.worker.interrupt();
+      
+      if (this.server != null) this.server.close();
+      
+      try
+      {
+         this.worker.join();
+      }
+      catch (InterruptedException e)
+      {
+         Thread.currentThread().interrupt();
+      }
+      
+      this.requests.clear();
+   }
+}
\ No newline at end of file

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/mod_cluster/ModClusterServiceTestCase.java	2009-11-03 22:41:10 UTC (rev 95980)
@@ -0,0 +1,119 @@
+/*
+ * 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.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.JBossTestCase;
+
+/**
+ * A ModClusterServiceTestCase.
+ * 
+ * @author Paul Ferraro
+ */
+public class ModClusterServiceTestCase extends JBossTestCase
+{
+   private MockProxy proxy = new MockProxy(6666);
+   
+   /**
+    * 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 server = this.getServer();
+      
+      ObjectName name = ObjectName.getInstance("jboss.web:service=ModCluster");
+      
+      server.invoke(name, "addProxy", new Object[] { "127.0.0.1", 6666 }, new String[] { String.class.getName(), Integer.TYPE.getName() });
+      
+      // Wait the duration of a status interval
+      Thread.sleep(10000);
+      
+      List<Map.Entry<Map.Entry<String, Boolean>, Map<String, String>>> requests = new LinkedList<Map.Entry<Map.Entry<String, Boolean>, Map<String, String>>>();
+      
+      int count = this.proxy.getRequests().drainTo(requests);
+      
+      System.out.println(requests);
+      
+      // Proxy should have received:
+      // 1. INFO - to establish proxy connectivity
+      // 2. CONFIG - to configure proxy
+      // 3. STATUS - periodic status
+      
+      Assert.assertTrue(count >= 3);
+      
+      Map.Entry<Map.Entry<String, Boolean>, Map<String, String>> infoRequest = requests.get(0);
+      
+      Assert.assertEquals("INFO", infoRequest.getKey().getKey());
+      Assert.assertFalse(infoRequest.getKey().getValue());
+      Assert.assertTrue(infoRequest.getValue().isEmpty());
+      
+      Map.Entry<Map.Entry<String, Boolean>, Map<String, String>> configRequest = requests.get(1);
+      
+      Assert.assertEquals("CONFIG", configRequest.getKey().getKey());
+      Assert.assertFalse(configRequest.getKey().getValue());
+      Assert.assertEquals(5, configRequest.getValue().size());
+      Assert.assertEquals("8009", configRequest.getValue().get("Port"));
+      Assert.assertEquals("127.0.0.1", configRequest.getValue().get("Host"));
+      Assert.assertEquals("ajp", configRequest.getValue().get("Type"));
+      Assert.assertEquals("127.0.0.1:8009:jboss.web", configRequest.getValue().get("JVMRoute"));
+      Assert.assertEquals("No", configRequest.getValue().get("StickySessionForce"));
+      
+      Map.Entry<Map.Entry<String, Boolean>, Map<String, String>> statusRequest = requests.get(2);
+      
+      Assert.assertEquals("STATUS", statusRequest.getKey().getKey());
+      Assert.assertFalse(statusRequest.getKey().getValue());
+      Assert.assertEquals(2, statusRequest.getValue().size());
+      Assert.assertEquals("127.0.0.1:8009:jboss.web", statusRequest.getValue().get("JVMRoute"));
+      Assert.assertNotNull(statusRequest.getValue().get("Load"));
+   }
+}

Added: branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-0/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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: branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/test-configs/mod_cluster-1/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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: branches/Branch_5_x/thirdparty/pom.xml
===================================================================
--- branches/Branch_5_x/thirdparty/pom.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/thirdparty/pom.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -1057,6 +1057,13 @@
                 <componentId>weld-deployer</componentId>
               </mapping>
             </dependency>
+            <dependency>
+               <groupId>org.jboss.mod_cluster</groupId>
+               <artifactId>mod_cluster</artifactId>
+               <mapping>
+                  <componentId>jboss.mod_cluster</componentId>
+               </mapping>
+            </dependency>
             <!-- End mapped dependecies -->
             
           </mappedDependencies>
@@ -1915,6 +1922,10 @@
       <groupId>jboss.web</groupId>
       <artifactId>jbossweb</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.mod_cluster</groupId>
+      <artifactId>mod_cluster</artifactId>
+    </dependency>
     <!-- end jboss deps -->
     
     <dependency>

Modified: branches/Branch_5_x/tomcat/build.xml
===================================================================
--- branches/Branch_5_x/tomcat/build.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/tomcat/build.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -338,11 +338,18 @@
         </fileset>
      </jar>
      
-   <!-- Cluster caches and aop descriptor used for fine-grained replication -->
-   <mkdir dir="${build.deploy}/cluster"/>
-   <copy todir="${build.deploy}/cluster"
-         file="${build.lib}/jbossweb-cluster.aop"/>
+    <!-- Cluster caches and aop descriptor used for fine-grained replication -->
+    <mkdir dir="${build.deploy}/cluster"/>
+    <copy todir="${build.deploy}/cluster"
+          file="${build.lib}/jbossweb-cluster.aop"/>
 
+    <!-- mod_cluster service -->
+    <copy todir="${build.deploy}">
+      <fileset dir="${build.resources}">
+  	    <include name="mod_cluster-jboss-beans.xml"/>
+  	  </fileset>
+    </copy>
+
     <!-- Update the build marker to allow bypassing -->
     <touch file="${build-bypass.marker}"/>
 

Modified: branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml
===================================================================
--- branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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 -->
@@ -26,7 +29,7 @@
       -->
 
    </bean>
-
+   
    <bean name="WebServerMO"
       class="org.jboss.web.tomcat.service.management.WebServer">
       <property name="domain">jboss.web</property>

Added: branches/Branch_5_x/tomcat/src/resources/mod_cluster-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/tomcat/src/resources/mod_cluster-jboss-beans.xml	                        (rev 0)
+++ branches/Branch_5_x/tomcat/src/resources/mod_cluster-jboss-beans.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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: branches/Branch_5_x/tomcat/src/resources/server.xml
===================================================================
--- branches/Branch_5_x/tomcat/src/resources/server.xml	2009-11-03 22:12:55 UTC (rev 95979)
+++ branches/Branch_5_x/tomcat/src/resources/server.xml	2009-11-03 22:41:10 UTC (rev 95980)
@@ -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 -->
+   <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