[jboss-cvs] JBoss Messaging SVN: r7671 - in branches: Branch_Strict_Ordering and 22 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 6 04:58:37 EDT 2009


Author: ataylor
Date: 2009-08-06 04:58:34 -0400 (Thu, 06 Aug 2009)
New Revision: 7671

Added:
   branches/Branch_Strict_Ordering/
   branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/BindingsFactory.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/Arbitrator.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/ProposalHandler.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/ArbitratorConfiguration.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/GroupProposalHandler.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/LocalArbitrator.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Proposal.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/RemoteArbitrator.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Response.java
   branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredGroupingTest.java
Removed:
   branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml
Modified:
   branches/Branch_Strict_Ordering/examples/core/messaging-core-examples.iml
   branches/Branch_Strict_Ordering/examples/jms/messaging-jms-examples.iml
   branches/Branch_Strict_Ordering/messaging.ipr
   branches/Branch_Strict_Ordering/src/config/common/schema/jbm-configuration.xsd
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/Configuration.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/Validators.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/NotificationType.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
   branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
   branches/Branch_Strict_Ordering/tests/jms-tests/messaging-jms-tests.iml
   branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java
   branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java
   branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakePostOffice.java
Log:


Copied: branches/Branch_Strict_Ordering (from rev 7531, trunk)

Deleted: branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml
===================================================================
--- trunk/docs/user-manual/en/logging.xml	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml	2009-08-06 08:58:34 UTC (rev 7671)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="logging">
-    <title>Logging</title>
-    <para>JBM uses standard <ulink url="http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/">JDK
-            logging</ulink>, (a.k.a Java-Util-Logging: JUL), for all its logging. This means we have
-        no dependencies on any third party logging framework. Users can provide their own logging
-        handler to use or alternatively use the log4j handler supplied by JBoss Messaging.</para>
-    <para>The handlers are configured via the JUL <literal>logging.properties</literal> file. This
-        default location for this file is under the <literal>lib</literal> directory found in the
-        Java home directory but it can be overridden by setting the <literal
-            >java.util.logging.config.file</literal> system property to point to the appropriate
-        logging.properties file. The standalone JBM server does this and the <literal
-            >logging.properties</literal> file can be found under the <literal>config</literal>
-        directory of the JBM installation. </para>
-    <para>By default the standalone server is configured to use the standard console handler and a
-        file handler that logs to <literal>bin/logs/messaging.log</literal>.</para>
-    <para>Because some of the third party components used to bootstrap JBoss Messaging, i.e. the
-        Microcontainer, use the JBoss Logging framework we have supplied a plugin class that
-        redirects this to the JUL logger. This is set via a system property, <literal
-            >-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin</literal>.
-        This is only needed when starting the standalone server and is set in the run script. This
-        is not a problem if you are embedding JBoss Messaging in your own code as the Microcontainer
-        won't be being used.</para>
-    <section>
-        <title>Log4j Configuration</title>
-        <para>JBoss Messaging supplies a JUL Log4j handler that can be used instead of the defaults.
-            To use this simply edit the logging.properties file as such:</para>
-        <programlisting>handlers=org.jboss.messaging.integration.logging.Log4jLoggerHandler</programlisting>
-        <para>You will also need to download the Log4j jars and place them in the <literal
-                >lib</literal> directory and also provide a log4j configuration and place it on the
-            appropriate config directory, i.e. <literal>config/common</literal>.</para>
-    </section>
-    <section>
-        <title>Logging With The JBoss Application Server</title>
-        <para>When JBoss Messaging is deployed within the Application Server then it will still use
-            JUL  however the logging is redirected to the default JBoss logger. For more information
-            on this refer to the JBoss documentation.</para>
-    </section>
-</chapter>

Copied: branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml (from rev 7540, trunk/docs/user-manual/en/logging.xml)
===================================================================
--- branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml	                        (rev 0)
+++ branches/Branch_Strict_Ordering/docs/user-manual/en/logging.xml	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="logging">
+    <title>Logging</title>
+    <para>JBM uses standard <ulink url="http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/">JDK
+            logging</ulink>, (a.k.a Java-Util-Logging: JUL), for all its logging. This means we have
+        no dependencies on any third party logging framework. Users can provide their own logging
+        handler to use or alternatively use the log4j handler supplied by JBoss Messaging.</para>
+    <para>The handlers are configured via the JUL <literal>logging.properties</literal> file. This
+        default location for this file is under the <literal>lib</literal> directory found in the
+        Java home directory but it can be overridden by setting the <literal
+            >java.util.logging.config.file</literal> system property to point to the appropriate
+        logging.properties file. The standalone JBM server does this and the <literal
+            >logging.properties</literal> file can be found under the <literal>config</literal>
+        directory of the JBM installation. </para>
+    <para>By default the standalone server is configured to use the standard console handler and a
+        file handler that logs to <literal>bin/logs/messaging.log</literal>.</para>
+    <para>Because some of the third party components used to bootstrap JBoss Messaging, i.e. the
+        Microcontainer, use the JBoss Logging framework we have supplied a plugin class that
+        redirects this to the JUL logger. This is set via a system property, <literal
+            >-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin</literal>.
+        This is only needed when starting the standalone server and is set in the run script. This
+        is not a problem if you are embedding JBoss Messaging in your own code as the Microcontainer
+        won't be being used.</para>
+   <para>If you want configure your client's logging, make sure you provide a <literal>logging.properties</literal>
+   file and set the <literal>java.util.logging.config.file</literal> property on client startup</para>
+    <section>
+        <title>Log4j Configuration</title>
+        <para>JBoss Messaging supplies a JUL Log4j handler that can be used instead of the defaults.
+            To use this simply edit the logging.properties file as such:</para>
+        <programlisting>handlers=org.jboss.messaging.integration.logging.Log4jLoggerHandler</programlisting>
+        <para>You will also need to download the Log4j jars and place them in the <literal
+                >lib</literal> directory and also provide a log4j configuration and place it on the
+            appropriate config directory, i.e. <literal>config/common</literal>.</para>
+    </section>
+    <section>
+        <title>Logging With The JBoss Application Server</title>
+        <para>When JBoss Messaging is deployed within the Application Server then it will still use
+            JUL  however the logging is redirected to the default JBoss logger. For more information
+            on this refer to the JBoss documentation.</para>
+    </section>
+</chapter>

Modified: branches/Branch_Strict_Ordering/examples/core/messaging-core-examples.iml
===================================================================
--- trunk/examples/core/messaging-core-examples.iml	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/examples/core/messaging-core-examples.iml	2009-08-06 08:58:34 UTC (rev 7671)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module relativePaths="true" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$APPLICATION_HOME_DIR$/bin/tests/messaging-core-tests/output/classes" />
+    <output-test url="file://$APPLICATION_HOME_DIR$/bin/tests/messaging-core-tests/output" />
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/embedded/src" isTestSource="false" />

Modified: branches/Branch_Strict_Ordering/examples/jms/messaging-jms-examples.iml
===================================================================
--- trunk/examples/jms/messaging-jms-examples.iml	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/examples/jms/messaging-jms-examples.iml	2009-08-06 08:58:34 UTC (rev 7671)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module relativePaths="true" type="JAVA_MODULE" version="4">
   <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/output/classes" />
-    <output-test url="file://$MODULE_DIR$/output" />
+    <output url="file://$APPLICATION_HOME_DIR$/bin/jms/output/classes" />
+    <output-test url="file://$APPLICATION_HOME_DIR$/bin/jms/output" />
     <exclude-output />
     <content url="file://$MODULE_DIR$/../common">
       <sourceFolder url="file://$MODULE_DIR$/../common/src" isTestSource="false" />
@@ -15,6 +15,7 @@
       <sourceFolder url="file://$MODULE_DIR$/client-kickoff/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/client-side-load-balancing/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/clustered-durable-subscription/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/clustered-grouping/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/clustered-queue/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/clustered-topic/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/common/src" isTestSource="false" />

Modified: branches/Branch_Strict_Ordering/messaging.ipr
===================================================================
--- trunk/messaging.ipr	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/messaging.ipr	2009-08-06 08:58:34 UTC (rev 7671)
@@ -567,7 +567,6 @@
   </component>
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file:///home/andy/projects/maven-buildmagic-thirdparty-plugin-2.1.2/maven-buildmagic-thirdparty-plugin-2.1.2.iml" filepath="/home/andy/projects/maven-buildmagic-thirdparty-plugin-2.1.2/maven-buildmagic-thirdparty-plugin-2.1.2.iml" />
       <module fileurl="file://$PROJECT_DIR$/messaging.iml" filepath="$PROJECT_DIR$/messaging.iml" />
       <module fileurl="file://$PROJECT_DIR$/examples/core/messaging-core-examples.iml" filepath="$PROJECT_DIR$/examples/core/messaging-core-examples.iml" />
       <module fileurl="file://$PROJECT_DIR$/examples/javaee/messaging-javaee-examples.iml" filepath="$PROJECT_DIR$/examples/javaee/messaging-javaee-examples.iml" />
@@ -618,7 +617,6 @@
   <component name="VcsDirectoryMappings">
     <mapping directory="" vcs="" />
     <mapping directory="$PROJECT_DIR$" vcs="svn" />
-    <mapping directory="/home/andy/projects/maven-buildmagic-thirdparty-plugin-2.1.2" vcs="svn" />
   </component>
   <component name="WebServicesPlugin" addRequiredLibraries="true" />
   <component name="com.intellij.jsf.UserDefinedFacesConfigs">

Modified: branches/Branch_Strict_Ordering/src/config/common/schema/jbm-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/jbm-configuration.xsd	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/config/common/schema/jbm-configuration.xsd	2009-08-06 08:58:34 UTC (rev 7671)
@@ -1,452 +1,474 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema xmlns="urn:jboss:messaging" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:jboss:messaging" version="1.0">
+<xsd:schema xmlns="urn:jboss:messaging" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified"
+            elementFormDefault="qualified" targetNamespace="urn:jboss:messaging" version="1.0">
 
