[jboss-cvs] JBossAS SVN: r72062 - in trunk: cluster/src/resources/jgroups and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 11 21:43:10 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-04-11 21:43:10 -0400 (Fri, 11 Apr 2008)
New Revision: 72062

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java
   trunk/cluster/src/resources/jgroups/jgroups-channelfactory-stacks.xml
   trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/passexp-stacks.xml
   trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-beans.xml
   trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
Log:
[JBAS-5329] Use JGroups shared transport instead of multiplexer

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java	2008-04-11 22:38:54 UTC (rev 72061)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java	2008-04-12 01:43:10 UTC (rev 72062)
@@ -31,6 +31,7 @@
 import org.jboss.system.server.ServerConfigUtil;
 import org.jgroups.Channel;
 import org.jgroups.Event;
+import org.jgroups.Global;
 import org.jgroups.mux.MuxChannel;
 import org.jgroups.stack.IpAddress;
 
@@ -78,8 +79,14 @@
       // Due to problems with coordinated state transfer, we suppress register_for_state_transfer usage.
       // TODO revert to normal if coordinated state transfer is fixed
 //      Channel channel = super.createMultiplexerChannel(stack_name, id, register_for_state_transfer, substate_id);
-      Channel channel = super.createMultiplexerChannel(stack_name, id, false, null);
+      Channel channel = createSharedTransportChannel(stack_name);
       
+      if (channel == null)      
+      {
+         log.debug("Config for " + stack_name + " does not include singleton_name; creating MuxChannel. Config is " + getConfig(stack_name));
+         channel = super.createMultiplexerChannel(stack_name, id, false, null);
+      }
+      
       if (assignLogicalAddresses)
          setChannelUniqueId(channel);
       
@@ -285,6 +292,43 @@
       state = DESTROYED;
       log.debug("Destroyed JChannelFactory");
    }
+   
+   /**
+    * Checks whether the transport protocol configuration for <code>stack_name</code>
+    * supports the shared use of the protocol between channels, creating a
+    * returning a channel if it does.
+    * <p>
+    * Determines whether a shared transport is possible by looking for the
+    * {@link Global#SINGLETON_NAME} parameter in the configuration of the
+    * first protocol in the string returned by {@link #getConfig(String)}.
+    * </p> 
+    * 
+    * @param stack_name the name of the protocol stack
+    * @return a channel configured per <code>stack_name</code>, or <code>null</code>
+    *         if <code>stack_name</code> is not a register protocol stack or
+    *         its transport protocol configuration does not support sharing.
+    * 
+    * @throws Exception
+    */
+   public Channel createSharedTransportChannel(String stack_name) throws Exception
+   {
+      Channel ch = null;
+      String config = getConfig(stack_name);
+      if (config != null)
+      {
+         // Format of string is 
+         // PROTOCOL1(param1=value1;param2=value2):PROTOCOL2(param1=value1;param2=value2):
+         // PROTOCOL1 is always the transport protocol.
+         // We look for the singleton_name param in the transport protocol
+         int tp_idx = config.indexOf("):");
+         int singleton_idx = config.indexOf(Global.SINGLETON_NAME);
+         if (singleton_idx > -1 && singleton_idx < tp_idx)
+         {
+            ch = createChannel(stack_name);
+         }
+      }      
+      return ch;
+   }
 
    private void setChannelUniqueId(Channel channel) throws Exception
    {

Modified: trunk/cluster/src/resources/jgroups/jgroups-channelfactory-stacks.xml
===================================================================
--- trunk/cluster/src/resources/jgroups/jgroups-channelfactory-stacks.xml	2008-04-11 22:38:54 UTC (rev 72061)
+++ trunk/cluster/src/resources/jgroups/jgroups-channelfactory-stacks.xml	2008-04-12 01:43:10 UTC (rev 72062)
@@ -8,6 +8,7 @@
            description="Default: IP multicast based stack, with flow control and message bundling">
         <config>
           <UDP
+             singleton_name="udp"
              mcast_port="${jgroups.udp.mcast_port:45688}"
              mcast_addr="${jgroups.udp.mcast_addr:228.11.11.11}"
              tos="8"
@@ -71,6 +72,7 @@
             run out of memory">
         <config>
             <UDP
+                 singleton_name="udp_sync"
                  mcast_port="${jgroups.udp_sync.mcast_port:45699}"
                  mcast_addr="${jgroups.udp.mcast_addr:229.11.11.11}"
                  tos="8"
@@ -130,7 +132,9 @@
            description="TCP based stack, with flow control and message bundling. This is usually used when IP
            multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast)">
         <config>