-	<xsd:element name="configuration">
-		<xsd:complexType>
-			<xsd:all>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="clustered"/>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="file-deployment-enabled"/>	
-				<xsd:element maxOccurs="1" minOccurs="0" ref="persistence-enabled"/>	
-				<xsd:element maxOccurs="1" minOccurs="0" name="scheduled-thread-pool-max-size" type="xsd:int">
-					<xsd:annotation>
-						<xsd:documentation>
-							Maximum number of threads to use for the scheduled thread pool
-						</xsd:documentation>
-					</xsd:annotation>
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="thread-pool-max-size" type="xsd:int">
-					<xsd:annotation>
-						<xsd:documentation>
-							Maximum number of threads to use for the thread pool
-						</xsd:documentation>
-					</xsd:annotation>
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="security-enabled" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="security-invalidation-interval" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="wild-card-routing-enabled" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="management-address" type="xsd:string">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="management-notification-address" type="xsd:string">
-				</xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-user" type="xsd:string">
-                </xsd:element>				
-                <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-password" type="xsd:string">
-                </xsd:element>				
-                <xsd:element maxOccurs="1" minOccurs="0" name="management-request-timeout" type="xsd:long">
-                </xsd:element>              
-				<xsd:element maxOccurs="1" minOccurs="0" name="jmx-management-enabled" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="message-counter-enabled" type="xsd:boolean">
-				</xsd:element>
+   <xsd:element name="configuration">
+      <xsd:complexType>
+         <xsd:all>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="clustered"/>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="file-deployment-enabled"/>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="persistence-enabled"/>
+            <xsd:element maxOccurs="1" minOccurs="0" name="scheduled-thread-pool-max-size" type="xsd:int">
+               <xsd:annotation>
+                  <xsd:documentation>
+                     Maximum number of threads to use for the scheduled thread pool
+                  </xsd:documentation>
+               </xsd:annotation>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="thread-pool-max-size" type="xsd:int">
+               <xsd:annotation>
+                  <xsd:documentation>
+                     Maximum number of threads to use for the thread pool
+                  </xsd:documentation>
+               </xsd:annotation>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="security-enabled" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="security-invalidation-interval" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="wild-card-routing-enabled" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="management-address" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="management-notification-address" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-user" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-password" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="management-request-timeout" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="jmx-management-enabled" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="message-counter-enabled" type="xsd:boolean">
+            </xsd:element>
             <xsd:element maxOccurs="1" minOccurs="0" name="message-counter-sample-period" type="xsd:long">
             </xsd:element>
             <xsd:element maxOccurs="1" minOccurs="0" name="message-counter-max-day-history" type="xsd:int">
             </xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="connection-ttl-override" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="transaction-timeout" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="transaction-timeout-scan-period" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="message-expiry-scan-period" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="message-expiry-thread-priority" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="id-cache-size" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="persist-id-cache" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="remoting-interceptors">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="queue-activation-timeout" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="backup" type="xsd:boolean">
-				</xsd:element>				
-				<xsd:element maxOccurs="1" minOccurs="0" name="persist-delivery-count-before-delivery" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="backup-connector-ref" type="backup-connectorType">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="connectors">
-                    <xsd:complexType>
-                        <xsd:sequence>
-                            <xsd:element maxOccurs="unbounded" minOccurs="0" name="connector" type="connectorType"/>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="acceptors">
-                    <xsd:complexType>
-                        <xsd:sequence>
-	               			<xsd:element maxOccurs="unbounded" minOccurs="1" name="acceptor" type="acceptorType">
-				            </xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="broadcast-groups">
-                    <xsd:complexType>
-                        <xsd:sequence>
-            				<xsd:element maxOccurs="unbounded" minOccurs="0" ref="broadcast-group">
-				            </xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="discovery-groups">
-                    <xsd:complexType>
-                        <xsd:sequence>
-            				<xsd:element maxOccurs="unbounded" minOccurs="0" ref="discovery-group">
-				            </xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="diverts">
-                    <xsd:complexType>
-                        <xsd:sequence>
-            				<xsd:element maxOccurs="unbounded" minOccurs="0" name="divert" type="divertType">
-	               			</xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="queues">
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="bridges">
-                    <xsd:complexType>
-                        <xsd:sequence>
-            				<xsd:element maxOccurs="unbounded" minOccurs="0" name="bridge" type="bridgeType">
-    				        </xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="cluster-connections">
-                    <xsd:complexType>
-                        <xsd:sequence>
-            				<xsd:element maxOccurs="unbounded" minOccurs="0" name="cluster-connection" type="clusterConnectionType">
-				        </xsd:element>
-                        </xsd:sequence>
-                    </xsd:complexType>
-                </xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="paging-directory" type="xsd:string">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="global-page-size" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="paging-max-global-size-bytes" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="bindings-directory" type="xsd:string">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="create-bindings-dir" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-directory" type="xsd:string">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="create-journal-dir" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-type" type="journalType">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-buffer-timeout" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-buffer-size" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-flush-on-sync" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-sync-transactional" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-sync-non-transactional" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="log-journal-write-rate" type="xsd:boolean">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-file-size" type="xsd:long">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-min-files" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-compact-percentage" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-compact-min-files" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="journal-max-aio" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="perf-blast-pages" type="xsd:int">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" name="large-messages-directory" type="xsd:string">
-				</xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="security-settings">
-                </xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="address-settings">
-                </xsd:element>
-			</xsd:all>
-		</xsd:complexType>
-	</xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="connection-ttl-override" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="transaction-timeout" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="transaction-timeout-scan-period" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="message-expiry-scan-period" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="message-expiry-thread-priority" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="id-cache-size" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="persist-id-cache" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="remoting-interceptors">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="queue-activation-timeout" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="backup" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="persist-delivery-count-before-delivery" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="backup-connector-ref" type="backup-connectorType">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="connectors">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" name="connector" type="connectorType"/>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="acceptors">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="1" name="acceptor" type="acceptorType">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="broadcast-groups">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" ref="broadcast-group">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="discovery-groups">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" ref="discovery-group">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="diverts">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" name="divert" type="divertType">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="queues">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="bridges">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" name="bridge" type="bridgeType">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="cluster-connections">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" name="cluster-connection"
+                                  type="clusterConnectionType">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="arbitrators">
+               <xsd:complexType>
+                  <xsd:sequence>
+                     <xsd:element maxOccurs="unbounded" minOccurs="0" name="arbitrator"
+                                  type="arbitratorType">
+                     </xsd:element>
+                  </xsd:sequence>
+               </xsd:complexType>
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="paging-directory" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="global-page-size" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="paging-max-global-size-bytes" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="bindings-directory" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="create-bindings-dir" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-directory" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="create-journal-dir" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-type" type="journalType">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-buffer-timeout" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-buffer-size" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-aio-flush-on-sync" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-sync-transactional" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-sync-non-transactional" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="log-journal-write-rate" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-file-size" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-min-files" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="journal-max-aio" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="perf-blast-pages" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="large-messages-directory" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="security-settings">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="address-settings">
+            </xsd:element>
+         </xsd:all>
+      </xsd:complexType>
+   </xsd:element>
 
-	<xsd:element name="clustered" type="xsd:boolean"/>
-	
-	<xsd:element name="file-deployment-enabled" type="xsd:boolean"/>
-	
-	<xsd:element name="persistence-enabled" type="xsd:boolean"/>
+   <xsd:element name="clustered" type="xsd:boolean"/>
 
-	<xsd:element name="local-bind-address" type="xsd:string"/>
+   <xsd:element name="file-deployment-enabled" type="xsd:boolean"/>
 
-	<xsd:element name="local-bind-port" type="xsd:int"/>
+   <xsd:element name="persistence-enabled" type="xsd:boolean"/>
 
-	<xsd:element name="group-address" type="xsd:string"/>
+   <xsd:element name="local-bind-address" type="xsd:string"/>
 
-	<xsd:element name="group-port" type="xsd:int"/>
+   <xsd:element name="local-bind-port" type="xsd:int"/>
 
-	<xsd:element name="broadcast-period" type="xsd:long"/>
+   <xsd:element name="group-address" type="xsd:string"/>
 
-	<xsd:element name="connector-ref" type="connector-refType">
-	</xsd:element>
+   <xsd:element name="group-port" type="xsd:int"/>
 
-	<xsd:element name="broadcast-group">
-		<xsd:complexType>
-			<xsd:sequence>
-                <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-address">
-                </xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-port">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="broadcast-period">
-				</xsd:element>
-				<xsd:element maxOccurs="unbounded" minOccurs="0" ref="connector-ref">
-				</xsd:element>
-			</xsd:sequence>
-			<xsd:attribute name="name" type="xsd:ID" use="required"/>
-		</xsd:complexType>
-	</xsd:element>
+   <xsd:element name="broadcast-period" type="xsd:long"/>
 
-	<xsd:element name="refresh-timeout" type="xsd:int"/>
+   <xsd:element name="connector-ref" type="connector-refType">
+   </xsd:element>
 
-	<xsd:element name="discovery-group">
-		<xsd:complexType>
-			<xsd:sequence>
-				<xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="0" ref="refresh-timeout">
-				</xsd:element>
-			</xsd:sequence>
-			<xsd:attribute name="name" type="xsd:ID" use="required"/>
-		</xsd:complexType>
-	</xsd:element>
+   <xsd:element name="broadcast-group">
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-address">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-port">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="broadcast-period">
+            </xsd:element>
+            <xsd:element maxOccurs="unbounded" minOccurs="0" ref="connector-ref">
+            </xsd:element>
+         </xsd:sequence>
+         <xsd:attribute name="name" type="xsd:ID" use="required"/>
+      </xsd:complexType>
+   </xsd:element>
 
-	<xsd:element name="discovery-group-ref">
-		<xsd:complexType>
-			<xsd:attribute name="discovery-group-name" type="xsd:IDREF">
-			</xsd:attribute>
-		</xsd:complexType>
-	</xsd:element>
+   <xsd:element name="refresh-timeout" type="xsd:int"/>
 
-	<xsd:complexType name="connector-refType">
-		<xsd:attribute name="connector-name" type="xsd:IDREF" use="required">
-		</xsd:attribute>
-		<xsd:attribute name="backup-connector-name" type="xsd:IDREF" use="optional">
-		</xsd:attribute>
-	</xsd:complexType>
+   <xsd:element name="discovery-group">
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" ref="refresh-timeout">
+            </xsd:element>
+         </xsd:sequence>
+         <xsd:attribute name="name" type="xsd:ID" use="required"/>
+      </xsd:complexType>
+   </xsd:element>
 
-	<xsd:element name="remoting-interceptors">
-		<xsd:complexType>
-			<xsd:sequence>
-				<xsd:element maxOccurs="unbounded" minOccurs="1" name="class-name" type="xsd:string">
-				</xsd:element>
-			</xsd:sequence>
-		</xsd:complexType>
-	</xsd:element>
+   <xsd:element name="discovery-group-ref">
+      <xsd:complexType>
+         <xsd:attribute name="discovery-group-name" type="xsd:IDREF">
+         </xsd:attribute>
+      </xsd:complexType>
+   </xsd:element>
 
-	<xsd:complexType name="paramType">
-		<xsd:attribute name="key" type="xsd:string" use="required"/>
-		<xsd:attribute name="value" type="xsd:string" use="required"/>
-		<xsd:attribute name="type" use="required">
-			<xsd:simpleType>
-				<xsd:restriction base="xsd:string">
-					<xsd:enumeration value="String"/>
-					<xsd:enumeration value="Integer"/>
-					<xsd:enumeration value="Long"/>
-					<xsd:enumeration value="Boolean"/>
-					<xsd:enumeration value="Float"/>
-					<xsd:enumeration value="Double"/>
-				</xsd:restriction>
-			</xsd:simpleType>
-		</xsd:attribute>
-	</xsd:complexType>
+   <xsd:complexType name="connector-refType">
+      <xsd:attribute name="connector-name" type="xsd:IDREF" use="required">
+      </xsd:attribute>
+      <xsd:attribute name="backup-connector-name" type="xsd:IDREF" use="optional">
+      </xsd:attribute>
+   </xsd:complexType>
 
-	<xsd:complexType name="connectorType">
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="1" name="factory-class" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
-			</xsd:element>
-		</xsd:sequence>
-		<xsd:attribute name="name" type="xsd:ID" use="required"/>
-	</xsd:complexType>
+   <xsd:element name="remoting-interceptors">
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element maxOccurs="unbounded" minOccurs="1" name="class-name" type="xsd:string">
+            </xsd:element>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
 
-	<xsd:complexType name="acceptorType">
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="1" name="factory-class" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
-			</xsd:element>
-		</xsd:sequence>
-		<xsd:attribute name="name" type="xsd:string" use="optional"/>
-	</xsd:complexType>
+   <xsd:complexType name="paramType">
+      <xsd:attribute name="key" type="xsd:string" use="required"/>
+      <xsd:attribute name="value" type="xsd:string" use="required"/>
+      <xsd:attribute name="type" use="required">
+         <xsd:simpleType>
+            <xsd:restriction base="xsd:string">
+               <xsd:enumeration value="String"/>
+               <xsd:enumeration value="Integer"/>
+               <xsd:enumeration value="Long"/>
+               <xsd:enumeration value="Boolean"/>
+               <xsd:enumeration value="Float"/>
+               <xsd:enumeration value="Double"/>
+            </xsd:restriction>
+         </xsd:simpleType>
+      </xsd:attribute>
+   </xsd:complexType>
 
-	<xsd:complexType name="bridgeType">	   
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="1" name="queue-name" type="xsd:IDREF">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="1" name="forwarding-address" type="xsd:string">
-			</xsd:element>
-            <xsd:element maxOccurs="1" minOccurs="0" name="filter">
-                <xsd:complexType>
-                   <xsd:attribute name="string" type="xsd:string" use="required"/>
-                </xsd:complexType>
+   <xsd:complexType name="connectorType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="1" name="factory-class" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="name" type="xsd:ID" use="required"/>
+   </xsd:complexType>
+
+   <xsd:complexType name="acceptorType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="1" name="factory-class" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="name" type="xsd:string" use="optional"/>
+   </xsd:complexType>
+
+   <xsd:complexType name="bridgeType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="1" name="queue-name" type="xsd:IDREF">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="1" name="forwarding-address" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="filter">
+            <xsd:complexType>
+               <xsd:attribute name="string" type="xsd:string" use="required"/>
+            </xsd:complexType>
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="transformer-class-name" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="retry-interval" type="xsd:long">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="retry-interval-multiplier" type="xsd:double">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="reconnect-attempts" type="xsd:int">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="failover-on-server-shutdown" type="xsd:boolean">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="use-duplicate-detection" type="xsd:boolean">
+         </xsd:element>
+         <xsd:choice>
+            <xsd:element maxOccurs="1" minOccurs="1" name="connector-ref" type="connector-refType">
             </xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="transformer-class-name" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="retry-interval" type="xsd:long">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="retry-interval-multiplier" type="xsd:double">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="reconnect-attempts" type="xsd:int">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="failover-on-server-shutdown" type="xsd:boolean">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="use-duplicate-detection" type="xsd:boolean">
-			</xsd:element>
-			<xsd:choice>
-				<xsd:element maxOccurs="1" minOccurs="1" name="connector-ref" type="connector-refType">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
-					<xsd:complexType>
-						<xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
-						</xsd:attribute>
-					</xsd:complexType>
-				</xsd:element>
-			</xsd:choice>
-		</xsd:sequence>	
-		<xsd:attribute name="name" type="xsd:string" use="required"/>	
-	</xsd:complexType>
-	
-   <xsd:complexType name="clusterConnectionType">      
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="retry-interval" type="xsd:long">
-			</xsd:element>			
-			<xsd:element maxOccurs="1" minOccurs="0" name="use-duplicate-detection" type="xsd:boolean">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="forward-when-no-consumers" type="xsd:boolean">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="max-hops" type="xsd:int">
-			</xsd:element>
-			
-			<xsd:choice>
-				<xsd:element maxOccurs="unbounded" minOccurs="1" name="connector-ref" type="connector-refType">
-				</xsd:element>
-				<xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
-					<xsd:complexType>
-						<xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
-						</xsd:attribute>
-					</xsd:complexType>
-				</xsd:element>
-			</xsd:choice>
-		</xsd:sequence>
-		<xsd:attribute name="name" type="xsd:string" use="required"/>
-	</xsd:complexType>
+            <xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
+               <xsd:complexType>
+                  <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
+                  </xsd:attribute>
+               </xsd:complexType>
+            </xsd:element>
+         </xsd:choice>
+      </xsd:sequence>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+   </xsd:complexType>
 
-	<xsd:complexType name="divertType">	   
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="0" name="routing-name" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="1" name="forwarding-address" type="xsd:string">
-			</xsd:element>
-            <xsd:element maxOccurs="1" minOccurs="0" name="filter">
-                <xsd:complexType>
-                   <xsd:attribute name="string" type="xsd:string" use="required"/>
-                </xsd:complexType>
+   <xsd:complexType name="clusterConnectionType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="retry-interval" type="xsd:long">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="use-duplicate-detection" type="xsd:boolean">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="forward-when-no-consumers" type="xsd:boolean">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="max-hops" type="xsd:int">
+         </xsd:element>
+
+         <xsd:choice>
+            <xsd:element maxOccurs="unbounded" minOccurs="1" name="connector-ref" type="connector-refType">
             </xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="transformer-class-name" type="xsd:string">
-			</xsd:element>
-			<xsd:element maxOccurs="1" minOccurs="0" name="exclusive" type="xsd:boolean">
-			</xsd:element>
-		</xsd:sequence>	
-		<xsd:attribute name="name" type="xsd:string" use="required"/>	
-	</xsd:complexType>
+            <xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
+               <xsd:complexType>
+                  <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
+                  </xsd:attribute>
+               </xsd:complexType>
+            </xsd:element>
+         </xsd:choice>
+      </xsd:sequence>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+   </xsd:complexType>
 
-	<xsd:simpleType name="journalType">
-		<xsd:restriction base="xsd:string">
-			<xsd:enumeration value="ASYNCIO"/>
-			<xsd:enumeration value="NIO"/>
-		</xsd:restriction>
-	</xsd:simpleType>
+   <xsd:complexType name="arbitratorType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="1" name="type" type="arbitratorTypeType"/>
+         <xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string"/>
+      </xsd:sequence>
+       <xsd:attribute name="name" type="xsd:string" use="required"/>
+   </xsd:complexType>
 
-  <xsd:element name="security-settings">
+   <xsd:simpleType name="arbitratorTypeType">
+      <xsd:restriction base="xsd:string">
+         <xsd:enumeration value="LOCAL"/>
+         <xsd:enumeration value="REMOTE"/>
+      </xsd:restriction>
+   </xsd:simpleType>
+
+   <xsd:complexType name="divertType">
+      <xsd:sequence>
+         <xsd:element maxOccurs="1" minOccurs="0" name="routing-name" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="1" name="forwarding-address" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="filter">
+            <xsd:complexType>
+               <xsd:attribute name="string" type="xsd:string" use="required"/>
+            </xsd:complexType>
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="transformer-class-name" type="xsd:string">
+         </xsd:element>
+         <xsd:element maxOccurs="1" minOccurs="0" name="exclusive" type="xsd:boolean">
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+   </xsd:complexType>
+
+   <xsd:simpleType name="journalType">
+      <xsd:restriction base="xsd:string">
+         <xsd:enumeration value="ASYNCIO"/>
+         <xsd:enumeration value="NIO"/>
+      </xsd:restriction>
+   </xsd:simpleType>
+
+   <xsd:element name="security-settings">
       <xsd:complexType>
          <xsd:sequence>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="security-setting">
             </xsd:element>
-          </xsd:sequence>
-       </xsd:complexType>
-    </xsd:element>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
 
    <xsd:element name="security-setting">
-    <xsd:complexType>
-        <xsd:sequence>
-           <xsd:element maxOccurs="unbounded" minOccurs="0" name="permission">
-              <xsd:complexType>
-                 <xsd:attribute name="type" type="xsd:string" use="required"/>
-                 <xsd:attribute name="roles" type="xsd:string" use="required"/>
-              </xsd:complexType>
-           </xsd:element>
-        </xsd:sequence>
-            <xsd:attribute name="match" type="xsd:string" use="required"/>
-        </xsd:complexType>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element maxOccurs="unbounded" minOccurs="0" name="permission">
+               <xsd:complexType>
+                  <xsd:attribute name="type" type="xsd:string" use="required"/>
+                  <xsd:attribute name="roles" type="xsd:string" use="required"/>
+               </xsd:complexType>
+            </xsd:element>
+         </xsd:sequence>
+         <xsd:attribute name="match" type="xsd:string" use="required"/>
+      </xsd:complexType>
    </xsd:element>
 
-  <xsd:element name="address-settings">
+   <xsd:element name="address-settings">
       <xsd:complexType>
          <xsd:sequence>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="address-setting">
             </xsd:element>
-          </xsd:sequence>
-       </xsd:complexType>
-    </xsd:element>
-    
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+
    <xsd:element name="address-setting">
-    <xsd:complexType>
-      <xsd:all>
-        <xsd:element maxOccurs="1" minOccurs="0" name="clustered" type="xsd:boolean">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="dead-letter-address" type="xsd:string">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="expiry-address" type="xsd:string">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="redelivery-delay" type="xsd:long">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="max-delivery-attempts" type="xsd:int">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="max-size-bytes" type="xsd:long">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="page-size-bytes" type="xsd:int">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="drop-messages-when-full" type="xsd:boolean">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="distribution-policy-class" type="xsd:string">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="message-counter-history-day-limit" type="xsd:int">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="last-value-queue" type="xsd:boolean">
-        </xsd:element>
-        <xsd:element maxOccurs="1" minOccurs="0" name="redistribution-delay" type="xsd:long">
-        </xsd:element>
-      </xsd:all>
-    <xsd:attribute name="match" type="xsd:string" use="required"/>
-   </xsd:complexType> 
+      <xsd:complexType>
+         <xsd:all>
+            <xsd:element maxOccurs="1" minOccurs="0" name="clustered" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="dead-letter-address" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="expiry-address" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="redelivery-delay" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="max-delivery-attempts" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="max-size-bytes" type="xsd:long">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="page-size-bytes" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="drop-messages-when-full" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="distribution-policy-class" type="xsd:string">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="message-counter-history-day-limit" type="xsd:int">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="last-value-queue" type="xsd:boolean">
+            </xsd:element>
+            <xsd:element maxOccurs="1" minOccurs="0" name="redistribution-delay" type="xsd:long">
+            </xsd:element>
+         </xsd:all>
+         <xsd:attribute name="match" type="xsd:string" use="required"/>
+      </xsd:complexType>
    </xsd:element>
-     
+
    <xsd:element name="queues">
       <xsd:complexType>
          <xsd:sequence>
@@ -455,26 +477,26 @@
          </xsd:sequence>
       </xsd:complexType>
    </xsd:element>
-   
+
    <xsd:element name="queue">
       <xsd:complexType>
-        <xsd:all>
+         <xsd:all>
             <xsd:element maxOccurs="1" minOccurs="1" name="address" type="xsd:string">
             </xsd:element>
             <xsd:element maxOccurs="1" minOccurs="0" name="filter">
-                <xsd:complexType>
-                   <xsd:attribute name="string" type="xsd:string" use="required"/>
-                </xsd:complexType>
+               <xsd:complexType>
+                  <xsd:attribute name="string" type="xsd:string" use="required"/>
+               </xsd:complexType>
             </xsd:element>
             <xsd:element maxOccurs="1" minOccurs="0" name="durable" type="xsd:boolean">
             </xsd:element>