-            <TCP start_port="7600"
+            <TCP
+                 singleton_name="tcp"
+                 start_port="7600"
                  tcp_nodelay="true"
                  loopback="false"
                  recv_buf_size="20000000"
@@ -203,7 +207,9 @@
            configuration should be used instead of tcp when (1) synchronous calls are used and (2) the message volume
            (rate and size) is not that large">
         <config>
-            <TCP start_port="7650"
+            <TCP
+                 singleton_name="tcp_sync"
+                 start_port="7650"
                  tcp_nodelay="true"
                  loopback="false"
                  recv_buf_size="20000000"
@@ -271,6 +277,7 @@
            description="Stack optimized for the JBoss Messaging Control Channel">
        <config>
             <UDP
+                 singleton_name="jbm-control"
                  mcast_addr="${jboss.messaging.controlchanneludpaddress,jboss.partition.udpGroup:228.7.7.7}"
                  mcast_port="${jboss.messaging.controlchanneludpport:45568}"
                  tos="8"
@@ -336,7 +343,8 @@
     <stack name="jbm-data"
            description="Stack optimized for the JBoss Messaging Data Channel">
         <config>
-            <TCP start_port="7900"
+            <TCP singleton_name="jbm-data"
+                 start_port="7900"
                  loopback="true"
                  recv_buf_size="20000000"
                  send_buf_size="640000"

Modified: trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/passexp-stacks.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/passexp-stacks.xml	2008-04-11 22:38:54 UTC (rev 72061)
+++ trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/passexp-stacks.xml	2008-04-12 01:43:10 UTC (rev 72062)
@@ -8,6 +8,7 @@
            description="Default: IP multicast based stack, with flow control and message bundling">
         <config>
           <UDP
+             singleton_name="passexp-udp"
              mcast_port="${jgroups.udp.mcast_port:34688}"
              mcast_addr="${jgroups.udp.mcast_addr:228.11.11.11}"
              tos="8"
@@ -68,7 +69,9 @@
            description="TCP based stack, with flow control and message bundling. This is usually used when IP
            multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast)">
         <config>
-            <TCP start_port="37600"
+            <TCP
+                 singleton_name="passexp-tcp"
+                 start_port="37600"
                  tcp_nodelay="true"
                  loopback="false"
                  recv_buf_size="20000000"

Modified: trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-beans.xml	2008-04-11 22:38:54 UTC (rev 72061)
+++ trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-beans.xml	2008-04-12 01:43:10 UTC (rev 72062)
@@ -302,10 +302,6 @@
         <property name="exposeManagementStatistics">true</property>
 
     </bean>
-   
-   <bean name="ElectionPolicyTestCacheFactory" class ="org.jboss.cache.DefaultCacheFactory">
-      <constructor factoryClass="org.jboss.cache.DefaultCacheFactory" factoryMethod="getInstance"/>
-   </bean>
     
    <bean name="ElectionPolicyTestCache" class="org.jboss.cache.jmx.CacheJmxWrapper">
       

Modified: trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2008-04-11 22:38:54 UTC (rev 72061)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2008-04-12 01:43:10 UTC (rev 72062)
@@ -22,11 +22,11 @@
         <property name="runtimeConfig">
            <bean name="HAPartitionStateTransferTestCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
               <property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="TransactionManager"/></property>
-              <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
-           </bean>
-        </property>
-        
-        <property name="multiplexerStack">${jboss.multiplexer.stack:udp}</property>
+              <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
+           </bean>
+        </property>
+        
+        <property name="multiplexerStack">passexp-${jboss.multiplexer.stack:udp}</property>
 
         <!-- Valid isolation levels are 
                               SERIALIZABLE




More information about the jboss-cvs-commits mailing list