-        </xsd:all>
-        <xsd:attribute name="name" type="xsd:ID" use="required"/>
-       </xsd:complexType>
-    </xsd:element>
-    
-	<xsd:complexType name="backup-connectorType">
-		<xsd:attribute name="connector-name" type="xsd:IDREF" use="required">
-		</xsd:attribute>
-	</xsd:complexType>
+         </xsd:all>
+         <xsd:attribute name="name" type="xsd:ID" use="required"/>
+      </xsd:complexType>
+   </xsd:element>
+
+   <xsd:complexType name="backup-connectorType">
+      <xsd:attribute name="connector-name" type="xsd:IDREF" use="required">
+      </xsd:attribute>
+   </xsd:complexType>
 </xsd:schema>

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -880,7 +880,6 @@
                DelegatingBufferHandler handler = new DelegatingBufferHandler();
 
                connector = connectorFactory.createConnector(transportParams, handler, this, threadPool);
-
                if (connector != null)
                {
                   connector.start();
@@ -890,7 +889,6 @@
             if (connector != null)
             {
                tc = connector.createConnection();
-
                if (tc == null)
                {
                   try

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -78,6 +78,11 @@
 
    public static final SimpleString HDR_CHECK_TYPE = new SimpleString("_JBM_CheckType");
 
+   public static final SimpleString HDR_PROPOSAL_TYPE = new SimpleString("_JBM_ProposalType");
+
+   public static final SimpleString HDR_PROPOSAL_VALUE = new SimpleString("_JBM_ProposalValue");
+
+   public static final SimpleString HDR_PROPOSAL_ALT_VALUE = new SimpleString("_JBM_ProposalAltValue");
    // Attributes ----------------------------------------------------
 
    // Static --------------------------------------------------------

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/Configuration.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -35,6 +35,8 @@
 import org.jboss.messaging.core.config.cluster.QueueConfiguration;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.MessagingComponent;
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -128,6 +130,10 @@
 
    void setBridgeConfigurations(final List<BridgeConfiguration> configs);
 
+   List<ArbitratorConfiguration> getArbitratorConfigurations();
+
+   void setArbitratorConfigurations(List<ArbitratorConfiguration> arbitratorConfigurations);
+
    List<DivertConfiguration> getDivertConfigurations();
 
    void setDivertConfigurations(final List<DivertConfiguration> configs);

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -29,6 +29,8 @@
 import org.jboss.messaging.core.config.cluster.DivertConfiguration;
 import org.jboss.messaging.core.config.cluster.QueueConfiguration;
 import org.jboss.messaging.core.server.JournalType;
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -213,6 +215,8 @@
 
    protected Map<String, DiscoveryGroupConfiguration> discoveryGroupConfigurations = new LinkedHashMap<String, DiscoveryGroupConfiguration>();
 
+   protected List<ArbitratorConfiguration> arbitratorConfigurations = new ArrayList<ArbitratorConfiguration>();
+
    // Paging related attributes ------------------------------------------------------------
 
    protected long pagingMaxGlobalSize = DEFAULT_PAGE_MAX_GLOBAL_SIZE;
@@ -465,6 +469,16 @@
       bridgeConfigurations = configs;
    }
 
+   public List<ArbitratorConfiguration> getArbitratorConfigurations()
+   {
+      return arbitratorConfigurations;
+   }
+
+   public void setArbitratorConfigurations(List<ArbitratorConfiguration> arbitratorConfigurations)
+   {
+      this.arbitratorConfigurations = arbitratorConfigurations;
+   }
+
    public List<BroadcastGroupConfiguration> getBroadcastGroupConfigurations()
    {
       return broadcastGroupConfigurations;

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -55,6 +55,7 @@
 import org.jboss.messaging.core.config.cluster.DivertConfiguration;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.server.JournalType;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
 import org.jboss.messaging.utils.Pair;
 import org.jboss.messaging.utils.SimpleString;
 import org.jboss.messaging.utils.XMLUtil;
@@ -83,23 +84,23 @@
    private static final String CONFIGURATION_SCHEMA_URL = "schema/jbm-configuration.xsd";
 
    // Static --------------------------------------------------------------------------
-   
+
    // Attributes ----------------------------------------------------------------------
 
    private String configurationUrl = DEFAULT_CONFIGURATION_URL;
-   
 
+
    private boolean started;
-   
+
    // Public -------------------------------------------------------------------------
 
    public synchronized void start() throws Exception
-   {      
+   {
       if (started)
       {
          return;
       }
-       
+
       URL url = getClass().getClassLoader().getResource(configurationUrl);
       Reader reader = new InputStreamReader(url.openStream());
       String xml = org.jboss.messaging.utils.XMLUtil.readerToString(reader);
@@ -110,20 +111,20 @@
       clustered = getBoolean(e, "clustered", clustered);
 
       backup = getBoolean(e, "backup", backup);
-      
+
       //Defaults to true when using FileConfiguration
       fileDeploymentEnabled = getBoolean(e, "file-deployment-enabled", true);
-      
+
       persistenceEnabled = getBoolean(e, "persistence-enabled", persistenceEnabled);
 
       persistDeliveryCountBeforeDelivery = getBoolean(e, "persist-delivery-count-before-delivery", persistDeliveryCountBeforeDelivery);
-      
+
       queueActivationTimeout = getLong(e, "queue-activation-timeout", queueActivationTimeout, GE_ZERO);
 
       // NOTE! All the defaults come from the super class
 
       scheduledThreadPoolMaxSize = getInteger(e, "scheduled-thread-pool-max-size", scheduledThreadPoolMaxSize, GT_ZERO);
-      
+
       threadPoolMaxSize = getInteger(e, "thread-pool-max-size", threadPoolMaxSize, MINUS_ONE_OR_GT_ZERO);
 
       securityEnabled = getBoolean(e, "security-enabled", securityEnabled);
@@ -194,7 +195,7 @@
 
       for (int i = 0; i < connectorNodes.getLength(); i++)
       {
-         Element connectorNode = (Element)connectorNodes.item(i);
+         Element connectorNode = (Element) connectorNodes.item(i);
 
          TransportConfiguration connectorConfig = parseTransportConfiguration(connectorNode);
 
@@ -220,7 +221,7 @@
 
       for (int i = 0; i < acceptorNodes.getLength(); i++)
       {
-         Element acceptorNode = (Element)acceptorNodes.item(i);
+         Element acceptorNode = (Element) acceptorNodes.item(i);
 
          TransportConfiguration acceptorConfig = parseTransportConfiguration(acceptorNode);
 
@@ -231,7 +232,7 @@
 
       for (int i = 0; i < bgNodes.getLength(); i++)
       {
-         Element bgNode = (Element)bgNodes.item(i);
+         Element bgNode = (Element) bgNodes.item(i);
 
          parseBroadcastGroupConfiguration(bgNode);
       }
@@ -240,7 +241,7 @@
 
       for (int i = 0; i < dgNodes.getLength(); i++)
       {
-         Element dgNode = (Element)dgNodes.item(i);
+         Element dgNode = (Element) dgNodes.item(i);
 
          parseDiscoveryGroupConfiguration(dgNode);
       }
@@ -249,16 +250,25 @@
 
       for (int i = 0; i < brNodes.getLength(); i++)
       {
-         Element mfNode = (Element)brNodes.item(i);
+         Element mfNode = (Element) brNodes.item(i);
 
          parseBridgeConfiguration(mfNode);
       }
 
+      NodeList gaNodes = e.getElementsByTagName("arbitrator");
+
+      for (int i = 0; i < gaNodes.getLength(); i++)
+      {
+         Element gaNode = (Element) gaNodes.item(i);
+
+         parseArbitratorConfiguration(gaNode);
+      }
+
       NodeList ccNodes = e.getElementsByTagName("cluster-connection");
 
       for (int i = 0; i < ccNodes.getLength(); i++)
       {
-         Element ccNode = (Element)ccNodes.item(i);
+         Element ccNode = (Element) ccNodes.item(i);
 
          parseClusterConnectionConfiguration(ccNode);
       }
@@ -267,7 +277,7 @@
 
       for (int i = 0; i < dvNodes.getLength(); i++)
       {
-         Element dvNode = (Element)dvNodes.item(i);
+         Element dvNode = (Element) dvNodes.item(i);
 
          parseDivertConfiguration(dvNode);
       }
@@ -287,7 +297,7 @@
       pagingMaxGlobalSize = getLong(e, "paging-max-global-size-bytes", pagingMaxGlobalSize, MINUS_ONE_OR_GT_ZERO);
 
       globalPageSize = getInteger(e, "global-page-size", globalPageSize, GT_ZERO);
-      
+
       createJournalDir = getBoolean(e, "create-journal-dir", createJournalDir);
 
       String s = getString(e, "journal-type", journalType.toString(), Validators.JOURNAL_TYPE);
@@ -306,11 +316,11 @@
       journalSyncNonTransactional = getBoolean(e, "journal-sync-non-transactional", journalSyncNonTransactional);
 
       journalFileSize = getInteger(e, "journal-file-size", journalFileSize, GT_ZERO);
-      
+
       journalAIOFlushSync = getBoolean(e, "journal-aio-flush-on-sync", DEFAULT_JOURNAL_AIO_FLUSH_SYNC);
-      
+
       journalAIOBufferTimeout = getInteger(e, "journal-aio-buffer-timeout", DEFAULT_JOURNAL_AIO_BUFFER_TIMEOUT, GT_ZERO);
-      
+
       journalAIOBufferSize = getInteger(e, "journal-aio-buffer-size", DEFAULT_JOURNAL_AIO_BUFFER_SIZE, GT_ZERO);
 
       journalMinFiles = getInteger(e, "journal-min-files", journalMinFiles, GT_ZERO);
@@ -320,9 +330,9 @@
       journalCompactPercentage = getInteger(e, "journal-compact-percentage", journalCompactPercentage, PERCENTAGE);
 
       journalMaxAIO = getInteger(e, "journal-max-aio", journalMaxAIO, GT_ZERO);
-      
+
       logJournalWriteRate = getBoolean(e, "log-journal-write-rate", DEFAULT_JOURNAL_LOG_WRITE_RATE);
-      
+
       journalPerfBlastPages = getInteger(e, "perf-blast-pages", DEFAULT_JOURNAL_PERF_BLAST_PAGES, MINUS_ONE_OR_GT_ZERO);
 
       wildcardRoutingEnabled = getBoolean(e, "wild-card-routing-enabled", wildcardRoutingEnabled);
@@ -332,14 +342,14 @@
       messageCounterSamplePeriod = getLong(e, "message-counter-sample-period", messageCounterSamplePeriod, GT_ZERO);
 
       messageCounterMaxDayHistory = getInteger(e, "message-counter-max-day-history", messageCounterMaxDayHistory, GT_ZERO);
-      
+
       started = true;
    }
-   
+
    public synchronized void stop() throws Exception
    {
       super.stop();
-      
+
       started = false;
    }
 
@@ -370,7 +380,7 @@
       for (int i = 0; i < paramsNodes.getLength(); i++)
       {
          Node paramNode = paramsNodes.item(i);
-         NamedNodeMap attributes =paramNode.getAttributes();
+         NamedNodeMap attributes = paramNode.getAttributes();
 
          Node nkey = attributes.getNamedItem("key");
 
@@ -418,7 +428,7 @@
       String name = e.getAttribute("name");
 
       String localAddress = getString(e, "local-bind-address", null, NO_CHECK);
-      
+
       int localBindPort = getInteger(e, "local-bind-port", -1, MINUS_ONE_OR_GT_ZERO);
 
       String groupAddress = getString(e, "group-address", null, NOT_NULL_OR_EMPTY);
@@ -504,7 +514,7 @@
 
       int maxHops = getInteger(e, "max-hops", DEFAULT_CLUSTER_MAX_HOPS, GE_ZERO);
 
-      long retryInterval = getLong(e, "retry-interval", (long)DEFAULT_CLUSTER_RETRY_INTERVAL, GT_ZERO);
+      long retryInterval = getLong(e, "retry-interval", (long) DEFAULT_CLUSTER_RETRY_INTERVAL, GT_ZERO);
 
       String discoveryGroupName = null;
 
@@ -544,8 +554,8 @@
       if (discoveryGroupName == null)
       {
          config = new ClusterConnectionConfiguration(name,
-                                                     address,                                                   
-                                                     retryInterval,                                                     
+                                                     address,
+                                                     retryInterval,
                                                      duplicateDetection,
                                                      forwardWhenNoConsumers,
                                                      maxHops,
@@ -555,7 +565,7 @@
       {
          config = new ClusterConnectionConfiguration(name,
                                                      address,
-                                                     retryInterval,                                                     
+                                                     retryInterval,
                                                      duplicateDetection,
                                                      forwardWhenNoConsumers,
                                                      maxHops,
@@ -565,6 +575,18 @@
       clusterConfigurations.add(config);
    }
 
+   private void parseArbitratorConfiguration(final Element node)
+   {
+      String name = node.getAttribute("name");
+      String type = getString(node, "type", null, NOT_NULL_OR_EMPTY);
+      String address = getString(node, "address",null, NOT_NULL_OR_EMPTY);
+      ArbitratorConfiguration arbitratorConfiguration =
+            new ArbitratorConfiguration(new SimpleString(name),
+                                        type.equals(ArbitratorConfiguration.TYPE.LOCAL.getType())? ArbitratorConfiguration.TYPE.LOCAL: ArbitratorConfiguration.TYPE.REMOTE,
+                                        new SimpleString(address));
+      arbitratorConfigurations.add(arbitratorConfiguration);
+   }
+
    private void parseBridgeConfiguration(final Element brNode)
    {
       String name = brNode.getAttribute("name");
@@ -578,7 +600,7 @@
       long retryInterval = getLong(brNode, "retry-interval", DEFAULT_RETRY_INTERVAL, GT_ZERO);
 
       double retryIntervalMultiplier = getDouble(brNode, "retry-interval-multiplier", DEFAULT_RETRY_INTERVAL_MULTIPLIER, GT_ZERO);
-      
+
       int reconnectAttempts = getInteger(brNode, "reconnect-attempts", DEFAULT_BRIDGE_RECONNECT_ATTEMPTS, MINUS_ONE_OR_GE_ZERO);
 
       boolean failoverOnServerShutdown = getBoolean(brNode, "failover-on-server-shutdown", ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
@@ -586,7 +608,7 @@
       boolean useDuplicateDetection = getBoolean(brNode, "use-duplicate-detection", DEFAULT_BRIDGE_DUPLICATE_DETECTION);
 
       String filterString = null;
-      
+
       Pair<String, String> connectorPair = null;
 
       String discoveryGroupName = null;

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/Validators.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/Validators.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/config/impl/Validators.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -181,6 +181,18 @@
       }
    };
 
+   public static final Validator ARBITRATOR_TYPE = new Validator()
+   {
+      public void validate(String name, Object value)
+      {
+         String val = (String)value;
+         if (val == null || !val.equals(JournalType.NIO.toString()) && !val.equals(JournalType.ASYNCIO.toString()))
+         {
+            throw new IllegalArgumentException("Invalid arbitrator type " + val);
+         }
+      }
+   };
+
    // Constructors --------------------------------------------------
 
    // Public --------------------------------------------------------

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/NotificationType.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/NotificationType.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/NotificationType.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -33,7 +33,9 @@
    CONSUMER_CREATED(2),
    CONSUMER_CLOSED(3),
    SECURITY_AUTHENTICATION_VIOLATION(6),
-   SECURITY_PERMISSION_VIOLATION(7);
+   SECURITY_PERMISSION_VIOLATION(7),
+   PROPOSAL(8),
+   PROPOSAL_RESPONSE(9);
 
    private final int value;
 

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -662,7 +662,6 @@
                }
 
                notificationMessage.putTypedProperties(notifProps);
-
                postOffice.route(notificationMessage, null);
             }
          }

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/BindingsFactory.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/BindingsFactory.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/BindingsFactory.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.postoffice;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public interface BindingsFactory
+{
+   Bindings createBindings();
+}

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/PostOffice.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/PostOffice.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -28,6 +28,7 @@
 import org.jboss.messaging.core.server.MessagingComponent;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.group.Arbitrator;
 import org.jboss.messaging.core.transaction.Transaction;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -75,5 +76,9 @@
    
    void sendQueueInfoToQueue(SimpleString queueName, SimpleString address) throws Exception;
    
-   Object getNotificationLock();     
+   Object getNotificationLock();
+
+   void addArbitrator(Arbitrator arbitrator);
+
+   Arbitrator getArbitrator();
 }

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -37,9 +37,13 @@
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.postoffice.Binding;
 import org.jboss.messaging.core.postoffice.Bindings;
+import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.server.Bindable;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.server.group.impl.Proposal;
+import org.jboss.messaging.core.server.group.impl.Response;
 import org.jboss.messaging.core.transaction.Transaction;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -66,6 +70,13 @@
 
    private volatile boolean routeWhenNoConsumers;
 
+   private final PostOffice postOffice;
+
+   public BindingsImpl(PostOffice postOffice)
+   {
+      this.postOffice = postOffice;
+   }
+
    public void setRouteWhenNoConsumers(final boolean routeWhenNoConsumers)
    {
       this.routeWhenNoConsumers = routeWhenNoConsumers;
@@ -263,7 +274,11 @@
    public void route(final ServerMessage message, final Transaction tx) throws Exception
    {
       boolean routed = false;
-      
+      Object o = message.getProperty("count_prop");
+      if (o != null)
+      {
+         System.out.println("routing message " + o);
+      }
       if (!exclusiveBindings.isEmpty())
       {
          for (Binding binding : exclusiveBindings)
@@ -279,10 +294,96 @@
 
       if (!routed)
       {
+         Arbitrator groupingArbitrator = postOffice.getArbitrator();
+
          if (message.getProperty(MessageImpl.HDR_FROM_CLUSTER) != null)
          {
             routeFromCluster(message, tx);
          }
+         else if(groupingArbitrator != null && message.getProperty(MessageImpl.HDR_GROUP_ID)!= null)
+         {
+            SimpleString groupId = (SimpleString) message.getProperty(MessageImpl.HDR_GROUP_ID);
+            Response resp = groupingArbitrator.propose(new Proposal(groupId, null));
+            if(resp == null)
+            {
+               for (Map.Entry<SimpleString, List<Binding>> entry : routingNameBindingMap.entrySet())
+               {
+                  SimpleString routingName = entry.getKey();
+
+                  List<Binding> bindings = entry.getValue();
+                  Binding chosen = null;
+                  Binding lowestPriorityBinding = null;
+                  int lowestPriority = Integer.MAX_VALUE;
+                  for (Binding binding : bindings)
+                  {
+                     boolean bindingIsHighAcceptPriority = binding.isHighAcceptPriority(message);
+                     int distance = binding.getDistance();
+                     if((distance < lowestPriority))
+                     {
+                        lowestPriorityBinding = binding;
+                        lowestPriority = distance;
+                        if(bindingIsHighAcceptPriority)
+                        {
+                           chosen = binding;
+                        }
+                     }
+                  }
+                  if(chosen == null)
+                  {
+                     chosen = lowestPriorityBinding;
+                  }
+                  resp = groupingArbitrator.propose(new Proposal(groupId, chosen.getClusterName()));
+                  if(!resp.getChosen().equals(chosen.getClusterName()))
+                  {
+                     for (Binding binding : bindings)
+                     {
+                        if (binding.getClusterName().equals(resp.getChosen()))
+                        {
+                           chosen = binding;
+                           break;
+                        }
+                     }
+                  }
+
+                  if( chosen != null )
+                  {
+                     System.out.println("sending message" + message.getProperty("count_prop") + " to " + chosen.getClusterName());
+                     chosen.willRoute(message);
+                     chosen.getBindable().preroute(message, tx);
+                     chosen.getBindable().route(message, tx);
+                  }
+               }
+            }
+            else
+            {
+               for (Map.Entry<SimpleString, List<Binding>> entry : routingNameBindingMap.entrySet())
+               {
+                  SimpleString routingName = entry.getKey();
+
+                  List<Binding> bindings = entry.getValue();
+                  Binding chosen = null;
+                  for (Binding binding : bindings)
+                  {
+                     if(binding.getClusterName().equals(resp.getChosen()))
+                     {
+                        chosen = binding;
+                        break;
+                     }
+                  }
+                  if( chosen != null && (routeWhenNoConsumers || chosen.isHighAcceptPriority(message)))
+                  {
+                     System.out.println("found sending message" + message.getProperty("count_prop") + " to " + chosen.getClusterName());
+                     chosen.willRoute(message);
+                     chosen.getBindable().preroute(message, tx);
+                     chosen.getBindable().route(message, tx);
+                  }
+                  else
+                  {
+                     System.out.println("BindingsImpl.route");
+                  }
+               }
+            }
+         }
          else
          {
             Set<Bindable> chosen = new HashSet<Bindable>();
@@ -336,80 +437,80 @@
                      }
                   }
 
-                  Filter filter = binding.getFilter();
+            Filter filter = binding.getFilter();
 
-                  if (filter == null || filter.match(message))
-                  {
-                     // bindings.length == 1 ==> only a local queue so we don't check for matching consumers (it's an
-                     // unnecessary overhead)
-                     if (length == 1 || routeWhenNoConsumers || binding.isHighAcceptPriority(message))
-                     {
-                        theBinding = binding;
+            if (filter == null || filter.match(message))
+            {
+               // bindings.length == 1 ==> only a local queue so we don't check for matching consumers (it's an
+               // unnecessary overhead)
+               if (length == 1 || routeWhenNoConsumers || binding.isHighAcceptPriority(message))
+               {
+                  theBinding = binding;
 
-                        pos = incrementPos(pos, length);
+                  pos = incrementPos(pos, length);
 
-                        break;
-                     }
-                     else
-                     {
-                        if (lastLowPriorityBinding == -1)
-                        {
-                           lastLowPriorityBinding = pos;
-                        }
-                     }
+                  break;
+               }
+               else
+               {
+                  if (lastLowPriorityBinding == -1)
+                  {
+                     lastLowPriorityBinding = pos;
                   }
+               }
+            }
 
-                  pos = incrementPos(pos, length);
+            pos = incrementPos(pos, length);
 
-                  if (pos == startPos)
+            if (pos == startPos)
+            {
+               if (lastLowPriorityBinding != -1)
+               {
+                  try
                   {
-                     if (lastLowPriorityBinding != -1)
+                     theBinding = bindings.get(pos);
+                  }
+                  catch (IndexOutOfBoundsException e)
+                  {
+                     // This can occur if binding is removed while in route
+                     if (!bindings.isEmpty())
                      {
-                        try
-                        {
-                           theBinding = bindings.get(pos);
-                        }
-                        catch (IndexOutOfBoundsException e)
-                        {
-                           // This can occur if binding is removed while in route
-                           if (!bindings.isEmpty())
-                           {
-                              pos = 0;
+                        pos = 0;
 
-                              lastLowPriorityBinding = -1;
+                        lastLowPriorityBinding = -1;
 
-                              continue;
-                           }
-                           else
-                           {
-                              break;
-                           }
-                        }
-
-                        pos = lastLowPriorityBinding;
-
-                        pos = incrementPos(pos, length);
+                        continue;
                      }
-                     break;
+                     else
+                     {
+                        break;
+                     }
                   }
-               }
 
-               if (theBinding != null)
-               {
-                  theBinding.willRoute(message);
+                  pos = lastLowPriorityBinding;
 
-                  chosen.add(theBinding.getBindable());
+                  pos = incrementPos(pos, length);
                }
-
-               routingNamePositions.put(routingName, pos);
+               break;
             }
+         }
 
+         if (theBinding != null)
+         {
+            theBinding.willRoute(message);
+
+            chosen.add(theBinding.getBindable());
+         }
+
+         routingNamePositions.put(routingName, pos);
+      }
+
             // TODO refactor to do this is one iteration
 
             for (Bindable bindable : chosen)
             {
                bindable.preroute(message, tx);
-            }
+   }
 
             for (Bindable bindable : chosen)
             {

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -54,10 +54,12 @@
 import org.jboss.messaging.core.postoffice.DuplicateIDCache;
 import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.postoffice.QueueInfo;
+import org.jboss.messaging.core.postoffice.BindingsFactory;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.QueueFactory;
 import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.group.Arbitrator;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
@@ -78,7 +80,7 @@
  * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
  * @author <a href="csuconic at redhat.com">Clebert Suconic</a>
  */
-public class PostOfficeImpl implements PostOffice, NotificationListener
+public class PostOfficeImpl implements PostOffice, NotificationListener, BindingsFactory
 {
    private static final Logger log = Logger.getLogger(PostOfficeImpl.class);
 
@@ -132,6 +134,8 @@
 
    private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
 
+   private Arbitrator groupingArbitrator;
+
    public PostOfficeImpl(final MessagingServer server,
                          final StorageManager storageManager,
                          final PagingManager pagingManager,
@@ -163,11 +167,11 @@
 
       if (enableWildCardRouting)
       {
-         addressManager = new WildcardAddressManager();
+         addressManager = new WildcardAddressManager(this);
       }
       else
       {
-         addressManager = new SimpleAddressManager();
+         addressManager = new SimpleAddressManager(this);
       }
 
       this.backup = backup;
@@ -441,6 +445,9 @@
             case SECURITY_AUTHENTICATION_VIOLATION:
             case SECURITY_PERMISSION_VIOLATION:
                break;
+            case PROPOSAL:
+            case PROPOSAL_RESPONSE:
+               break;
             default:
             {
                throw new IllegalArgumentException("Invalid type " + type);
@@ -556,7 +563,7 @@
 
       if (bindings == null)
       {
-         bindings = new BindingsImpl();
+         bindings = createBindings();
       }
 
       return bindings;
@@ -740,6 +747,16 @@
       return notificationLock;
    }
 
+   public void addArbitrator(Arbitrator arbitrator)
+   {
+      groupingArbitrator = arbitrator;
+   }
+
+   public Arbitrator getArbitrator()
+   {
+      return groupingArbitrator;
+   }
+
    public void sendQueueInfoToQueue(final SimpleString queueName, final SimpleString address) throws Exception
    {
       // We send direct to the queue so we can send it to the same queue that is bound to the notifications adress -
@@ -1097,4 +1114,9 @@
          }
       }
    }
+
+   public Bindings createBindings()
+   {
+      return new BindingsImpl(this);
+   }
 }

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -30,6 +30,7 @@
 import org.jboss.messaging.core.postoffice.AddressManager;
 import org.jboss.messaging.core.postoffice.Binding;
 import org.jboss.messaging.core.postoffice.Bindings;
+import org.jboss.messaging.core.postoffice.BindingsFactory;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -47,13 +48,20 @@
 
    private final ConcurrentMap<SimpleString, Binding> nameMap = new ConcurrentHashMap<SimpleString, Binding>();
 
+   private final BindingsFactory bindingsFactory;
+
+   public SimpleAddressManager(BindingsFactory bindingsFactory)
+   {
+      this.bindingsFactory = bindingsFactory;
+   }
+
    public boolean addBinding(final Binding binding)
    {
       if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null)
       {
-         throw new IllegalStateException("Binding already exists " + binding);         
+         throw new IllegalStateException("Binding already exists " + binding);
       }
-      
+
       return addMappingInternal(binding.getAddress(), binding);
    }
 
@@ -67,7 +75,7 @@
       }
 
       removeBindingInternal(binding.getAddress(), uniqueName);
-      
+
       return binding;
    }
 
@@ -85,27 +93,27 @@
    {
       return nameMap;
    }
-   
+
    public Bindings getMatchingBindings(final SimpleString address)
    {
       Address add = new AddressImpl(address);
-      
-      Bindings bindings = new BindingsImpl();
-      
-      for (Binding binding: nameMap.values())
+
+      Bindings bindings = bindingsFactory.createBindings();
+
+      for (Binding binding : nameMap.values())
       {
          Address addCheck = new AddressImpl(binding.getAddress());
-         
+
          if (addCheck.matches(add))
          {
             bindings.addBinding(binding);
          }
       }
-      
+
       return bindings;
    }
-   
-   
+
+
    public void clear()
    {
       nameMap.clear();
@@ -131,7 +139,7 @@
    {
       Binding theBinding = null;
 
-      for (Binding binding: bindings.getBindings())
+      for (Binding binding : bindings.getBindings())
       {
          if (binding.getUniqueName().equals(bindableName))
          {
@@ -159,7 +167,7 @@
 
       if (bindings == null)
       {
-         bindings = new BindingsImpl();
+         bindings = bindingsFactory.createBindings();
 
          prevBindings = mappings.putIfAbsent(address, bindings);
 

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -23,15 +23,14 @@
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.postoffice.Address;
 import org.jboss.messaging.core.postoffice.Binding;
 import org.jboss.messaging.core.postoffice.Bindings;
+import org.jboss.messaging.core.postoffice.BindingsFactory;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -61,6 +60,11 @@
 
    private final Map<SimpleString, Address> wildCardAddresses = new HashMap<SimpleString, Address>();
 
+   public WildcardAddressManager(BindingsFactory bindingsFactory) 
+   {
+      super(bindingsFactory);
+   }
+
    public Bindings getBindingsForRoutingAddress(final SimpleString address)
    {
       Bindings bindings = super.getBindingsForRoutingAddress(address);

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -97,7 +97,6 @@
       this.executorFactory = new OrderedExecutorFactory(threadPool);
 
       InVMRegistry registry = InVMRegistry.instance;
-
       acceptor = registry.getAcceptor(id);
    }
 

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -41,7 +41,7 @@
    private ConcurrentMap<Integer, InVMAcceptor> acceptors = new ConcurrentHashMap<Integer, InVMAcceptor>();
 
    public void registerAcceptor(final int id, final InVMAcceptor acceptor)
-   {     
+   {
       if (acceptors.putIfAbsent(id, acceptor) != null)
       {
          throw new IllegalArgumentException("Acceptor with id " + id + " already registered");

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -621,6 +621,10 @@
                                                    NotificationType.CONSUMER_CREATED +
                                                    "','" +
                                                    NotificationType.CONSUMER_CLOSED +
+                                                   "','" +
+                                                   NotificationType.PROPOSAL +
+                                                   "','" +
+                                                   NotificationType.PROPOSAL_RESPONSE +
                                                    "') AND " +
                                                    ManagementHelper.HDR_DISTANCE +
                                                    "<" +

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -55,6 +55,8 @@
 import org.jboss.messaging.core.remoting.impl.wireformat.replication.ReplicateRemoteConsumerRemovedMessage;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.server.group.impl.Proposal;
+import org.jboss.messaging.core.server.group.impl.Response;
 import org.jboss.messaging.core.server.cluster.Bridge;
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
 import org.jboss.messaging.core.server.cluster.MessageFlowRecord;
@@ -625,6 +627,12 @@
                case SECURITY_AUTHENTICATION_VIOLATION:
                case SECURITY_PERMISSION_VIOLATION:
                   break;
+               case PROPOSAL:
+                  doProposalReceived(message);
+                  break;
+               case PROPOSAL_RESPONSE:
+                  doProposalResponseReceived(message);
+                  break;
                default:
                {
                   throw new IllegalArgumentException("Invalid type " + ntype);
@@ -645,6 +653,37 @@
          }         
       }
 
+      private synchronized void doProposalReceived(final ClientMessage message) throws Exception
+      {
+         SimpleString type = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_TYPE);
+         if (type == null)
+         {
+            throw new IllegalStateException("proposal type is null");
+         }
+         SimpleString val = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
+         Integer hops = (Integer) message.getProperty(ManagementHelper.HDR_DISTANCE);
+         Response response = postOffice.getArbitrator().receive(new Proposal(type, val), hops + 1);
+         if(response != null)
+         {
+            postOffice.getArbitrator().send(response, 0);
+         }
+      }
+
+      private synchronized void doProposalResponseReceived(final ClientMessage message) throws Exception
+      {
+         SimpleString type = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_TYPE);
+         if (type == null)
+         {
+            throw new IllegalStateException("proposal type is null");
+         }
+         SimpleString val = (SimpleString)  message.getProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
+         SimpleString alt = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE);
+         Integer hops = (Integer) message.getProperty(ManagementHelper.HDR_DISTANCE);
+         Response response = new Response(type, val, alt);
+         postOffice.getArbitrator().proposed(response);
+         postOffice.getArbitrator().send(response, hops + 1);
+      }
+
       private synchronized void doBindingAdded(final ClientMessage message, final Channel replChannel) throws Exception
       {
          Integer distance = (Integer)message.getProperty(ManagementHelper.HDR_DISTANCE);

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -49,6 +49,10 @@
 import org.jboss.messaging.core.remoting.Channel;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
+import org.jboss.messaging.core.server.group.impl.LocalArbitrator;
+import org.jboss.messaging.core.server.group.impl.RemoteArbitrator;
 import org.jboss.messaging.core.server.cluster.Bridge;
 import org.jboss.messaging.core.server.cluster.BroadcastGroup;
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
@@ -62,10 +66,8 @@
  * A ClusterManagerImpl
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * 
- * Created 18 Nov 2008 09:23:49
- *
- *
+ *         <p/>
+ *         Created 18 Nov 2008 09:23:49
  */
 public class ClusterManagerImpl implements ClusterManager
 {
@@ -80,7 +82,7 @@
    private final Map<String, ClusterConnection> clusters = new HashMap<String, ClusterConnection>();
 
    private final org.jboss.messaging.utils.ExecutorFactory executorFactory;
-   
+
    private final MessagingServer server;
 
    private final PostOffice postOffice;
@@ -92,11 +94,11 @@
    private final Configuration configuration;
 
    private final UUID nodeUUID;
-   
+
    private Channel replicatingChannel;
 
    private volatile boolean started;
-   
+
    private boolean backup;
 
    public ClusterManagerImpl(final org.jboss.messaging.utils.ExecutorFactory executorFactory,
@@ -113,9 +115,9 @@
       {
          throw new IllegalArgumentException("Node uuid is null");
       }
-      
+
       this.executorFactory = executorFactory;
-      
+
       this.server = server;
 
       this.postOffice = postOffice;
@@ -127,9 +129,9 @@
       this.configuration = configuration;
 
       this.nodeUUID = nodeUUID;
-      
+
       this.replicatingChannel = replicatingChannel;
-      
+
       this.backup = backup;
    }
 
@@ -160,6 +162,10 @@
          deployClusterConnection(config);
       }
 
+      for (ArbitratorConfiguration config : configuration.getArbitratorConfigurations())
+      {
+         deployArbitratorConfigurations(config);
+      }
       started = true;
    }
 
@@ -217,36 +223,36 @@
    {
       return new HashSet<ClusterConnection>(clusters.values());
    }
-   
+
    public Set<BroadcastGroup> getBroadcastGroups()
    {
       return new HashSet<BroadcastGroup>(broadcastGroups.values());
    }
-   
+
    public ClusterConnection getClusterConnection(final SimpleString name)
    {
-      return clusters.get(name.toString()); 
+      return clusters.get(name.toString());
    }
-   
+
    public synchronized void activate()
-   {      
-      for (BroadcastGroup bg: broadcastGroups.values())
+   {
+      for (BroadcastGroup bg : broadcastGroups.values())
       {
          bg.activate();
       }
-      
-      for (Bridge bridge: bridges.values())
+
+      for (Bridge bridge : bridges.values())
       {
          bridge.activate();
       }
-      
-      for (ClusterConnection cc: clusters.values())
+
+      for (ClusterConnection cc : clusters.values())
       {
          cc.activate();
       }
-      
+
       replicatingChannel = null;
-      
+
       backup = false;
    }
 
@@ -395,7 +401,7 @@
          return;
       }
 
-      Queue queue = (Queue)binding.getBindable();
+      Queue queue = (Queue) binding.getBindable();
 
       Bridge bridge;
 
@@ -514,14 +520,14 @@
 
          clusterConnection = new ClusterConnectionImpl(new SimpleString(config.getName()),
                                                        new SimpleString(config.getAddress()),
-                                                       config.getRetryInterval(),                                                       
+                                                       config.getRetryInterval(),
                                                        config.isDuplicateDetection(),
                                                        config.isForwardWhenNoConsumers(),
                                                        executorFactory,
-                                                       server,                                         
+                                                       server,
                                                        postOffice,
                                                        managementService,
-                                                       scheduledExecutor,                                            
+                                                       scheduledExecutor,
                                                        connectors,
                                                        config.getMaxHops(),
                                                        nodeUUID,
@@ -540,14 +546,14 @@
 
          clusterConnection = new ClusterConnectionImpl(new SimpleString(config.getName()),
                                                        new SimpleString(config.getAddress()),
-                                                       config.getRetryInterval(),                                                      
+                                                       config.getRetryInterval(),
                                                        config.isDuplicateDetection(),
                                                        config.isForwardWhenNoConsumers(),
                                                        executorFactory,
-                                                       server,                                             
+                                                       server,
                                                        postOffice,
                                                        managementService,
-                                                       scheduledExecutor,                                               
+                                                       scheduledExecutor,
                                                        dg,
                                                        config.getMaxHops(),
                                                        nodeUUID,
@@ -562,6 +568,20 @@
       clusterConnection.start();
    }
 
+   private synchronized void deployArbitratorConfigurations(final ArbitratorConfiguration config) throws Exception
+   {
+      Arbitrator arbitrator;
+      if (config.getType() == ArbitratorConfiguration.TYPE.LOCAL)
+      {
+         arbitrator = new LocalArbitrator(managementService, config.getName(), config.getAddress(), scheduledExecutor);
+      }
+      else
+      {
+         arbitrator = new RemoteArbitrator(managementService, config.getName(), config.getAddress());
+      }
+      postOffice.addArbitrator(arbitrator);
+   }
+
    private Transformer instantiateTransformer(final String transformerClassName)
    {
       Transformer transformer = null;
@@ -572,7 +592,7 @@
          try
          {
             Class<?> clz = loader.loadClass(transformerClassName);
-            transformer = (Transformer)clz.newInstance();
+            transformer = (Transformer) clz.newInstance();
          }
          catch (Exception e)
          {

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/Arbitrator.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/Arbitrator.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/Arbitrator.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group;
+
+import org.jboss.messaging.core.server.group.impl.Response;
+import org.jboss.messaging.core.server.group.impl.Proposal;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public interface Arbitrator
+{
+   SimpleString getName();
+
+   Response propose(Proposal proposal) throws Exception;
+
+   void proposed(Response response) throws Exception;
+
+   void send(Response response, int distance) throws Exception;
+
+   Response receive(Proposal proposal, int distance) throws Exception;
+
+   Response rePropose(Proposal proposal) throws Exception;
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/ProposalHandler.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/ProposalHandler.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/ProposalHandler.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group;
+
+import org.jboss.messaging.core.server.group.impl.Proposal;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.utils.TypedProperties;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public interface ProposalHandler
+{
+   public void handleSend(Proposal proposal, TypedProperties clientMessage);
+
+   void handleReceive(Proposal proposal);
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/ArbitratorConfiguration.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/ArbitratorConfiguration.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/ArbitratorConfiguration.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class ArbitratorConfiguration
+{
+   private final SimpleString name;
+   
+   private final TYPE type;
+
+   private final SimpleString address;
+
+   public ArbitratorConfiguration(final SimpleString name, final TYPE type, SimpleString address)
+   {
+      this.type = type;
+      this.name = name;
+      this.address = address;
+   }
+
+   public SimpleString getName()
+   {
+      return name;
+   }
+
+   public TYPE getType()
+   {
+      return type;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   public enum TYPE
+   {
+      LOCAL("LOCAL"),
+      REMOTE("REMOTE");
+
+      private String type;
+
+      TYPE(String type)
+      {
+         this.type = type;
+      }
+
+      public String getType()
+      {
+         return type;
+      }
+   }
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/GroupProposalHandler.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/GroupProposalHandler.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/GroupProposalHandler.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.core.server.group.ProposalHandler;
+import org.jboss.messaging.utils.TypedProperties;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class GroupProposalHandler implements ProposalHandler
+{
+   public void handleSend(Proposal proposal, TypedProperties clientMessage)
+   {
+      
+   }
+
+   public void handleReceive(Proposal proposal)
+   {
+   }
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/LocalArbitrator.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/LocalArbitrator.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/LocalArbitrator.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.postoffice.BindingType;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationType;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class LocalArbitrator implements Arbitrator
+{
+   private static Logger log = Logger.getLogger(LocalArbitrator.class);
+
+   private ConcurrentHashMap<SimpleString, Object> map = new ConcurrentHashMap<SimpleString, Object>();
+
+   private final SimpleString name;
+
+   private final ManagementService managementService;
+
+   private SimpleString address;
+
+   private ScheduledExecutorService scheduledExecutor;
+
+   private ConcurrentHashSet<SimpleString> reProposals = new ConcurrentHashSet<SimpleString>();
+
+   public LocalArbitrator(final ManagementService managementService, final SimpleString name, final SimpleString address, ScheduledExecutorService scheduledExecutor)
+   {
+      this.managementService = managementService;
+      this.name = name;
+      this.address = address;
+      this.scheduledExecutor = scheduledExecutor;
+   }
+
+   public SimpleString getName()
+   {
+      return name;
+   }
+
+
+   public Response propose(Proposal proposal) throws Exception
+   {
+      if(proposal.getProposal() == null)
+      {
+         Object original = map.get(proposal.getProposalType());
+         return original == null?null:new Response(proposal.getProposalType(), original);
+      }
+      Response response = new Response(proposal.getProposalType(), proposal.getProposal());
+      if (map.putIfAbsent(response.getResponseType(), response.getChosen()) == null)
+      {
+         log.info("accepted proposal for " + proposal.getProposalType() + " with value " + proposal.getProposal());
+         return response;
+      }
+      else
+      {
+         log.info("denied proposal for " + proposal.getProposalType() + " with value " + proposal.getProposal());
+         return new Response(proposal.getProposalType(), proposal.getProposal(), map.get(proposal.getProposalType()));
+      }
+   }
+
+   public void proposed(Response response) throws Exception
+   {
+   }
+
+   public void send(Response response, int distance) throws Exception
+   {
+      Object value = response.getAlternative() != null ? response.getAlternative() : response.getOriginal();
+      log.info("sending proposal response for " + response.getResponseType() + " with value " + value);
+      TypedProperties props = new TypedProperties();
+      props.putStringProperty(ManagementHelper.HDR_PROPOSAL_TYPE, response.getResponseType());
+      props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, (SimpleString)response.getOriginal());
+      props.putStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE, (SimpleString)response.getAlternative());
+      props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
+      props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+      props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
+      Notification notification = new Notification(null, NotificationType.PROPOSAL_RESPONSE, props);
+      managementService.sendNotification(notification);
+   }
+
+   public Response receive(Proposal proposal, int distance) throws Exception
+   {
+      return propose(proposal);
+   }
+
+   public Response rePropose(final Proposal proposal) throws Exception
+   {
+      if(reProposals.addIfAbsent(proposal.getProposalType()))
+      {
+         Response response = new Response(proposal.getProposalType(), proposal.getProposal());
+         map.replace(proposal.getProposalType(), response);
+         send(response, 0);
+         scheduledExecutor.schedule(new Runnable()
+         {
+            public void run()
+            {
+               reProposals.remove(proposal.getProposalType());
+            }
+         }, 2000, TimeUnit.MILLISECONDS);
+         return response;
+      }
+      else
+      {
+         return new Response(proposal.getProposalType(), map.get(proposal.getProposalType()));
+      }
+   }
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Proposal.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Proposal.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Proposal.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class Proposal
+{
+   private final SimpleString proposalType;
+   private final Object proposal;
+
+   public static final String PROPOSAL_TYPE_HEADER = "_JBM_PROPOSAL_TYPE";
+   public static final String PROPOSAL_HEADER = "_JBM_PROPOSAL";
+
+   public Proposal(SimpleString proposalType, Object proposal)
+   {
+      this.proposal = proposal;
+      this.proposalType = proposalType;
+   }
+
+   public SimpleString getProposalType()
+   {
+      return proposalType;
+   }
+
+   public Object getProposal()
+   {
+      return proposal;
+   }
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/RemoteArbitrator.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/RemoteArbitrator.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/RemoteArbitrator.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationType;
+import org.jboss.messaging.core.postoffice.BindingType;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
+
+import java.util.logging.Logger;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class RemoteArbitrator implements Arbitrator
+{
+   private static Logger log = Logger.getLogger(RemoteArbitrator.class.getName());
+
+   private final SimpleString name;
+
+   private final ManagementService managementService;
+
+   private final SimpleString address;
+
+   private Map<SimpleString, Response> responses = new HashMap<SimpleString, Response>();
+
+   private final Lock lock = new ReentrantLock();
+
+   private final Condition sendCondition = lock.newCondition();
+
+   private int waitTime = 1000;
+
+   public RemoteArbitrator(final ManagementService managementService, final SimpleString name, final SimpleString address)
+   {
+      this.name = name;
+      this.address = address;
+      this.managementService = managementService;
+   }
+
+   public SimpleString getName()
+   {
+      return name;
+   }
+
+   public Response propose(final Proposal proposal) throws Exception
+   {
+      Response response = responses.get(proposal.getProposalType());
+      if( response != null)
+      {
+         return response;
+      }
+      if (proposal.getProposal() == null)
+      {
+         return null;
+      }
+      try
+      {
+         lock.lock();
+         TypedProperties props = new TypedProperties();
+         log.info("sending proposal for " + proposal.getProposalType() + " with value " + proposal.getProposal());
+         props.putStringProperty(ManagementHelper.HDR_PROPOSAL_TYPE, proposal.getProposalType());
+         props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, (SimpleString)proposal.getProposal());
+         props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
+         props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+         props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0);
+         Notification notification = new Notification(null, NotificationType.PROPOSAL, props);
+         managementService.sendNotification(notification);
+         sendCondition.await(waitTime, TimeUnit.MILLISECONDS);
+      }
+      finally
+      {
+         lock.unlock();
+      }
+      return responses.get(proposal.getProposalType());
+   }
+
+   public void proposed(Response response) throws Exception
+   {
+      Object value = response.getAlternative() != null ? response.getAlternative() : response.getOriginal();
+      log.info("received proposal response for " + response.getResponseType() + " with value " + value);
+      try
+      {
+         lock.lock();
+         responses.put(response.getResponseType(), response);
+         sendCondition.signal();
+      }
+      finally
+      {
+         lock.unlock();
+      }
+   }
+
+   public Response receive(Proposal proposal, int distance) throws Exception
+   {
+      TypedProperties props = new TypedProperties();
+      props.putStringProperty(ManagementHelper.HDR_PROPOSAL_TYPE, proposal.getProposalType());
+      props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, (SimpleString)proposal.getProposal());
+      props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
+      props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+      props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
+      Notification notification = new Notification(null, NotificationType.PROPOSAL, props);
+      managementService.sendNotification(notification);
+      return null;
+   }
+
+   public void send(Response response, int distance) throws Exception
+   {
+   }
+
+   public Response rePropose(Proposal proposal)
+   {
+      return null;
+   }
+
+}

Added: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Response.java
===================================================================
--- branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Response.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/group/impl/Response.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.core.server.group.impl;
+
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class Response
+{
+   private final boolean accepted;
+
+   private final Object original;
+
+   private final Object alternative;
+
+   private SimpleString responseType;
+
+   public Response(SimpleString responseType, Object original)
+   {
+      this(responseType, original, null);
+   }
+
+   public Response(SimpleString responseType, Object original, Object alternative)
+   {
+      this.responseType = responseType;
+      this.accepted = alternative == null;
+      this.original = original;
+      this.alternative = alternative;
+   }
+
+   public boolean isAccepted()
+   {
+      return accepted;
+   }
+
+   public Object getOriginal()
+   {
+      return original;
+   }
+
+   public Object getAlternative()
+   {
+      return alternative;
+   }
+
+   public Object getChosen()
+   {
+      return alternative != null?alternative:original;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "accepted = " + accepted + " original = " + original + " alternative = " + alternative;
+   }
+
+   public SimpleString getResponseType()
+   {
+      return responseType;
+   }
+}

Modified: branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -450,6 +450,7 @@
             if (consumer == groups.get(groupID))
             {
                groups.remove(groupID);
+               //postOffice.getArbitrator().
             }
          }
       }

Modified: branches/Branch_Strict_Ordering/tests/jms-tests/messaging-jms-tests.iml
===================================================================
--- trunk/tests/jms-tests/messaging-jms-tests.iml	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/tests/jms-tests/messaging-jms-tests.iml	2009-08-06 08:58:34 UTC (rev 7671)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module relativePaths="true" type="JAVA_MODULE" version="4">
   <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/output/classes" />
-    <output-test url="file://$MODULE_DIR$/output" />
+    <output url="file://$APPLICATION_HOME_DIR$/bin/output/classes" />
+    <output-test url="file://$APPLICATION_HOME_DIR$/bin/output" />
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="true" />

Modified: branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -54,6 +54,10 @@
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.core.server.group.Arbitrator;
+import org.jboss.messaging.core.server.group.impl.RemoteArbitrator;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
+import org.jboss.messaging.core.server.group.impl.LocalArbitrator;
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
 import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -399,11 +403,42 @@
       session.close();
    }
 
+   protected void sendInRange(int node, String address, int msgStart, int msgEnd, boolean durable, SimpleString key, SimpleString val) throws Exception
+   {
+      ClientSessionFactory sf = this.sfs[node];
+
+      if (sf == null)
+      {
+         throw new IllegalArgumentException("No sf at " + node);
+      }
+
+      ClientSession session = sf.createSession(false, true, true);
+
+      ClientProducer producer = session.createProducer(address);
+
+      for (int i = msgStart; i < msgEnd; i++)
+      {
+         ClientMessage message = session.createClientMessage(durable);
+
+         message.putStringProperty(key, val);
+         message.putIntProperty(COUNT_PROP, i);
+         System.out.println("i = " + i);
+         producer.send(message);
+      }
+
+      session.close();
+   }
+
    protected void send(int node, String address, int numMessages, boolean durable, String filterVal) throws Exception
    {
       sendInRange(node, address, 0, numMessages, durable, filterVal);
    }
 
+   protected void sendWithProperty(int node, String address, int numMessages, boolean durable, SimpleString key, SimpleString val) throws Exception
+   {
+      sendInRange(node, address, 0, numMessages, durable, key, val);
+   }
+
    protected void verifyReceiveAllInRange(boolean ack, int msgStart, int msgEnd, int... consumerIDs) throws Exception
    {
       verifyReceiveAllInRangeNotBefore(ack, -1, msgStart, msgEnd, consumerIDs);
@@ -433,7 +468,7 @@
          for (int j = msgStart; j < msgEnd; j++)
          {
             ClientMessage message = holder.consumer.receive(2000);
-
+            System.out.println("consumer" + consumerIDs[i] + " j = " + j);
             if (message == null)
             {
                log.info("*** dumping consumers:");
@@ -1207,6 +1242,19 @@
       serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
    }
 
+   protected void setUpGroupArbitrator(ArbitratorConfiguration.TYPE type,  int node)
+   {
+      Arbitrator arbitrator;
+      if(type == ArbitratorConfiguration.TYPE.LOCAL)
+      {
+         arbitrator = new LocalArbitrator(servers[node].getManagementService(), new SimpleString("grouparbitrator"), new SimpleString("queues"), null);
+      }
+      else
+      {
+         arbitrator = new RemoteArbitrator(servers[node].getManagementService(), new SimpleString("grouparbitrator"), new SimpleString("queues"));
+      }
+      this.servers[node].getPostOffice().addArbitrator(arbitrator);
+   }
    protected void setupClusterConnectionWithBackups(String name,
                                                     String address,
                                                     boolean forwardWhenNoConsumers,

Added: branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredGroupingTest.java	                        (rev 0)
+++ branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredGroupingTest.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -0,0 +1,537 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.messaging.tests.integration.cluster.distribution;
+
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
+import org.jboss.messaging.core.message.impl.MessageImpl;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class ClusteredGroupingTest extends ClusterTestBase
+{
+
+   public void testGroupingSimple() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendWithProperty(0, "queues.testaddress", 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAll(10, 0);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo2queues() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendInRange(0, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 0);
+         sendInRange(1, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo3queues() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendInRange(0, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 0);
+         sendInRange(1, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo3queuesRemoteArbitrator() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendInRange(1, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 1);
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 1);
+         sendInRange(0, "queues.testaddress", 20, 30, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(20, 30, 1);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo3queuesNoConsumerOnLocalQueue() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         //addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 0, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 1, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 1, false);
+
+         sendInRange(1, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 0);
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+         sendInRange(0, "queues.testaddress", 20, 30, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(20, 30, 0);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo3queuesNoConsumersDeliveredToLocalQueue() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         waitForBindings(0, "queues.testaddress", 1, 0, true);
+         waitForBindings(1, "queues.testaddress", 1, 0, true);
+         waitForBindings(2, "queues.testaddress", 1, 0, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 0, false);
+         waitForBindings(1, "queues.testaddress", 2, 0, false);
+         waitForBindings(2, "queues.testaddress", 2, 0, false);
+
+         sendInRange(1, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         sendInRange(0, "queues.testaddress", 20, 30, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         verifyReceiveAllInRange(0, 30, 1);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   public void testGroupingSendTo3queuesQueueRemoved() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendInRange(0, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 0);
+         removeConsumer(0);
+         deleteQueue(0, "queue0");
+         sendInRange(1, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 0);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }
+
+   /*public void testGroupingSendTo3queuesPinnedNodeGoesDown() throws Exception
+   {
+      setupServer(0, isFileStorage(), isNetty());
+      setupServer(1, isFileStorage(), isNetty());
+      setupServer(2, isFileStorage(), isNetty());
+
+      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
+
+      startServers(0, 1, 2);
+
+      try
+      {
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.LOCAL, 0);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 1);
+         setUpGroupArbitrator(ArbitratorConfiguration.TYPE.REMOTE, 2);
+
+         setupSessionFactory(0, isNetty());
+         setupSessionFactory(1, isNetty());
+         setupSessionFactory(2, isNetty());
+
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+
+         sendInRange(1, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(0, 10, 1);
+
+         stopClusterConnections(1);
+
+         stopServers(1);
+
+         Thread.sleep(5000);
+
+         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(10, 20, 1);
+         sendInRange(0, "queues.testaddress", 20, 30, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+
+         verifyReceiveAllInRange(20, 30, 1);
+
+         System.out.println("*****************************************************************************");
+      }
+      finally
+      {
+         //closeAllConsumers();
+
+         closeAllSessionFactories();
+
+         stopServers(0, 1, 2);
+      }
+   }*/
+
+   public boolean isNetty()
+   {
+      return true;
+   }
+
+   public boolean isFileStorage()
+   {
+      return false;
+   }
+}

Modified: branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -23,6 +23,10 @@
 package org.jboss.messaging.tests.integration.cluster.distribution;
 
 import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.server.group.impl.ArbitratorConfiguration;
+import org.jboss.messaging.core.message.impl.MessageImpl;
+import org.jboss.messaging.jms.client.JBossMessage;
+import org.jboss.messaging.utils.SimpleString;
 
 /**
  * A SymmetricClusterTest

Modified: branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -48,6 +48,7 @@
 import org.jboss.messaging.core.transaction.Transaction;
 import org.jboss.messaging.core.transaction.TransactionOperation;
 import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakePostOffice;
 import org.jboss.messaging.utils.SimpleString;
 import org.jboss.messaging.utils.TypedProperties;
 
@@ -95,7 +96,7 @@
    {
       final FakeBinding fake = new FakeBinding(new SimpleString("a"));
 
-      final BindingsImpl bind = new BindingsImpl();
+      final BindingsImpl bind = new BindingsImpl(new FakePostOffice());
       bind.addBinding(fake);
       bind.addBinding(new FakeBinding(new SimpleString("a")));
       bind.addBinding(new FakeBinding(new SimpleString("a")));

Modified: branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakePostOffice.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakePostOffice.java	2009-07-07 10:42:54 UTC (rev 7531)
+++ branches/Branch_Strict_Ordering/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakePostOffice.java	2009-08-06 08:58:34 UTC (rev 7671)
@@ -32,6 +32,7 @@
 import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.group.Arbitrator;
 import org.jboss.messaging.core.transaction.Transaction;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -159,4 +160,12 @@
 
    }
 
+   public void addArbitrator(Arbitrator arbitrator)
+   {
+   }
+
+   public Arbitrator getArbitrator()
+   {
+      return null;
+   }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list