[jboss-cvs] JBoss Messaging SVN: r1765 - in branches/Branch_Client_Failover_Experiment: . docs/examples/http/etc docs/examples/queue docs/examples/secure-socket/etc src/etc src/etc/server/default/deploy src/etc/xmdesc src/main/org/jboss/jms/client src/main/org/jboss/jms/client/container src/main/org/jboss/jms/client/delegate src/main/org/jboss/jms/client/remoting src/main/org/jboss/jms/client/state src/main/org/jboss/jms/delegate src/main/org/jboss/jms/message src/main/org/jboss/jms/server src/main/org/jboss/jms/server/connectionfactory src/main/org/jboss/jms/server/container src/main/org/jboss/jms/server/destination src/main/org/jboss/jms/server/endpoint src/main/org/jboss/jms/server/endpoint/advised src/main/org/jboss/jms/server/remoting src/main/org/jboss/jms/tx src/main/org/jboss/jms/util src/main/org/jboss/messaging/core src/main/org/jboss/messaging/core/message src/main/org/jboss/messaging/core/plugin src/main/org/jboss/messaging/core/plugin/contract src/main/org/jboss/m! essaging/core/tx tests tests/bin tests/etc tests/smoke tests/src/org/jboss/test/messaging/core/plugin tests/src/org/jboss/test/messaging/core/plugin/base tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/jms/message tests/src/org/jboss/test/messaging/tools/jmx tests/src/org/jboss/test/messaging/tools/jmx/rmi

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 11 15:51:08 EST 2006


Author: ovidiu.feodorov at jboss.com
Date: 2006-12-11 15:50:25 -0500 (Mon, 11 Dec 2006)
New Revision: 1765

Added:
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/DLQTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
Removed:
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/DummyCallbackHandler.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectInputStream.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectOutputStream.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingSerializationManager.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/CallbackServerFactoryTest.java
Modified:
   branches/Branch_Client_Failover_Experiment/
   branches/Branch_Client_Failover_Experiment/build-messaging.xml
   branches/Branch_Client_Failover_Experiment/build-thirdparty.xml
   branches/Branch_Client_Failover_Experiment/docs/examples/http/etc/messaging-http-service.xml
   branches/Branch_Client_Failover_Experiment/docs/examples/queue/do-not-distribute.properties
   branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
   branches/Branch_Client_Failover_Experiment/messaging.iml
   branches/Branch_Client_Failover_Experiment/messaging.ipr
   branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/jms-ds.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/messaging-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/oracle-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/postgresql-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/remoting-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/sybase-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/ServerPeer-xmbean.xml
   branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/Topic-xmbean.xml
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossSession.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/AsfAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/ConsumerAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/SessionAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/TransactionAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackManager.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/state/ConsumerState.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/delegate/SessionDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/JBossMessage.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/MessageProxy.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/container/InjectionAspect.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConsumerEndpoint.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConsumerAdvised.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/AckInfo.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/ResourceManager.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/util/XMLUtil.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/ChannelSupport.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/Routable.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/message/RoutableSupport.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
   branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example
   branches/Branch_Client_Failover_Experiment/tests/bin/runtest
   branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server
   branches/Branch_Client_Failover_Experiment/tests/build.xml
   branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
   branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml
   branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/base/MessageStoreTestBase.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/JMSTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/SessionTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
Log:
merging the trunk into this branch, preparing for reverse merge (svn merge -r1540:HEAD https://svn.jboss.org/repos/messaging/trunk)


Property changes on: branches/Branch_Client_Failover_Experiment
___________________________________________________________________
Name: svn:ignore
   - output
thirdparty
messaging.iws
messaging-Branch_Client_Failover_Experiment.ipr
messaging-Branch_Client_Failover_Experiment.iws
messaging-Branch_Client_Failover_Experiment.iml

   + output
thirdparty
messaging.iws



Modified: branches/Branch_Client_Failover_Experiment/build-messaging.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/build-messaging.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/build-messaging.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -50,7 +50,7 @@
    <property name="messaging.version.revision" value="0"/>
    <property name="messaging.version.incrementing" value="8"/>
    <property name="messaging.version.tag" value="Beta1"/>
-   <property name="messaging.version.name" value=""/>
+   <property name="messaging.version.name" value="Berlin"/>
    <property name="messaging.version.cvstag" value="JBossMessaging_1_2_0_Beta1"/>
    <property name="module.name" value="messaging"/>
    <property name="module.Name" value="JBoss Messaging"/>
@@ -459,6 +459,9 @@
       <copy todir="${build.scoped-sar}" file="${jboss.aop.lib}/jboss-aop.jar"/>
       <copy todir="${build.scoped-sar}" file="${javassist.javassist.lib}/javassist.jar"/>
       <copy todir="${build.scoped-sar}" file="${trove.trove.lib}/trove.jar"/>
+      <copy todir="${build.scoped-sar}" file="${apache.tomcat.lib}/tomcat-coyote.jar"/>
+      <copy todir="${build.scoped-sar}" file="${apache.tomcat.lib}/tomcat-http.jar"/>
+      <copy todir="${build.scoped-sar}" file="${apache.tomcat.lib}/tomcat-util.jar"/>
 
       <mkdir dir="${build.scoped-sar}/tmp"/>
 
@@ -580,6 +583,10 @@
       <unjar dest="${project.output}/jboss-messaging-client" src="${jboss.naming.lib}/jnp-client.jar"/>
       <unjar dest="${project.output}/jboss-messaging-client" src="${oswego.concurrent.lib}/concurrent.jar"/>
       <unjar dest="${project.output}/jboss-messaging-client" src="${apache.log4j.lib}/log4j.jar"/>
+      <unjar dest="${project.output}/jboss-messaging-client" src="${apache.logging.lib}/commons-logging.jar"/>
+      <unjar dest="${project.output}/jboss-messaging-client" src="${apache.tomcat.lib}/tomcat-coyote.jar"/>
+      <unjar dest="${project.output}/jboss-messaging-client" src="${apache.tomcat.lib}/tomcat-http.jar"/>
+      <unjar dest="${project.output}/jboss-messaging-client" src="${apache.tomcat.lib}/tomcat-util.jar"/>
       <jar jarfile="${build.lib}/jboss-messaging-client.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/**"/>

Modified: branches/Branch_Client_Failover_Experiment/build-thirdparty.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/build-thirdparty.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/build-thirdparty.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -92,7 +92,7 @@
       <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
       <componentref name="jboss/aop" version="1.5.0.GA"/>
       <componentref name="jboss/serialization" version="1.0.3.GA"/>
-      <componentref name="jboss/remoting" version="2.2.0.Alpha2"/>
+      <componentref name="jboss/remoting" version="2.2.0.Alpha4"/>
 
       <!-- Need this otherwise project doesn't build in Eclipse -->
       <componentref name="apache-logging" version="1.0.4.1jboss"/>
@@ -107,7 +107,6 @@
       <componentref name="jboss/profiler/jvmti" version="1.0.0.CR5"/>
       <componentref name="jboss/jbossxb" version="1.0.0.CR6"/>
 
-
    </build>
 
    <synchronizeinfo/>

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/http/etc/messaging-http-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/http/etc/messaging-http-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/http/etc/messaging-http-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -16,30 +16,34 @@
         This Connector will basically run as a standalone http server
    -->
    <mbean code="org.jboss.remoting.transport.Connector"
-      name="jboss.messaging:service=Connector,transport=HTTP"
-      display-name="Messaging HTTP transport Connector">
-
-      <!--
-           Since there are no special configuration properties for this invoker, will just use
-           the following to declare the invoker and not within the 'invoker' element within the
-           'Configuration' attribute below. IMPORTANT to note can only be either 'InvokerLocator'
-           attribute OR 'invoker' element, not both.
-      -->
-      <attribute name="InvokerLocator">http://${jboss.bind.address}:7488</attribute>
+          name="jboss.messaging:service=Connector,transport=http"
+          display-name="HTTP transport Connector">
       <attribute name="Configuration">
          <config>
+            <invoker transport="http">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+               <attribute name="serializationtype" isParam="true">jms</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4458</attribute>
+               <attribute name="leasePeriod">20000</attribute>
+               <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
+               <attribute name="callbackPollPeriod" isParam="true">100</attribute>
+            </invoker>
             <handlers>
                <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
             </handlers>
          </config>
       </attribute>
+      <depends>jboss.messaging:service=NetworkRegistry</depends>
    </mbean>
-
+   
    <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
       name="jboss.messaging.destination:service=SecureConnectionFactory"
       xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=HTTP</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends>
       <attribute name="JNDIBindings">
          <bindings>
             <binding>/HttpConnectionFactory</binding>

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/queue/do-not-distribute.properties
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/queue/do-not-distribute.properties	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/queue/do-not-distribute.properties	2006-12-11 20:50:25 UTC (rev 1765)
@@ -4,4 +4,4 @@
 #
 messaging.client.jar.path=../../../output/lib
 messaging.client.jar.name=jboss-messaging-client.jar
-jboss.configuration=current-version-server
+jboss.configuration=messaging

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -29,6 +29,8 @@
                <attribute name="serverBindPort">5457</attribute>
                <attribute name="leasePeriod">20000</attribute>
                <attribute name="serverSocketFactory">jboss.messaging:service=ServerSocketFactory,type=SSL</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
             </invoker>
             <handlers>
                <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>

Modified: branches/Branch_Client_Failover_Experiment/messaging.iml
===================================================================
--- branches/Branch_Client_Failover_Experiment/messaging.iml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/messaging.iml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,739 +1,739 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
-  <component name="ModuleRootManager" />
-  <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/classes" />
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/common/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/distributed-topic/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/http/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/mdb/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/queue/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/secure-socket/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/stateless/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/docs/examples/topic/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/output/gen-parsers" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/perf/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/perf/tests" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/tests/src" isTestSource="false" />
-      <excludeFolder url="file://$MODULE_DIR$/output/classes" />
-      <excludeFolder url="file://$MODULE_DIR$/output/etc" />
-      <excludeFolder url="file://$MODULE_DIR$/output/jar" />
-      <excludeFolder url="file://$MODULE_DIR$/output/lib" />
-      <excludeFolder url="file://$MODULE_DIR$/output/scoped-sar" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jbosssx.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss-transaction.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss-system.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss-j2se.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss-jmx.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jnp-client.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/lib/jboss-j2ee.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jgroups/lib/jgroups.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/javassist/lib/javassist.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/retrotranslator-transformer.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/pluggable-instrumentor.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/serialization/lib/jboss-serialization.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/remoting/lib/jboss-remoting.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/xercesImpl.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop-jdk50-client.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-logging/lib/commons-logging.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/dom4j/lib/dom4j.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-archive-browsing.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/resolver.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-log4j/lib/snmpTrapAppender.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/xml-apis.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/namespace.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/sun-javacc/lib/javacc.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/backport-util-concurrent.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/common-softvaluehashmap.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aspect-jdk50-client.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/junit/lib/junit.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-common-client.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/apache-log4j/lib/log4j.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/trove/lib/trove.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jdk14-pluggable-instrumentor.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/retrotranslator-runtime.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jrockit-pluggable-instrumentor.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/oswego-concurrent/lib/concurrent.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/hsqldb/lib/hsqldb.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-common.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/jboss-jca.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/jboss-common-jdbc-wrapper.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/jms-ra.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/jboss-mbeans.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/mysql-connector-java-3.1.13-bin.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/tests/lib/jboss-local-jdbc.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-junit.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jai.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-starteam.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/xml-apis.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-commons-logging.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jmf.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-antlr.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jsch.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-trax.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-netrexx.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-vaj.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-commons-net.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-weblogic.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-regexp.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-bsf.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/junit.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-swing.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-nodeps.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-stylebook.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-oro.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-xalan1.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-icontract.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-javamail.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jdepend.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-log4j.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-bcel.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-xslp.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-launcher.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/xercesImpl.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-resolver.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntryProperties />
-  </component>
-  <component name="VcsManagerConfiguration">
-    <option name="ACTIVE_VCS_NAME" value="svn" />
-    <option name="USE_PROJECT_VCS" value="false" />
-  </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+  <component name="ModuleRootManager" />
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/common/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/distributed-topic/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/http/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/mdb/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/queue/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/secure-socket/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/stateless/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/docs/examples/topic/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/output/gen-parsers" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/perf/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/perf/tests" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/tests/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/output/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/output/etc" />
+      <excludeFolder url="file://$MODULE_DIR$/output/jar" />
+      <excludeFolder url="file://$MODULE_DIR$/output/lib" />
+      <excludeFolder url="file://$MODULE_DIR$/output/scoped-sar" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jbosssx.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss-transaction.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss-system.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss-j2se.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss-jmx.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jnp-client.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jboss-j2ee.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jgroups/lib/jgroups.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/javassist/lib/javassist.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/retrotranslator-transformer.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/pluggable-instrumentor.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/serialization/lib/jboss-serialization.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/remoting/lib/jboss-remoting.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/xercesImpl.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop-jdk50-client.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-logging/lib/commons-logging.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/dom4j/lib/dom4j.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-archive-browsing.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/resolver.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-log4j/lib/snmpTrapAppender.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-xerces/lib/xml-apis.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/namespace.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/sun-javacc/lib/javacc.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/backport-util-concurrent.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/common-softvaluehashmap.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aspect-jdk50-client.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/junit/lib/junit.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-common-client.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/apache-log4j/lib/log4j.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/trove/lib/trove.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jdk14-pluggable-instrumentor.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/retrotranslator/lib/retrotranslator-runtime.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jrockit-pluggable-instrumentor.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/oswego-concurrent/lib/concurrent.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/hsqldb/lib/hsqldb.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/common/lib/jboss-common.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/jboss-jca.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/jboss-common-jdbc-wrapper.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/jms-ra.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/jboss-mbeans.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/mysql-connector-java-3.1.13-bin.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/tests/lib/jboss-local-jdbc.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-junit.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jai.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-starteam.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/xml-apis.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-commons-logging.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jmf.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-antlr.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jsch.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-trax.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-netrexx.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-vaj.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-commons-net.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-weblogic.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-regexp.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-bsf.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/junit.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-swing.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-nodeps.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-stylebook.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-oro.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-xalan1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-icontract.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-javamail.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-jdepend.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-log4j.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-bcel.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-xslp.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-launcher.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/xercesImpl.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../apache-ant-1.6.5/lib/ant-apache-resolver.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntryProperties />
+  </component>
+  <component name="VcsManagerConfiguration">
+    <option name="ACTIVE_VCS_NAME" value="svn" />
+    <option name="USE_PROJECT_VCS" value="false" />
+  </component>
+</module>
+

Modified: branches/Branch_Client_Failover_Experiment/messaging.ipr
===================================================================
--- branches/Branch_Client_Failover_Experiment/messaging.ipr	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/messaging.ipr	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,293 +1,293 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="true">
-  <component name="AntConfiguration">
-    <defaultAnt bundledAnt="true" />
-    <buildFile url="file://$PROJECT_DIR$/tests/build.xml">
-      <additionalClassPath>
-        <entry path="file://$PROJECT_DIR$/thirdparty/junit/lib/junit.jar" />
-      </additionalClassPath>
-      <antReference projectDefault="true" />
-      <customJdkName value="" />
-      <maximumHeapSize value="128" />
-      <properties />
-    </buildFile>
-  </component>
-  <component name="BuildJarProjectSettings">
-    <option name="BUILD_JARS_ON_MAKE" value="false" />
-  </component>
-  <component name="CodeStyleProjectProfileManger">
-    <option name="PROJECT_PROFILE" />
-    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
-  </component>
-  <component name="CodeStyleSettingsManager">
-    <option name="PER_PROJECT_SETTINGS" />
-    <option name="USE_PER_PROJECT_SETTINGS" value="false" />
-  </component>
-  <component name="CompilerConfiguration">
-    <option name="DEFAULT_COMPILER" value="Javac" />
-    <option name="DEPLOY_AFTER_MAKE" value="0" />
-    <resourceExtensions>
-      <entry name=".+\.(properties|xml|html|dtd|tld)" />
-      <entry name=".+\.(gif|png|jpeg|jpg)" />
-    </resourceExtensions>
-    <wildcardResourcePatterns>
-      <entry name="?*.properties" />
-      <entry name="?*.xml" />
-      <entry name="?*.gif" />
-      <entry name="?*.png" />
-      <entry name="?*.jpeg" />
-      <entry name="?*.jpg" />
-      <entry name="?*.html" />
-      <entry name="?*.dtd" />
-      <entry name="?*.tld" />
-    </wildcardResourcePatterns>
-  </component>
-  <component name="DataSourceManagerImpl" />
-  <component name="DependenciesAnalyzeManager">
-    <option name="myForwardDirection" value="false" />
-  </component>
-  <component name="DependencyValidationManager" />
-  <component name="EclipseCompilerSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="true" />
-    <option name="DEPRECATION" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="EclipseEmbeddedCompilerSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="true" />
-    <option name="DEPRECATION" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="EntryPointsManager">
-    <entry_points />
-  </component>
-  <component name="ExportToHTMLSettings">
-    <option name="PRINT_LINE_NUMBERS" value="false" />
-    <option name="OPEN_IN_BROWSER" value="false" />
-    <option name="OUTPUT_DIRECTORY" />
-  </component>
-  <component name="GUI Designer component loader factory" />
-  <component name="IdProvider" IDEtalkID="598BFEB0C246A693943DB46D674F660C" />
-  <component name="InspectionProjectProfileManager">
-    <option name="PROJECT_PROFILE" value="Project Default" />
-    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
-    <scopes />
-    <profiles>
-      <profile version="1.0" is_locked="false">
-        <option name="myName" value="Project Default" />
-        <option name="myLocal" value="false" />
-        <used_levels>
-          <error>
-            <option name="myName" value="ERROR" />
-            <option name="myVal" value="400" />
-          </error>
-          <warning>
-            <option name="myName" value="WARNING" />
-            <option name="myVal" value="300" />
-          </warning>
-          <information>
-            <option name="myName" value="INFO" />
-            <option name="myVal" value="200" />
-          </information>
-          <server>
-            <option name="myName" value="SERVER PROBLEM" />
-            <option name="myVal" value="100" />
-          </server>
-        </used_levels>
-      </profile>
-    </profiles>
-  </component>
-  <component name="JavacSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="DEPRECATION" value="true" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="JavadocGenerationManager">
-    <option name="OUTPUT_DIRECTORY" />
-    <option name="OPTION_SCOPE" value="protected" />
-    <option name="OPTION_HIERARCHY" value="true" />
-    <option name="OPTION_NAVIGATOR" value="true" />
-    <option name="OPTION_INDEX" value="true" />
-    <option name="OPTION_SEPARATE_INDEX" value="true" />
-    <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
-    <option name="OPTION_DEPRECATED_LIST" value="true" />
-    <option name="OTHER_OPTIONS" value="" />
-    <option name="HEAP_SIZE" />
-    <option name="LOCALE" />
-    <option name="OPEN_IN_BROWSER" value="true" />
-  </component>
-  <component name="JikesSettings">
-    <option name="JIKES_PATH" value="" />
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="DEPRECATION" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="IS_EMACS_ERRORS_MODE" value="true" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-  </component>
-  <component name="LogConsolePreferences">
-    <option name="FILTER_ERRORS" value="false" />
-    <option name="FILTER_WARNINGS" value="false" />
-    <option name="FILTER_INFO" value="true" />
-    <option name="CUSTOM_FILTER" />
-  </component>
-  <component name="Palette2">
-    <group name="Swing">
-      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
-      </item>
-      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
-        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
-        <initial-values>
-          <property name="text" value="Button" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="RadioButton" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="CheckBox" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="Label" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
-          <preferred-size width="-1" height="20" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
-      </item>
-    </group>
-  </component>
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/messaging.iml" filepath="$PROJECT_DIR$/messaging.iml" />
-    </modules>
-  </component>
-  <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" />
-  <component name="ProjectRunConfigurationManager" />
-  <component name="RmicSettings">
-    <option name="IS_EANABLED" value="false" />
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="GENERATE_IIOP_STUBS" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-  </component>
-  <component name="StarteamVcsAdapter" />
-  <component name="VssVcs" />
-  <component name="com.intellij.jsf.UserDefinedFacesConfigs">
-    <option name="USER_DEFINED_CONFIGS">
-      <value>
-        <list size="0" />
-      </value>
-    </option>
-  </component>
-  <component name="libraryTable" />
-  <component name="uidesigner-configuration">
-    <option name="INSTRUMENT_CLASSES" value="true" />
-    <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
-    <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
-  </component>
-  <UsedPathMacros />
-</project>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4" relativePaths="true">
+  <component name="AntConfiguration">
+    <defaultAnt bundledAnt="true" />
+    <buildFile url="file://$PROJECT_DIR$/tests/build.xml">
+      <additionalClassPath>
+        <entry path="file://$PROJECT_DIR$/thirdparty/junit/lib/junit.jar" />
+      </additionalClassPath>
+      <antReference projectDefault="true" />
+      <customJdkName value="" />
+      <maximumHeapSize value="128" />
+      <properties />
+    </buildFile>
+  </component>
+  <component name="BuildJarProjectSettings">
+    <option name="BUILD_JARS_ON_MAKE" value="false" />
+  </component>
+  <component name="CodeStyleProjectProfileManger">
+    <option name="PROJECT_PROFILE" />
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+  </component>
+  <component name="CodeStyleSettingsManager">
+    <option name="PER_PROJECT_SETTINGS" />
+    <option name="USE_PER_PROJECT_SETTINGS" value="false" />
+  </component>
+  <component name="CompilerConfiguration">
+    <option name="DEFAULT_COMPILER" value="Javac" />
+    <option name="DEPLOY_AFTER_MAKE" value="0" />
+    <resourceExtensions>
+      <entry name=".+\.(properties|xml|html|dtd|tld)" />
+      <entry name=".+\.(gif|png|jpeg|jpg)" />
+    </resourceExtensions>
+    <wildcardResourcePatterns>
+      <entry name="?*.properties" />
+      <entry name="?*.xml" />
+      <entry name="?*.gif" />
+      <entry name="?*.png" />
+      <entry name="?*.jpeg" />
+      <entry name="?*.jpg" />
+      <entry name="?*.html" />
+      <entry name="?*.dtd" />
+      <entry name="?*.tld" />
+    </wildcardResourcePatterns>
+  </component>
+  <component name="DataSourceManagerImpl" />
+  <component name="DependenciesAnalyzeManager">
+    <option name="myForwardDirection" value="false" />
+  </component>
+  <component name="DependencyValidationManager" />
+  <component name="EclipseCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="true" />
+    <option name="DEPRECATION" value="false" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+    <option name="MAXIMUM_HEAP_SIZE" value="128" />
+  </component>
+  <component name="EclipseEmbeddedCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="true" />
+    <option name="DEPRECATION" value="false" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+    <option name="MAXIMUM_HEAP_SIZE" value="128" />
+  </component>
+  <component name="EntryPointsManager">
+    <entry_points />
+  </component>
+  <component name="ExportToHTMLSettings">
+    <option name="PRINT_LINE_NUMBERS" value="false" />
+    <option name="OPEN_IN_BROWSER" value="false" />
+    <option name="OUTPUT_DIRECTORY" />
+  </component>
+  <component name="GUI Designer component loader factory" />
+  <component name="IdProvider" IDEtalkID="598BFEB0C246A693943DB46D674F660C" />
+  <component name="InspectionProjectProfileManager">
+    <option name="PROJECT_PROFILE" value="Project Default" />
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+    <scopes />
+    <profiles>
+      <profile version="1.0" is_locked="false">
+        <option name="myName" value="Project Default" />
+        <option name="myLocal" value="false" />
+        <used_levels>
+          <error>
+            <option name="myName" value="ERROR" />
+            <option name="myVal" value="400" />
+          </error>
+          <warning>
+            <option name="myName" value="WARNING" />
+            <option name="myVal" value="300" />
+          </warning>
+          <information>
+            <option name="myName" value="INFO" />
+            <option name="myVal" value="200" />
+          </information>
+          <server>
+            <option name="myName" value="SERVER PROBLEM" />
+            <option name="myVal" value="100" />
+          </server>
+        </used_levels>
+      </profile>
+    </profiles>
+  </component>
+  <component name="JavacSettings">
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="false" />
+    <option name="DEPRECATION" value="true" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+    <option name="MAXIMUM_HEAP_SIZE" value="128" />
+  </component>
+  <component name="JavadocGenerationManager">
+    <option name="OUTPUT_DIRECTORY" />
+    <option name="OPTION_SCOPE" value="protected" />
+    <option name="OPTION_HIERARCHY" value="true" />
+    <option name="OPTION_NAVIGATOR" value="true" />
+    <option name="OPTION_INDEX" value="true" />
+    <option name="OPTION_SEPARATE_INDEX" value="true" />
+    <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+    <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+    <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+    <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+    <option name="OPTION_DEPRECATED_LIST" value="true" />
+    <option name="OTHER_OPTIONS" value="" />
+    <option name="HEAP_SIZE" />
+    <option name="LOCALE" />
+    <option name="OPEN_IN_BROWSER" value="true" />
+  </component>
+  <component name="JikesSettings">
+    <option name="JIKES_PATH" value="" />
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="DEPRECATION" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="false" />
+    <option name="IS_EMACS_ERRORS_MODE" value="true" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+  </component>
+  <component name="LogConsolePreferences">
+    <option name="FILTER_ERRORS" value="false" />
+    <option name="FILTER_WARNINGS" value="false" />
+    <option name="FILTER_INFO" value="true" />
+    <option name="CUSTOM_FILTER" />
+  </component>
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/messaging.iml" filepath="$PROJECT_DIR$/messaging.iml" />
+    </modules>
+  </component>
+  <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" />
+  <component name="ProjectRunConfigurationManager" />
+  <component name="RmicSettings">
+    <option name="IS_EANABLED" value="false" />
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="false" />
+    <option name="GENERATE_IIOP_STUBS" value="false" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+  </component>
+  <component name="StarteamVcsAdapter" />
+  <component name="VssVcs" />
+  <component name="com.intellij.jsf.UserDefinedFacesConfigs">
+    <option name="USER_DEFINED_CONFIGS">
+      <value>
+        <list size="0" />
+      </value>
+    </option>
+  </component>
+  <component name="libraryTable" />
+  <component name="uidesigner-configuration">
+    <option name="INSTRUMENT_CLASSES" value="true" />
+    <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
+    <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
+  </component>
+  <UsedPathMacros />
+</project>
+

Modified: branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -122,7 +122,7 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->preDeliver(..))">
       <advice name="handlePreDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
-   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver())">
+   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver(..))">
       <advice name="handlePostDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->acknowledgeAll(..))">

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/jms-ds.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/jms-ds.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/jms-ds.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -8,7 +8,7 @@
 
   <!-- The JMS provider loader -->
    <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
-          name="jboss.mq:service=JMSProviderLoader,name=JMSProvider">
+          name="jboss.messaging:service=JMSProviderLoader,name=JMSProvider">
       <attribute name="ProviderName">DefaultJMSProvider</attribute>
       <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
       <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/messaging-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/messaging-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/messaging-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -33,6 +33,8 @@
             <role name="guest" read="true" write="true" create="true"/>
         </security>
       </attribute>
+      <attribute name="MaxDeliveryAttempts">10</attribute>
+      <attribute name="DLQName">DLQ</attribute>
    </mbean>
 
 </server>
\ No newline at end of file

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -38,6 +38,7 @@
 UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
 SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
 DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+UPDATE_DELIVERYCOUNT=UPDATE JMS_MESSAGE_REFERENCE SET DELIVERYCOUNT = ? WHERE CHANNELID = ? AND MESSAGEID = ?
 CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, COREHEADERS IMAGE, PAYLOAD IMAGE, CHANNELCOUNT INTEGER, TYPE TINYINT, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES IMAGE, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES IMAGE, PRIMARY KEY (MESSAGEID))
 LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
 INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/oracle-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/oracle-persistence-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/oracle-persistence-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -38,6 +38,7 @@
 UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?   
 SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'             
 DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+UPDATE_DELIVERYCOUNT=UPDATE JMS_MESSAGE_REFERENCE SET DELIVERYCOUNT = ? WHERE CHANNELID = ? AND MESSAGEID = ?
 CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID INTEGER, RELIABLE CHAR(1), EXPIRATION INTEGER, TIMESTAMP INTEGER, PRIORITY INTEGER, COREHEADERS BLOB, PAYLOAD BLOB, CHANNELCOUNT INTEGER, TYPE INTEGER, JMSTYPE VARCHAR2(255), CORRELATIONID VARCHAR2(255), CORRELATIONID_BYTES RAW(254), DESTINATION_ID INTEGER, REPLYTO_ID INTEGER, JMSPROPERTIES BLOB, PRIMARY KEY (MESSAGEID))
 LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
 INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/postgresql-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/postgresql-persistence-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/postgresql-persistence-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -38,6 +38,7 @@
 UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
 SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
 DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+UPDATE_DELIVERYCOUNT=UPDATE JMS_MESSAGE_REFERENCE SET DELIVERYCOUNT = ? WHERE CHANNELID = ? AND MESSAGEID = ?
 CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY int2, COREHEADERS BYTEA, PAYLOAD BYTEA, CHANNELCOUNT INTEGER, TYPE int2, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES BYTEA, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES BYTEA, PRIMARY KEY (MESSAGEID))
 LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
 INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/remoting-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/remoting-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/remoting-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -24,6 +24,9 @@
                <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
                <attribute name="serverBindPort">4457</attribute>
                <attribute name="leasePeriod">20000</attribute>
+               <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
             </invoker>
             <handlers>
                <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
@@ -33,6 +36,37 @@
       <depends>jboss.messaging:service=NetworkRegistry</depends>
    </mbean>
 
+   <!--
+        HTTP Connector example
+   -->
+   <!--
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.messaging:service=Connector,transport=http"
+          display-name="HTTP transport Connector">
+      <attribute name="Configuration">
+         <config>
+            <invoker transport="http">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+               <!== Serialization type must be jms - do not change! ==>
+               <attribute name="serializationtype" isParam="true">jms</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4458</attribute>
+               <attribute name="leasePeriod">20000</attribute>
+               <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
+               <attribute name="callbackPollPeriod" isParam="true">100</attribute>
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+      </attribute>
+      <depends>jboss.messaging:service=NetworkRegistry</depends>
+   </mbean>
+   -->
+
+
    <!-- TODO: Do I need this> -->
    <mbean code="org.jboss.remoting.network.NetworkRegistry"
           name="jboss.messaging:service=NetworkRegistry"/>

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/sybase-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/sybase-persistence-service.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/sybase-persistence-service.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -47,6 +47,7 @@
 UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
 SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
 DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+UPDATE_DELIVERYCOUNT=UPDATE JMS_MESSAGE_REFERENCE SET DELIVERYCOUNT = ? WHERE CHANNELID = ? AND MESSAGEID = ?
 CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID INTEGER, RELIABLE CHAR(1) NULL, EXPIRATION INTEGER NULL, TIMESTAMP NUMERIC(20,0) NULL, PRIORITY INTEGER NULL, COREHEADERS IMAGE NULL, PAYLOAD IMAGE NULL, CHANNELCOUNT INTEGER NULL, TYPE INTEGER NULL, JMSTYPE VARCHAR(255) NULL, CORRELATIONID VARCHAR(255) NULL, CORRELATIONID_BYTES VARBINARY(254) NULL, DESTINATION_ID INTEGER NULL, REPLYTO_ID INTEGER NULL, JMSPROPERTIES IMAGE NULL, PRIMARY KEY (MESSAGEID))
 LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
 INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Modified: branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/ServerPeer-xmbean.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/ServerPeer-xmbean.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/ServerPeer-xmbean.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -139,6 +139,18 @@
       <name>QueuedExecutorPoolSize</name>
       <type>int</type>
    </attribute>
+   
+   <attribute access="read-write" getMethod="getMaxDeliveryAttempts" setMethod="setMaxDeliveryAttempts">
+      <description>The maximum delivery attempts for destinations</description>
+      <name>MaxDeliveryAttempts</name>
+      <type>int</type>
+   </attribute>  
+   
+   <attribute access="read-write" getMethod="getDLQName" setMethod="setDLQName">
+      <description>The JNDI name of the DLQ</description>
+      <name>DLQName</name>
+      <type>java.lang.String</type>
+   </attribute>     
 
    <!-- Managed operations -->
 

Modified: branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/Topic-xmbean.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/Topic-xmbean.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/etc/xmdesc/Topic-xmbean.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -87,7 +87,7 @@
       <name>DownCacheSize</name>
       <type>int</type>
    </attribute>
-   
+
    <attribute access="read-write" getMethod="isClustered" setMethod="setClustered">
       <description>Is this a clustered destination?</description>
       <name>Clustered</name>

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -102,6 +102,8 @@
    
    protected Object closeLock = new Object();      
    
+   protected int maxDeliveries;
+   
    // Static --------------------------------------------------------
    
    // Constructors --------------------------------------------------
@@ -151,6 +153,8 @@
       ConsumerState state = (ConsumerState)((DelegateSupport)cons).getState();
 
       this.consumerID = state.getConsumerID();      
+      
+      this.maxDeliveries = state.getMaxDeliveries();
 
       id = threadId.increment();
       internalThread = new Thread(this, "Connection Consumer for dest " + destination + " id=" + id);
@@ -298,7 +302,7 @@
                for (int i = 0; i < mesList.size(); i++)
                {
                   MessageProxy m = (MessageProxy)mesList.get(i);
-                  session.addAsfMessage(m, consumerID, cons);
+                  session.addAsfMessage(m, consumerID, cons, maxDeliveries);
                   if (trace) { log.trace("added " + m + " to session"); }
                }
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossSession.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossSession.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/JBossSession.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -502,9 +502,9 @@
     * This method is used by the JBossConnectionConsumer to load up the session
     * with messages to be processed by the session's run() method
     */
-   void addAsfMessage(MessageProxy m, int consumerID, ConsumerDelegate cons)
+   void addAsfMessage(MessageProxy m, int consumerID, ConsumerDelegate cons, int maxDeliveries)
    {
-      delegate.addAsfMessage(m, consumerID, cons);
+      delegate.addAsfMessage(m, consumerID, cons, maxDeliveries);
    }
       
    // Protected -----------------------------------------------------

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/AsfAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/AsfAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/AsfAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -130,6 +130,7 @@
       MessageProxy m = (MessageProxy)mi.getArguments()[0];
       int theConsumerID = ((Integer)mi.getArguments()[1]).intValue();
       ConsumerDelegate cons = (ConsumerDelegate)mi.getArguments()[2];
+      int maxDeliveries = ((Integer)mi.getArguments()[3]).intValue();
       
       if (m == null)
       {
@@ -140,6 +141,7 @@
       holder.msg = m;
       holder.consumerID = theConsumerID;
       holder.consumerDelegate = cons;
+      holder.maxDeliveries = maxDeliveries;
       
       msgs.add(holder);
 
@@ -163,7 +165,7 @@
          if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
          
          MessageCallbackHandler.callOnMessage(del, sessionListener, holder.consumerID, false,
-                                              holder.msg, ackMode);                          
+                                              holder.msg, ackMode, holder.maxDeliveries);                          
       }
       
       return null;
@@ -187,5 +189,6 @@
       MessageProxy msg;
       int consumerID;
       ConsumerDelegate consumerDelegate;
+      int maxDeliveries;
    }
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -76,11 +76,12 @@
       int consumerID = consumerState.getConsumerID();
       int prefetchSize = consumerState.getPrefetchSize();
       QueuedExecutor sessionExecutor = sessionState.getExecutor();
+      int maxDeliveries = consumerState.getMaxDeliveries();
       
       MessageCallbackHandler messageHandler =
          new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
                                     sessionDelegate, consumerDelegate, consumerID,
-                                    prefetchSize, sessionExecutor);
+                                    prefetchSize, sessionExecutor, maxDeliveries);
       
       sessionState.addCallbackHandler(messageHandler);
       

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/SessionAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/SessionAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -21,14 +21,13 @@
   */
 package org.jboss.jms.client.container;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
 
 import javax.jms.IllegalStateException;
 import javax.jms.Session;
-import javax.jms.JMSException;
 
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
@@ -69,10 +68,45 @@
 
    public Object handleClosing(Invocation invocation) throws Throwable
    {
-      // Send to the server all acknowledgments accumulated in toAck. This is useful, for example,
-      // when a message listener close the session from its onMessage().
-      acknowledgeOnClosing(invocation);
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
+      
+      int ackMode = state.getAcknowledgeMode();
 
+      // select eligible acknowledgments
+      List acks = new ArrayList();
+      List cancels = new ArrayList();
+      for(Iterator i = state.getToAck().iterator(); i.hasNext(); )
+      {
+         AckInfo ack = (AckInfo)i.next();
+         if (ackMode == Session.AUTO_ACKNOWLEDGE ||
+             ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+         {
+            acks.add(ack);            
+         }
+         else
+         {
+            cancels.add(ack);
+         }
+         i.remove();
+      }
+      
+      // On closing we acknowlege any AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE, since the session
+      // might have closed before the onMessage had finished executing.
+      // We cancel any client ack or transactional, we do this explicitly so we can pass the updated
+      // delivery count information from client to server. We could just do this on the server but
+      // we would lose delivery count info.
+
+      if (!acks.isEmpty())
+      {
+         del.acknowledgeBatch(acks);
+      }
+      if (!cancels.isEmpty())
+      {
+         del.cancelDeliveries(cancels);
+      }
+
       return invocation.invokeNext();
    }
 
@@ -111,7 +145,7 @@
          Object[] args = mi.getArguments();
          MessageProxy mp = (MessageProxy)args[0];
          int consumerID = ((Integer)args[1]).intValue();
-         AckInfo info = new AckInfo(mp, consumerID, ackMode);
+         AckInfo info = new AckInfo(mp, consumerID);
          
          state.getToAck().add(info);
          
@@ -144,6 +178,13 @@
       
       int ackMode = state.getAcknowledgeMode();
       
+      boolean cancel = ((Boolean)mi.getArguments()[0]).booleanValue();
+      
+      if (cancel && ackMode != Session.AUTO_ACKNOWLEDGE && ackMode != Session.DUPS_OK_ACKNOWLEDGE)
+      {
+         throw new IllegalStateException("Ack mode must be AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE");
+      }
+      
       if (ackMode == Session.AUTO_ACKNOWLEDGE ||
           ackMode == Session.DUPS_OK_ACKNOWLEDGE ||
           ackMode != Session.CLIENT_ACKNOWLEDGE && state.getCurrentTxId() == null)
@@ -156,10 +197,26 @@
          if (!state.isRecoverCalled())
          {
             if (trace) { log.trace("acknowledging NON-transactionally"); }
-
+                        
             List acks = state.getToAck();
+            
+            // Sanity check
+            if (acks.size() != 1)
+            {
+               throw new IllegalStateException("Should only be one entry in list. " +
+                                               "There are " + acks.size());
+            }
+            
             AckInfo ack = (AckInfo)acks.get(0);
-            sd.acknowledge(ack);
+            
+            if (cancel)
+            {
+               sd.cancelDeliveries(acks);
+            }
+            else
+            {
+               sd.acknowledge(ack);
+            }
             state.getToAck().clear();
          }
          else
@@ -246,13 +303,8 @@
       for (int i = toRedeliver.size() - 1; i >= 0; i--)
       {
          AckInfo info = (AckInfo)toRedeliver.get(i);
-         MessageProxy proxy = info.getMessage();
-         proxy.setJMSRedelivered(true);
+         MessageProxy proxy = info.getMessage();        
          
-         //TODO delivery count although optional should be global so we need to send it back to the
-         //     server but this has performance hit so perhaps we just don't support it?
-         proxy.incDeliveryCount();
-         
          MessageCallbackHandler handler = state.getCallbackHandler(info.getConsumerID());
               
          if (handler == null)
@@ -307,35 +359,6 @@
       return (SessionState)((DelegateSupport)inv.getTargetObject()).getState();
    }
 
-   /**
-    * The method sends to server all eligible acknowlegments (those that are NOT CLIIENT_ACKNOWLEDGE
-    * for example)
-    */
-   private void acknowledgeOnClosing(Invocation invocation) throws JMSException
-   {
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
-
-      // select eligible acknowledgments
-      List acks = new ArrayList();
-      for(Iterator i = state.getToAck().iterator(); i.hasNext(); )
-      {
-         AckInfo ack = (AckInfo)i.next();
-         if (ack.getAckMode() == Session.AUTO_ACKNOWLEDGE ||
-             ack.getAckMode() == Session.DUPS_OK_ACKNOWLEDGE)
-         {
-            acks.add(ack);
-            i.remove();
-         }
-      }
-
-      if (!acks.isEmpty())
-      {
-         del.acknowledgeBatch(acks);
-      }
-   }
-    
    // Inner Classes -------------------------------------------------
    
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -172,10 +172,14 @@
       int prefetchSize =
          ((Integer)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.PREFETCH_SIZE)).intValue();
       
+      int maxDeliveries = 
+         ((Integer)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.MAX_DELIVERIES)).intValue();
+      
       ConsumerState consumerState =
-         new ConsumerState(sessionState, consumerDelegate, dest, selector,
-                           noLocal,subscriptionName, consumerID, connectionConsumer, prefetchSize);
-      
+         new ConsumerState(sessionState, consumerDelegate, dest, selector, noLocal,
+                           subscriptionName, consumerID, connectionConsumer, prefetchSize,
+                           maxDeliveries);
+
       delegate.setState(consumerState);
       return consumerDelegate;
    }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/TransactionAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/TransactionAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/TransactionAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -24,7 +24,6 @@
 import javax.jms.IllegalStateException;
 import javax.jms.Message;
 import javax.jms.TransactionInProgressException;
-import javax.jms.Session;
 
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
@@ -190,7 +189,7 @@
          MethodInvocation mi = (MethodInvocation)invocation;
          MessageProxy proxy = (MessageProxy)mi.getArguments()[0];
          int consumerID = ((Integer)mi.getArguments()[1]).intValue();
-         AckInfo info = new AckInfo(proxy, consumerID, Session.SESSION_TRANSACTED);
+         AckInfo info = new AckInfo(proxy, consumerID);
          ConnectionState connState = (ConnectionState)state.getParent();
 
          if (trace) { log.trace("sending acknowlegment transactionally, queueing on resource manager"); }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -30,6 +30,7 @@
 
 import org.jboss.aop.util.PayloadKey;
 import org.jboss.jms.client.JBossConnectionConsumer;
+import org.jboss.jms.client.remoting.JMSRemotingConnection;
 import org.jboss.jms.client.state.ConnectionState;
 import org.jboss.jms.delegate.ConnectionDelegate;
 import org.jboss.jms.delegate.SessionDelegate;
@@ -58,6 +59,8 @@
 
    // This should not be exposed other than through meta data
    private int serverId;
+
+   private transient JMSRemotingConnection remotingConnection;
    
    // Static --------------------------------------------------------
 
@@ -216,7 +219,7 @@
    {
       return "ConnectionDelegate[" + id + "]";
    }
-   
+
    public void init()
    {
       super.init();
@@ -224,6 +227,16 @@
                                 new Integer(serverId), PayloadKey.TRANSIENT);
    }
 
+   public void setRemotingConnection(JMSRemotingConnection conn)
+   {
+      this.remotingConnection = conn;
+   }
+
+   public JMSRemotingConnection getRemotingConnection()
+   {
+      return remotingConnection;
+   }
+
    // Protected -----------------------------------------------------
 
    protected Client getClient()

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -201,8 +201,6 @@
       }
       else
       {
-         //getClientAOPConfig or getIDBlock
-
          // Create a client - make sure pinging is off
 
          Map configuration = new HashMap();
@@ -251,7 +249,16 @@
 
          throw t;
       }
+      finally
+      {
+         if (remotingConnection == null)
+         {
+            //Not a call to createConnectionDelegate - disconnect the client
 
+            //client.disconnect();
+         }
+      }
+
       Object ret = response.getLoad();
 
       if (remotingConnection != null)
@@ -274,6 +281,8 @@
    
             metaData.addMetaData(MetaDataConstants.JMS, MetaDataConstants.CONNECTION_VERSION,
                                  version, PayloadKey.TRANSIENT);
+
+            connectionDelegate.setRemotingConnection(remotingConnection);
          }
          else
          {

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -52,6 +52,7 @@
    
    // This should not be exposed other than through meta data
    private int bufferSize;
+   protected int maxDeliveries;
 
    // This should not be exposed other than through meta data
    private long channelId;
@@ -60,11 +61,12 @@
 
    // Constructors --------------------------------------------------
 
-   public ClientConsumerDelegate(int objectID, long channelId, int bufferSize)
+   public ClientConsumerDelegate(int objectID, long channelId, int bufferSize, int maxDeliveries)
    {
       super(objectID);
       this.bufferSize = bufferSize;
       this.channelId = channelId;
+      this.maxDeliveries = maxDeliveries;
    }
    
    public ClientConsumerDelegate()
@@ -168,6 +170,16 @@
       throw new IllegalStateException("This invocation should not be handled here!");
    }
 
+   /**
+    * This invocation should either be handled by the client-side interceptor chain or by the
+    * server-side endpoint.
+    */
+   public void confirmDelivery(int count)
+   {
+      throw new IllegalStateException("This invocation should not be handled here!");
+   }
+
+
    // Public --------------------------------------------------------
 
    public void init()
@@ -177,6 +189,8 @@
                                 new Integer(id), PayloadKey.TRANSIENT);
       getMetaData().addMetaData(MetaDataConstants.JMS, MetaDataConstants.PREFETCH_SIZE,
                                 new Integer(bufferSize), PayloadKey.TRANSIENT);
+      getMetaData().addMetaData(MetaDataConstants.JMS, MetaDataConstants.MAX_DELIVERIES,
+                                new Integer(maxDeliveries), PayloadKey.TRANSIENT);
    }
 
    public String toString()

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -317,7 +317,7 @@
     * This invocation should either be handled by the client-side interceptor chain or by the
     * server-side endpoint.
     */
-   public void postDeliver() throws JMSException
+   public void postDeliver(boolean cancel) throws JMSException
    {
       throw new IllegalStateException("This invocation should not be handled here!");
    }
@@ -417,7 +417,8 @@
     * This invocation should either be handled by the client-side interceptor chain or by the
     * server-side endpoint.
     */
-   public void addAsfMessage(MessageProxy m, int consumerID, ConsumerDelegate cons)
+   public void addAsfMessage(MessageProxy m, int consumerID,
+                             ConsumerDelegate cons, int maxDeliveries)
    {
       throw new IllegalStateException("This invocation should not be handled here!");
    }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -38,7 +38,7 @@
 
 /**
  * Base class for all client-side delegate classes.
- * 
+ *
  * Client-side delegate classes provide an empty implementation of the appropriate delegate
  * interface. The classes are advised using JBoss AOP to provide the client side advice stack.
  * The methods in the delegate class will never actually be invoked since they will either be
@@ -47,7 +47,7 @@
  * The delegates are created on the server and serialized back to the client. When they arrive on
  * the client, the init() method is called which causes the advices to be bound to the advised
  * class.
- * 
+ *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  *
@@ -69,25 +69,25 @@
 
    //This is set on the server
    protected int id;
-   
+
    //This is set on the client
    //The reason we don't use the meta-data to store the state for the delegate is to avoid
    //the extra HashMap lookup that would entail.
    //This can be significant since the state could be queried for many aspects
    //in an a single invocation
    protected transient HierarchicalState state;
-   
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
 
    public DelegateSupport(int objectID)
    {
-      this.id = objectID;    
+      this.id = objectID;
    }
-   
+
    public DelegateSupport()
-   {      
+   {
    }
 
    // Interceptor implementation ------------------------------------
@@ -109,7 +109,7 @@
                                            Dispatcher.OID,
                                            new Integer(id),
                                            PayloadKey.AS_IS);
-      
+
       byte version = getState().getVersionToUse().getProviderIncrementingVersion();
 
       MessagingMarshallable request = new MessagingMarshallable(version, invocation);
@@ -126,17 +126,17 @@
    {
       return state;
    }
-   
+
    public void setState(HierarchicalState state)
    {
       this.state = state;
    }
-   
+
    /**
     *  Add Invoking interceptor and prepare the stack for invocations.
     */
    public void init()
-   {          
+   {
       ((Advised)this)._getInstanceAdvisor().appendInterceptor(this);
 
       checkMarshallers();
@@ -165,7 +165,7 @@
    {
       return ((Advised)this)._getInstanceAdvisor().getMetaData();
    }
-   
+
    protected abstract Client getClient() throws Exception;
 
 
@@ -183,21 +183,7 @@
       {
          return;
       }
-      
-      //We explicitly associate the datatype "jms" with our custom SerializationManager
-      //This is vital for performance reasons.
-      try
-      {
-//         SerializationStreamFactory.setManagerClassName(
-//            "jms", "org.jboss.remoting.serialization.impl.jboss.JBossSerializationManager");
-         SerializationStreamFactory.setManagerClassName(
-                  "jms", "org.jboss.jms.server.remoting.MessagingSerializationManager");
-      }
-      catch (Exception e)
-      {
-         log.error("Failed to set SerializationManager, e");
-      }
-      
+
       checked = true;
    }
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackManager.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackManager.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -24,13 +24,11 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.management.MBeanServer;
-
 import org.jboss.jms.server.endpoint.ClientDelivery;
 import org.jboss.jms.server.remoting.MessagingMarshallable;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
 import org.jboss.remoting.callback.InvokerCallbackHandler;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
@@ -39,85 +37,92 @@
  * 
  * A CallbackManager.
  * 
- * The CallbackManager is an InvocationHandler used for handling callbacks to message consumers
- * The callback is received and dispatched off to the relevant consumer
+ * The CallbackManager is an InvocationHandler used for handling callbacks to message consumers.
+ * The callback is received and dispatched off to the relevant consumer.
  * 
  * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @version 1.1
  *
  * CallbackManager.java,v 1.1 2006/02/01 17:38:30 timfox Exp
  */
-public class CallbackManager implements ServerInvocationHandler
+public class CallbackManager implements InvokerCallbackHandler
 {
+   // Constants -----------------------------------------------------
+
+   protected static final Logger log = Logger.getLogger(CallbackManager.class);
+
+   public static final String JMS_CALLBACK_SUBSYSTEM = "CALLBACK";
+
+   // Static --------------------------------------------------------
+
+   protected static CallbackManager theManager;
+
+   // Attributes ----------------------------------------------------
+
+   // Map<Long(lookup)-MessageCallbackHandler>
    protected Map callbackHandlers;
 
+   // Constructors --------------------------------------------------
+
    public CallbackManager()
    {
       callbackHandlers = new ConcurrentReaderHashMap();
    }
-   
-   public void registerHandler(int serverId, int consumerId, MessageCallbackHandler handler)
-   {
-      Long lookup = calcLookup(serverId, consumerId);
-      
-      callbackHandlers.put(lookup, handler);
-   }
-   
-   public MessageCallbackHandler unregisterHandler(int serverId, int consumerId)
-   {
-      Long lookup = calcLookup(serverId, consumerId);
-      
-      return (MessageCallbackHandler)callbackHandlers.remove(lookup);
-   }
-   
-   private Long calcLookup(int serverId, int consumerId)
-   {
-      long id1 = serverId;
-      
-      id1 <<= 32;
-       
-      long id2 = consumerId;
-      
-      long lookup = id1 | id2;
-      
-      return new Long(lookup);
-   }
-   
-   public void addListener(InvokerCallbackHandler arg0)
-   { 
-   }
 
-   public Object invoke(InvocationRequest ir) throws Throwable
+   // InvokerCallbackHandler implementation -------------------------
+
+   public void handleCallback(Callback callback) throws HandleCallbackException
    {
-      MessagingMarshallable mm = (MessagingMarshallable)ir.getParameter();
-      
+      MessagingMarshallable mm = (MessagingMarshallable)callback.getParameter();
       ClientDelivery dr = (ClientDelivery)mm.getLoad();
-        
-      Long lookup = calcLookup(dr.getServerId(), dr.getConsumerId());
-         
+      Long lookup = computeLookup(dr.getServerId(), dr.getConsumerId());
       List msgs = dr.getMessages();
 
-      MessageCallbackHandler handler =
-         (MessageCallbackHandler)callbackHandlers.get(lookup);
-      
+      MessageCallbackHandler handler = (MessageCallbackHandler)callbackHandlers.get(lookup);
+
       if (handler == null)
       {
-         throw new IllegalStateException("Cannot find handler for consumer: " + dr.getConsumerId() +  " and server " + dr.getServerId());
+         throw new IllegalStateException("Cannot find handler for consumer: " + dr.getConsumerId() +
+                                         " and server " + dr.getServerId());
       }
-      
-      return new MessagingMarshallable(mm.getVersion(), handler.handleMessage(msgs));
+
+      handler.handleMessage(msgs);
    }
 
-   public void removeListener(InvokerCallbackHandler arg0)
+   // Public --------------------------------------------------------
+
+   public void registerHandler(int serverID, int consumerID, MessageCallbackHandler handler)
    {
+      Long lookup = computeLookup(serverID, consumerID);
+
+      callbackHandlers.put(lookup, handler);
    }
 
-   public void setInvoker(ServerInvoker arg0)
-   { 
+   public MessageCallbackHandler unregisterHandler(int serverID, int consumerID)
+   {
+      Long lookup = computeLookup(serverID, consumerID);
+
+      return (MessageCallbackHandler)callbackHandlers.remove(lookup);
    }
 
-   public void setMBeanServer(MBeanServer arg0)
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   private Long computeLookup(int serverID, int consumerID)
    {
+      long id1 = serverID;
+
+      id1 <<= 32;
+
+      long lookup = id1 | consumerID;
+
+      return new Long(lookup);
    }
 
+   // Inner classes -------------------------------------------------
+
 }

Deleted: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,256 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * 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.jms.client.remoting;
-
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.jms.util.MessagingJMSException;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.security.SSLSocketBuilder;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-
-/**
- *
- * A CallbackServerFactory.
- *
- * We maintain only one callbackserver per transport per client VM.
- * This is to avoid having too many resources e.g. server sockets in use on the client
- * E.g. in the case of a socket transport, if we had one callbackserver per connection then
- * we would have one server socket listening per connection, so we could run out of available
- * ports with a lot of connections.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version $Revision$
- *
- * $Id$
- */
-public class CallbackServerFactory
-{
-   private static final Logger log = Logger.getLogger(CallbackServerFactory.class);
-
-   private static final String CALLBACK_SERVER_PARAMS =
-      "/?marshaller=org.jboss.jms.server.remoting.JMSWireFormat&" +
-      "unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&" +
-      "dataType=jms&" +
-      "timeout=0&" +
-      "socket.check_connection=false";
-
-   public static final String JMS_CALLBACK_SUBSYSTEM = "CALLBACK";
-
-   public static final String CLIENT_HOST =
-      System.getProperty("jboss.messaging.callback.bind.address");
-   
-   public static final int CLIENT_PORT = getPort();
-   
-   private static int getPort()
-   {
-	   String propertyPort = System.getProperty("jboss.messaging.callback.bind.port");
-	   
-	   try
-	   {
-		   if (propertyPort!=null)
-		   {
-			   return Integer.parseInt(propertyPort);
-		   }
-		   else
-		   {
-			   return -1;
-		   }
-	   }
-	   catch (Exception e)
-	   {
-		   log.warn("Error during parsing jboss.messaging.callback.bind.port", e);
-		   return -1;
-	   }
-	   
-   }
-
-   public static CallbackServerFactory instance = new CallbackServerFactory();
-
-   private Map holders;
-
-   private CallbackServerFactory()
-   {
-      holders = new HashMap();
-   }
-
-   public synchronized boolean containsCallbackServer(String protocol)
-   {
-      return holders.containsKey(protocol);
-   }
-
-   public synchronized Connector getCallbackServer(InvokerLocator serverLocator) throws Exception
-   {
-      String protocol = serverLocator.getProtocol();
-
-      Holder h = (Holder)holders.get(protocol);
-
-      if (h == null)
-      {
-         h = new Holder();
-
-         h.server = startCallbackServer(serverLocator);
-
-         holders.put(protocol, h);
-      }
-      else
-      {
-         h.refCount++;
-      }
-
-      return h.server;
-   }
-
-   public synchronized void stopCallbackServer(String protocol)
-   {
-      Holder h = (Holder)holders.get(protocol);
-
-      if (h == null)
-      {
-         throw new IllegalArgumentException("Cannot find callback server for protocol: " + protocol);
-      }
-
-      h.refCount--;
-
-      if (h.refCount == 0)
-      {
-         stopCallbackServer(h.server);
-
-         holders.remove(protocol);
-      }
-   }
-
-   protected Connector startCallbackServer(InvokerLocator serverLocator) throws Exception
-   {
-      if (log.isTraceEnabled()) { log.trace(this + " setting up connection to " + serverLocator); }
-
-      final int MAX_RETRIES = 50;
-      boolean completed = false;
-      Connector server = null;
-      String serializationType = null;
-      int count = 0;
-
-      String thisAddress = CLIENT_HOST;
-      
-      if (thisAddress==null)
-      {
-    	  thisAddress = InetAddress.getLocalHost().getHostAddress();
-      }
-    	  
-      boolean isSSL = serverLocator.getProtocol().equals("sslsocket");
-      Map params = serverLocator.getParameters();
-
-      if (params != null)
-      {
-         //serializationType = (String)params.get("serializationtype");
-         
-         //Always use jms
-         serializationType = "jms";
-      }
-            
-      while (!completed && count < MAX_RETRIES)
-      {
-         try
-         {      
-            int bindPort = CLIENT_PORT;
-            if (bindPort<=0)
-            {
-            	bindPort=PortUtil.findFreePort(thisAddress);
-            }
-            
-            String callbackServerURI;
-      
-            if (isSSL)
-            {
-               // See http://jira.jboss.com/jira/browse/JBREM-470
-               callbackServerURI =
-                  "sslsocket://" + thisAddress + ":" +  bindPort + CALLBACK_SERVER_PARAMS +
-                  "&" + SSLSocketBuilder.REMOTING_SERVER_SOCKET_USE_CLIENT_MODE + "=true";
-            }
-            else
-            {
-               callbackServerURI = serverLocator.getProtocol() + "://" + thisAddress +
-                                   ":" + bindPort + CALLBACK_SERVER_PARAMS;
-            }           
-      
-            if (serializationType != null)
-            {
-               callbackServerURI += "&serializationType=" + serializationType;
-            }
-      
-            InvokerLocator callbackServerLocator = new InvokerLocator(callbackServerURI);
-      
-            log.debug(this + " starting callback server " + callbackServerLocator.getLocatorURI());
-      
-            server = new Connector();
-            server.setInvokerLocator(callbackServerLocator.getLocatorURI());
-            server.create();
-            server.addInvocationHandler(JMS_CALLBACK_SUBSYSTEM, new CallbackManager());
-            server.start();
-      
-            if (log.isTraceEnabled()) { log.trace("callback server started"); }
-            
-            completed = true;
-         }
-         catch (Exception e)
-         {
-            log.warn("Failed to start connection. Will retry", e);
-
-            // Intermittently we can fail to open a socket on the address since it's already in use
-            // This is despite remoting having checked the port is free. This is probably because
-            // of the small window between remoting checking the port is free and getting the
-            // port number and actually opening the connection during which some one else can use
-            // that port. Therefore we catch this and retry.
-
-            count++;
-            
-            if (count == MAX_RETRIES)
-            {
-               final String msg = "Cannot start callbackserver after " + MAX_RETRIES + " retries";
-               log.error(msg, e);
-               throw new MessagingJMSException(msg, e);
-            }
-         }
-      }
-      
-      return server;
-   }
-   
-   protected void stopCallbackServer(Connector server)
-   {
-      log.debug("Stopping and destroying callback server " + server.getLocator().getLocatorURI());
-      server.stop();
-      server.destroy();
-   }
-   
-   private class Holder
-   {
-      Connector server;
-      int refCount = 1;
-   }
-  
-}
-

Copied: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java (from rev 1764, trunk/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java)

Deleted: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/DummyCallbackHandler.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/DummyCallbackHandler.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/DummyCallbackHandler.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,48 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * 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.jms.client.remoting;
-
-import org.jboss.remoting.callback.Callback;
-import org.jboss.remoting.callback.HandleCallbackException;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-
-/**
- * 
- * A DummyCallbackHandler.
- * 
- * This class is only used to trigger the addListener method on the JMSServerInvocationHandler
- * to be called, which allows the server to get hold of a reference to the callback client
- * so it can make callbacks
- * 
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version 1.1
- *
- * DummyCallbackHandler.java,v 1.1 2006/02/01 17:38:30 timfox Exp
- */
-public class DummyCallbackHandler implements InvokerCallbackHandler
-{
-
-   public void handleCallback(Callback cb) throws HandleCallbackException
-   {
-   }
-
-}

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -29,18 +29,15 @@
 import org.jboss.logging.Logger;
 import org.jboss.remoting.Client;
 import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.callback.CallbackPoller;
+import org.jboss.remoting.transport.socket.MicroSocketClientInvoker;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
 
 
 /**
  * Encapsulates the state and behaviour from jboss remoting needed for a JMS connection.
  * 
- * Each JMS connection maintains a single Client instance for invoking on the server, and a
- * Connector instance that represents the callback server used to receive push callbacks from the
- * server.
- * Only Connector is maintained per protocol
- * 
+ * Each JMS connection maintains a single Client instance for invoking on the server
  * @author <a href="tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @version 1.1
@@ -51,6 +48,8 @@
 {
    // Constants -----------------------------------------------------
 
+   public static final String CALLBACK_POLL_PERIOD_DEFAULT = "100";
+
    private static final Logger log = Logger.getLogger(JMSRemotingConnection.class);
 
    // Static --------------------------------------------------------
@@ -59,19 +58,15 @@
 
    protected Client client;
    protected boolean clientPing;
-   protected Connector callbackServer;
    protected InvokerLocator serverLocator;
    protected CallbackManager callbackManager;
 
-   private InvokerCallbackHandler dummyCallbackHandler;
-
    // Constructors --------------------------------------------------
 
    public JMSRemotingConnection(String serverLocatorURI, boolean clientPing) throws Throwable
-   { 
+   {
       serverLocator = new InvokerLocator(serverLocatorURI);
       this.clientPing = clientPing;
-      dummyCallbackHandler = new DummyCallbackHandler();
 
       log.debug(this + " created");
    }
@@ -92,11 +87,7 @@
 
       if (log.isTraceEnabled()) { log.trace(this + " created client"); }
 
-      // Get the callback server
-
-      callbackServer = CallbackServerFactory.instance.getCallbackServer(serverLocator);
-      callbackManager = (CallbackManager)callbackServer.getInvocationHandlers()[0];
-
+      callbackManager = new CallbackManager();
       client.connect();
 
       // We explicitly set the Marshaller since otherwise remoting tries to resolve the marshaller
@@ -107,12 +98,64 @@
       client.setMarshaller(new JMSWireFormat());
       client.setUnMarshaller(new JMSWireFormat());
 
-      // We add a dummy callback handler only to trigger the addListener method on the
-      // JMSServerInvocationHandler to be called, which allows the server to get hold of a reference
-      // to the callback client so it can make callbacks
+      // For socket transport allow true push callbacks, with callback Connector.
+      // For http transport, simulate push callbacks.
+      boolean doPushCallbacks = "socket".equals(serverLocator.getProtocol());
+      if (doPushCallbacks)
+      {
+         if (log.isTraceEnabled()) log.trace("doing push callbacks");
+         HashMap metadata = new HashMap();
+         metadata.put(InvokerLocator.DATATYPE, "jms");
+         metadata.put(InvokerLocator.SERIALIZATIONTYPE, "jms"); //Not actually used at present - but it does no harm         
+         metadata.put(MicroSocketClientInvoker.CLIENT_SOCKET_CLASS_FLAG, "org.jboss.jms.client.remoting.ClientSocketWrapper");
+         metadata.put(SocketServerInvoker.SERVER_SOCKET_CLASS_FLAG, "org.jboss.jms.server.remoting.ServerSocketWrapper");
+         
+         String bindAddress = System.getProperty("jboss.messaging.callback.bind.address");
+         if (bindAddress != null)
+         {
+            metadata.put(Client.CALLBACK_SERVER_HOST, bindAddress);
+         }
 
-      client.addListener(dummyCallbackHandler, callbackServer.getLocator());
+         String propertyPort = System.getProperty("jboss.messaging.callback.bind.port");
+         if (propertyPort != null)
+         {
+            metadata.put(Client.CALLBACK_SERVER_PORT, propertyPort);
+         }
 
+         client.addListener(callbackManager, metadata, null, true);
+      }
+      else
+      {
+         if (log.isTraceEnabled()) log.trace("simulating push callbacks");
+
+         HashMap metadata = new HashMap();
+
+         // "jboss.messaging.callback.pollPeriod" system property, if set, has the highest priority ...
+         String callbackPollPeriod = System.getProperty("jboss.messaging.callback.pollPeriod");
+         if (callbackPollPeriod == null)
+         {
+            // followed by the value configured on the HTTP connector ("callbackPollPeriod") ...
+            callbackPollPeriod = (String)serverLocator.getParameters().get("callbackPollPeriod");
+            if (callbackPollPeriod == null)
+            {
+               // followed by the hardcoded value.
+               callbackPollPeriod = CALLBACK_POLL_PERIOD_DEFAULT;
+            }
+         }
+
+         metadata.put(CallbackPoller.CALLBACK_POLL_PERIOD, callbackPollPeriod);
+
+         String reportPollingStatistics =
+            System.getProperty("jboss.messaging.callback.reportPollingStatistics");
+
+         if (reportPollingStatistics != null)
+         {
+            metadata.put(CallbackPoller.REPORT_STATISTICS, reportPollingStatistics);
+         }
+
+         client.addListener(callbackManager, metadata);
+      }
+
       log.debug(this + " started");
    }
 
@@ -123,16 +166,11 @@
       // explicitly remove the callback listener, to avoid race conditions on server
       // (http://jira.jboss.org/jira/browse/JBMESSAGING-535)
 
-      client.removeListener(dummyCallbackHandler);
-      dummyCallbackHandler = null;
-      
-      CallbackServerFactory.instance.stopCallbackServer(serverLocator.getProtocol());
-      
+      client.removeListener(callbackManager);
       client.disconnect();
 
       client=null;
-      
-      log.debug(this + " closed");      
+      log.debug(this + " closed");
    }
 
    public Client getInvokingClient()

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -56,7 +56,7 @@
    
    // Static --------------------------------------------------------
    
-   private static boolean trace;
+   private static boolean trace;      
    
    static
    {
@@ -64,27 +64,29 @@
       trace = log.isTraceEnabled();
    }
      
-   // Hardcoded for now
-   private static final int MAX_REDELIVERIES = 10;
-      
    public static void callOnMessage(SessionDelegate sess,
                                     MessageListener listener,
                                     int consumerID,
                                     boolean isConnectionConsumer,
                                     MessageProxy m,
-                                    int ackMode)
+                                    int ackMode,
+                                    int maxDeliveries)
       throws JMSException
    {
       preDeliver(sess, consumerID, m, isConnectionConsumer);
                   
       int tries = 0;
       
+      boolean cancel = false;
+      
       while (true)
       {
          try
          {
             if (trace) { log.trace("calling listener's onMessage(" + m + ")"); }
-
+            
+            m.incDeliveryCount();
+            
             listener.onMessage(m);
 
             if (trace) { log.trace("listener's onMessage() finished"); }
@@ -101,24 +103,20 @@
    
             if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
             {
-               // We redeliver at certain number of times
-               if (tries < MAX_REDELIVERIES)
-               {
-                  m.setJMSRedelivered(true);
-                  
-                  // TODO delivery count although optional should be global so we need to send it
-                  // back to the server but this has performance hit so perhaps we just don't
-                  // support it?
-                  m.incDeliveryCount();
-                  
+               // We redeliver a certain number of times
+               if (tries < maxDeliveries)
+               {                            
                   tries++;
                }
                else
                {
                   log.error("Max redeliveries has occurred for message: " + m.getJMSMessageID());
                   
-                  //TODO - Send to DLQ
+                  // postdeliver will do a cancel rather than an ack which will cause the mesage
+                  // to end up in the DLQ
                   
+                  cancel = true;
+                  
                   break;
                }
             }
@@ -136,7 +134,7 @@
       if (!sess.isClosed())
       {
          // postDeliver only if the session is not closed
-         postDeliver(sess, isConnectionConsumer);
+         postDeliver(sess, isConnectionConsumer, cancel);
       }
    }
    
@@ -154,52 +152,41 @@
       }         
    }
    
-   protected static void postDeliver(SessionDelegate sess, boolean isConnectionConsumer)
-      throws JMSException
+   protected static void postDeliver(SessionDelegate sess, boolean isConnectionConsumer,
+                                     boolean cancel) throws JMSException
    {
       // If this is the callback-handler for a connection consumer we don't want to acknowledge or
       // add anything to the tx for this session
       if (!isConnectionConsumer)
       {
-         sess.postDeliver();
+         sess.postDeliver(cancel);
       }         
    }
    
    // Attributes ----------------------------------------------------
       
    private LinkedList buffer;
-   
    private SessionDelegate sessionDelegate;
-   
    private ConsumerDelegate consumerDelegate;
-   
    private int consumerID;
-   
    private boolean isConnectionConsumer;
-   
    private volatile Thread receiverThread;
-   
    private MessageListener listener;
-    
    private int ackMode;
-      
    private boolean closed;
-   
    private Object mainLock;
-   
    private boolean serverSending;
-   
    private int bufferSize;
-   
    private QueuedExecutor sessionExecutor;
-   
    private boolean listenerRunning;
+   private int maxDeliveries;
         
    // Constructors --------------------------------------------------
 
    public MessageCallbackHandler(boolean isCC, int ackMode,                                
                                  SessionDelegate sess, ConsumerDelegate cons, int consumerID,
-                                 int bufferSize, QueuedExecutor sessionExecutor)
+                                 int bufferSize, QueuedExecutor sessionExecutor,
+                                 int maxDeliveries)
    {
       if (bufferSize < 1)
       {
@@ -207,24 +194,16 @@
       }
               
       this.bufferSize = bufferSize;
-
       buffer = new LinkedList();
-
       isConnectionConsumer = isCC;
-      
       this.ackMode = ackMode;
-
       this.sessionDelegate = sess;
-
       this.consumerDelegate = cons;
-      
       this.consumerID = consumerID;
-      
       this.serverSending = true;
-      
-      mainLock = new Object();                  
-      
+      mainLock = new Object();
       this.sessionExecutor = sessionExecutor;
+      this.maxDeliveries = maxDeliveries;
    }
         
    // Public --------------------------------------------------------
@@ -247,7 +226,18 @@
             // Ignore
             return new HandleMessageResponse(false, 0);
          }
-                                      
+
+         // Asynchronously confirm delivery on client
+
+         try
+         {
+            sessionExecutor.execute(new ConfirmDelivery(msgs.size()));
+         }
+         catch (InterruptedException e)
+         {
+            log.warn("Thread interrupted", e);
+         }
+
          // Put the messages in the buffer and notify any waiting receive()
          
          processMessages(msgs);
@@ -453,7 +443,7 @@
                // message is acknowledged so it gets removed from the queue/subscription.
                preDeliver(sessionDelegate, consumerID, m, isConnectionConsumer);
                
-               postDeliver(sessionDelegate, isConnectionConsumer);
+               postDeliver(sessionDelegate, isConnectionConsumer, false);
                
                if (!m.getMessage().isExpired())
                {
@@ -488,6 +478,8 @@
          consumerDelegate.more();
       }
       
+      m.incDeliveryCount();
+      
       return m;
    }    
    
@@ -730,7 +722,7 @@
          {
             try
             {
-               callOnMessage(sessionDelegate, listener, consumerID, false, mp, ackMode);
+               callOnMessage(sessionDelegate, listener, consumerID, false, mp, ackMode, maxDeliveries);
             }
             catch (JMSException e)
             {
@@ -761,6 +753,26 @@
          }
       }
    }
+
+   /*
+    * Used to asynchronously confirm to the server message arrival (delivery) on client.
+    */
+   private class ConfirmDelivery implements Runnable
+   {
+      int count;
+
+      ConfirmDelivery(int count)
+      {
+         this.count = count;
+      }
+
+      public void run()
+      {
+         if (trace) { log.trace("confirming delivery on client of " + count + " message(s)"); }
+         consumerDelegate.confirmDelivery(count);
+      }
+   }
+
 }
 
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/state/ConsumerState.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/state/ConsumerState.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,32 +1,32 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * 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.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.jms.client.state;
 
 import java.util.Collections;
 
 import javax.jms.Destination;
 
+import org.jboss.jms.client.delegate.DelegateSupport;
 import org.jboss.jms.client.remoting.MessageCallbackHandler;
-import org.jboss.jms.client.delegate.DelegateSupport;
 import org.jboss.jms.delegate.ConsumerDelegate;
 import org.jboss.jms.server.Version;
 
@@ -56,14 +56,16 @@
    private MessageCallbackHandler messageCallbackHandler;
 
    private int prefetchSize;
-
+   
    private SessionState parent;
-
+   
    private ConsumerDelegate delegate;
-
+   
+   private int maxDeliveries;
+   
    public ConsumerState(SessionState parent, ConsumerDelegate delegate, Destination dest,
-                        String selector,  boolean noLocal, String subscriptionName,
-                        int consumerID, boolean isCC, int prefetchSize)
+                        String selector, boolean noLocal, String subscriptionName, int consumerID,
+                        boolean isCC, int prefetchSize, int maxDeliveries)
    {
       super(parent, (DelegateSupport)delegate);
       children = Collections.EMPTY_SET;
@@ -74,9 +76,9 @@
       this.isConnectionConsumer = isCC;
       this.prefetchSize = prefetchSize;
       this.subscriptionName=subscriptionName;
+      this.maxDeliveries = maxDeliveries;
    }
 
-
    public DelegateSupport getDelegate()
    {
       return (DelegateSupport)delegate;
@@ -157,6 +159,10 @@
    {
       this.consumerID = newState.consumerID;
    }
-}
 
+   public int getMaxDeliveries()
+   {
+      return maxDeliveries;
+   }
 
+}

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/delegate/SessionDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/delegate/SessionDelegate.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/delegate/SessionDelegate.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -67,7 +67,7 @@
    
    void preDeliver(MessageProxy proxy, int consumerID) throws JMSException;
    
-   void postDeliver() throws JMSException;
+   void postDeliver(boolean cancel) throws JMSException;
    
    MessageListener getMessageListener() throws JMSException;
    
@@ -77,7 +77,7 @@
    
    XAResource getXAResource();
    
-   void addAsfMessage(MessageProxy m, int consumerID, ConsumerDelegate cons);
+   void addAsfMessage(MessageProxy m, int consumerID, ConsumerDelegate cons, int maxDeliveries);
    
    boolean getTransacted();
    
@@ -94,6 +94,4 @@
    ProducerDelegate createProducerDelegate(JBossDestination destination) throws JMSException;
    
    void acknowledgeAll() throws JMSException;
-
-
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/JBossMessage.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/JBossMessage.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -188,7 +188,7 @@
             sb.append(name).append(" - ").append(m.headers.get(name)).append('\n');
          }
       }
-      sb.append("              redelivered:   ").append(m.redelivered).append('\n');
+      sb.append("              redelivered:   ").append(m.deliveryCount >= 1).append('\n');
       sb.append("              priority:      ").append(m.priority).append('\n');
       sb.append("              deliveryCount: ").append(m.deliveryCount).append('\n');
 
@@ -336,7 +336,7 @@
          setJMSDestination(foreign.getJMSDestination());
       }
       setJMSDeliveryMode(foreign.getJMSDeliveryMode());
-      setJMSRedelivered(foreign.getJMSRedelivered());
+      setDeliveryCount(foreign.getJMSRedelivered() ? 1 : 0);
       setJMSExpiration(foreign.getJMSExpiration());
       setJMSPriority(foreign.getJMSPriority());
       setJMSType(foreign.getJMSType());
@@ -480,12 +480,19 @@
 
    public boolean getJMSRedelivered() throws JMSException
    {
-      return isRedelivered();
+      return deliveryCount >= 2;
    }
 
    public void setJMSRedelivered(boolean redelivered) throws JMSException
    {
-      setRedelivered(redelivered);
+      if (deliveryCount == 1)
+      {
+         deliveryCount++;
+      }
+      else
+      {
+         //do nothing
+      }
    }
 
    /**

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/MessageProxy.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/MessageProxy.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/message/MessageProxy.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -80,7 +80,6 @@
    protected transient boolean bodyReadOnly;
 
    protected int deliveryCount;
-   protected transient boolean jmsRedelivered;
 
    // Constructors --------------------------------------------------
 
@@ -177,13 +176,24 @@
    public boolean getJMSRedelivered() throws JMSException
    {
       //Always handled in the delegate
-      return jmsRedelivered;
+      //This is because when sending a message to a topic (for instance)
+      //with multiple subscriptions all in the same VM, then we don't copy the original
+      //message for performance reasons, unless necessary, but each reference might have
+      //it's own value for delivery count
+      return deliveryCount >= 2;
    }
 
    public void setJMSRedelivered(boolean redelivered) throws JMSException
    {
       //Always handled in the delegate
-      jmsRedelivered = redelivered;
+      if (deliveryCount == 1)
+      {
+         deliveryCount++;
+      }
+      else
+      {
+         //do nothing
+      }
    }
 
    public String getJMSType() throws JMSException
@@ -407,8 +417,6 @@
       propertiesReadOnly = true;
 
       bodyReadOnly = true;
-
-      this.jmsRedelivered = deliveryCount > 1;
    }
 
    public JBossMessage getMessage()
@@ -423,7 +431,7 @@
    
    public void incDeliveryCount()
    {
-      this.deliveryCount++;
+      this.deliveryCount++;            
    }
 
    public String toString()

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -40,9 +40,11 @@
 import org.jboss.jms.server.endpoint.ServerConsumerEndpoint;
 import org.jboss.jms.server.plugin.contract.JMSUserManager;
 import org.jboss.jms.server.remoting.JMSWireFormat;
+import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
 import org.jboss.jms.server.security.SecurityMetadataStore;
 import org.jboss.jms.util.ExceptionUtil;
 import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Queue;
 import org.jboss.messaging.core.memory.MemoryManager;
 import org.jboss.messaging.core.memory.SimpleMemoryManager;
 import org.jboss.messaging.core.plugin.IdManager;
@@ -54,11 +56,12 @@
 import org.jboss.messaging.core.plugin.contract.Replicator;
 import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
 import org.jboss.messaging.core.plugin.postoffice.cluster.FailoverStatus;
+import org.jboss.messaging.core.plugin.postoffice.Binding;
 import org.jboss.messaging.core.tx.TransactionRepository;
 import org.jboss.messaging.util.Util;
 import org.jboss.mx.loading.UnifiedClassLoader3;
 import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.remoting.serialization.SerializationStreamFactory;
+import org.jboss.remoting.ServerInvocationHandler;
 import org.jboss.system.ServiceCreator;
 import org.jboss.system.ServiceMBeanSupport;
 import org.w3c.dom.Element;
@@ -96,13 +99,17 @@
 
    private String defaultQueueJNDIContext;
    private String defaultTopicJNDIContext;
-   
+
    private int queuedExecutorPoolSize = 200;
 
    private boolean started;
 
    private int objectIDSequence = 1;
-   
+
+   private int maxDeliveryAttempts = 10;
+
+   private String dlqName;
+
    private Object failoverStatusLock;
       
    // wired components
@@ -118,24 +125,26 @@
    private IdManager transactionIdManager;
    private MemoryManager memoryManager;
    private QueuedExecutorPool queuedExecutorPool;
-   private MessageStore messageStore;   
+   private MessageStore messageStore;
 
    // plugins
 
    protected ObjectName persistenceManagerObjectName;
    protected PersistenceManager persistenceManager;
-   
+
    protected ObjectName postOfficeObjectName;
    protected PostOffice postOffice;
-   
+
 //   protected ObjectName topicPostOfficeObjectName;
 //   protected PostOffice topicPostOffice;
-     
+
    protected ObjectName jmsUserManagerObjectName;
    protected JMSUserManager jmsUserManager;
-   
+
    //Other stuff
 
+   private JMSServerInvocationHandler handler;
+
    // We keep a map of consumers to prevent us to recurse through the attached session in order to
    // find the ServerConsumerDelegate so we can acknowledge the message. Originally, this map was
    // maintained per-connection, but with the http://jira.jboss.org/jira/browse/JBMESSAGING-211 bug
@@ -156,7 +165,7 @@
 
       // Some wired components need to be started here
       securityStore = new SecurityMetadataStore();
-      
+
       consumers = new ConcurrentReaderHashMap();
 
       version = Version.instance();
@@ -172,38 +181,40 @@
    {
       try
       {
+         log.debug("starting ServerPeer");
+
          if (started)
          {
             return;
          }
-         
+
          log.debug(this + " starting");
-         
+
          if (queuedExecutorPoolSize < 1)
          {
             throw new IllegalArgumentException("queuedExecutorPoolSize must be > 0");
          }
          queuedExecutorPool = new QueuedExecutorPool(queuedExecutorPoolSize);
-            
+
          loadClientAOPConfig();
-   
+
          loadServerAOPConfig();
-   
+
          MBeanServer mbeanServer = getServer();
-   
+
          // Acquire references to plugins. Each plug-in will be accessed directly via a reference
          // circumventing the MBeanServer. However, they are installed as services to take advantage
          // of their automatically-creating management interface.
-   
+
          persistenceManager = (PersistenceManager)mbeanServer.
             getAttribute(persistenceManagerObjectName, "Instance");
 
          jmsUserManager = (JMSUserManager)mbeanServer.
             getAttribute(jmsUserManagerObjectName, "Instance");
-         
+
          //We get references to some plugins lazily to avoid problems with circular
          //MBean dependencies
-            
+
          // Create the wired components
          messageIdManager = new IdManager("MESSAGE_ID", 4096, persistenceManager);
          channelIdManager = new IdManager("CHANNEL_ID", 10, persistenceManager);
@@ -213,36 +224,36 @@
          connectionManager = new SimpleConnectionManager();
          connectorManager = new SimpleConnectorManager();
          memoryManager = new SimpleMemoryManager();
-         messageStore = new SimpleMessageStore();         
+         messageStore = new SimpleMessageStore();
          txRepository = new TransactionRepository(persistenceManager, transactionIdManager);
- 
+
          // Start the wired components
-   
+
          messageIdManager.start();
          channelIdManager.start();
          transactionIdManager.start();
          destinationJNDIMapper.start();
          connFactoryJNDIMapper.start();
          connectionManager.start();
-         connectorManager.start();         
+         connectorManager.start();
          memoryManager.start();
          messageStore.start();
          securityStore.start();
          txRepository.start();
-         
+
          initializeRemoting(mbeanServer);
-   
+
          //createRecoverable();
-   
+
          started = true;
-   
+
          log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
-            getServerPeerID()+ "] started");      
+            getServerPeerID()+ "] started");
       }
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
-      } 
+      }
    }
 
    public synchronized void stopService() throws Exception
@@ -253,15 +264,15 @@
          {
             return;
          }
-   
+
          log.debug(this + " stopping");
-   
+
          started = false;
-   
+
          //removeRecoverable();
-        
-         // Stop the wired components         
-         
+
+         // Stop the wired components
+
          messageIdManager.stop();
          messageIdManager = null;
          channelIdManager.stop();
@@ -274,7 +285,7 @@
          connFactoryJNDIMapper = null;
          connectionManager.stop();
          connectionManager = null;
-         connectorManager.start(); 
+         connectorManager.start();
          connectorManager = null;
          memoryManager.stop();
          memoryManager = null;
@@ -284,24 +295,43 @@
          securityStore = null;
          txRepository.stop();
          txRepository = null;
-   
+
          unloadServerAOPConfig();
-   
+
          // TODO unloadClientAOPConfig();
-         
+
          queuedExecutorPool.shutdown();
-                  
+
          log.info("JMS " + this + " stopped");
       }
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
-      } 
+      }
    }
 
    // JMX Attributes ------------------------------------------------
 
+   public String getDLQName()
+   {
+      return dlqName;
+   }
 
+   public void setDLQName(String dlqName)
+   {
+      this.dlqName = dlqName;
+   }
+
+   public int getMaxDeliveryAttempts()
+   {
+      return maxDeliveryAttempts;
+   }
+
+   public void setMaxDeliveryAttempts(int attempts)
+   {
+      this.maxDeliveryAttempts = attempts;
+   }
+
    public ObjectName getPersistenceManager()
    {
       return persistenceManagerObjectName;
@@ -311,7 +341,7 @@
    {
       persistenceManagerObjectName = on;
    }
-   
+
    public ObjectName getPostOffice()
    {
       return postOfficeObjectName;
@@ -321,7 +351,7 @@
    {
       postOfficeObjectName = on;
    }
-   
+
 //   public ObjectName getTopicPostOffice()
 //   {
 //      return topicPostOfficeObjectName;
@@ -331,7 +361,7 @@
 //   {
 //      topicPostOfficeObjectName = on;
 //   }
-   
+
    public ObjectName getJmsUserManager()
    {
       return jmsUserManagerObjectName;
@@ -341,7 +371,7 @@
    {
       jmsUserManagerObjectName = on;
    }
-   
+
    public Object getInstance()
    {
       return this;
@@ -401,12 +431,12 @@
    {
       try
       {
-         securityStore.setSecurityDomain(securityDomain);      
+         securityStore.setSecurityDomain(securityDomain);
       }
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " setSecurityDomain");
-      } 
+      }
    }
 
    public String getSecurityDomain()
@@ -428,22 +458,27 @@
    {
       return messageIdManager;
    }
-   
+
    public IdManager getChannelIdManager()
    {
       return channelIdManager;
    }
 
+   public ServerInvocationHandler getInvocationHandler()
+   {
+      return handler;
+   }
+
    public int getQueuedExecutorPoolSize()
    {
       return queuedExecutorPoolSize;
    }
-   
+
    public void setQueuedExecutorPoolSize(int poolSize)
    {
       this.queuedExecutorPoolSize = poolSize;
    }
-   
+
    // JMX Operations ------------------------------------------------
 
    public String createQueue(String name, String jndiName) throws Exception
@@ -455,7 +490,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue");
-      } 
+      }
    }
 
    public String createQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
@@ -467,7 +502,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue(2)");
-      } 
+      }
    }
 
    public boolean destroyQueue(String name) throws Exception
@@ -479,7 +514,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " destroyQueue");
-      } 
+      }
    }
 
    public String createTopic(String name, String jndiName) throws Exception
@@ -491,7 +526,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic");
-      } 
+      }
    }
 
    public String createTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
@@ -503,7 +538,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic(2)");
-      } 
+      }
    }
 
    public boolean destroyTopic(String name) throws Exception
@@ -515,7 +550,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " destroyTopic");
-      } 
+      }
    }
 
    public Set getDestinations() throws Exception
@@ -527,11 +562,33 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " getDestinations");
-      } 
+      }
    }
 
-   // Public --------------------------------------------------------     
+   // Public --------------------------------------------------------
 
+   public Queue getDLQ() throws Exception
+   {
+      if (dlqName == null)
+      {
+         //No DLQ name specified so there is no DLQ
+         return null;
+      }
+
+      PostOffice postOffice = getPostOfficeInstance();
+
+      Binding binding = postOffice.getBindingForQueueName(dlqName);
+      
+      if (binding != null && binding.getQueue().isActive())
+      {
+         return binding.getQueue();
+      }
+      else
+      {
+         return null;
+      }   
+   }
+
    public TransactionRepository getTxRepository()
    {
       return txRepository;
@@ -551,7 +608,7 @@
    {
       return version;
    }
-   
+
    // access to hard-wired server extensions
 
    public SecurityManager getSecurityManager()
@@ -578,12 +635,12 @@
    {
       return connectorManager;
    }
-   
+
    public MessageStore getMessageStore()
    {
       return messageStore;
    }
-   
+
    public MemoryManager getMemoryManager()
    {
       return memoryManager;
@@ -595,22 +652,12 @@
    {
       return persistenceManager;
    }
-   
+
    public JMSUserManager getJmsUserManagerInstance()
    {
       return jmsUserManager;
    }
 
-   public Replicator getReplicator() throws Exception
-   {
-      PostOffice postOffice = getPostOfficeInstance();
-      if (!(postOffice instanceof Replicator))
-      {
-         throw new  IllegalAccessException("This operations is only legal on clustering configurations");
-      }
-      return (Replicator)postOffice;
-   }
-   
    public PostOffice getPostOfficeInstance() throws Exception
    {
       // We get the reference lazily to avoid problems with MBean circular dependencies
@@ -618,34 +665,32 @@
       {
          postOffice = (PostOffice)getServer().
             getAttribute(postOfficeObjectName, "Instance");
-         
-         //We also inject the replicator dependency into the ConnectionFactoryJNDIMapper
-         //This is a bit messy but we have a circular dependency
-         //POJOContainer should be able to help us here
-         //Yes, this is nasty
-         
+
+         // We also inject the replicator dependency into the ConnectionFactoryJNDIMapper. This is
+         // a bit messy but we have a circular dependency POJOContainer should be able to help us
+         // here. Yes, this is nasty.
+
          if (!postOffice.isLocal())
          {
             Replicator rep = (Replicator)postOffice;
             connFactoryJNDIMapper.injectReplicator(rep);
             rep.registerListener(new FailoverListener());
-            
+
          }
       }
       return postOffice;
    }
-      
-//   public PostOffice getTopicPostOfficeInstance() throws Exception
-//   {
-//      // We get the reference lazily to avoid problems with MBean circular dependencies
-//      if (topicPostOffice == null)
-//      {
-//         topicPostOffice = (PostOffice)getServer().
-//            getAttribute(topicPostOfficeObjectName, "Instance");
-//      }
-//      return topicPostOffice;        
-//   }
-   
+
+   public Replicator getReplicator() throws Exception
+   {
+      PostOffice postOffice = getPostOfficeInstance();
+      if (!(postOffice instanceof Replicator))
+      {
+         throw new  IllegalAccessException("This operations is only legal on clustering configurations");
+      }
+      return (Replicator)postOffice;
+   }
+
    public synchronized int getNextObjectID()
    {
       return objectIDSequence++;
@@ -667,7 +712,7 @@
       log.debug(this + " removing consumer " + consumerID + " from the cache");
       return (ServerConsumerEndpoint)consumers.remove(consumerID);
    }
-   
+
    public QueuedExecutorPool getQueuedExecutorPool()
    {
       return queuedExecutorPool;
@@ -864,17 +909,11 @@
 
    private void initializeRemoting(MBeanServer mbeanServer) throws Exception
    {
-      // We explicitly associate the datatype "jms" with the java SerializationManager
-      // This is vital for performance reasons.
-//      SerializationStreamFactory.setManagerClassName(
-//         "jms", "org.jboss.remoting.serialization.impl.jboss.JBossSerializationManager");
-      SerializationStreamFactory.setManagerClassName(
-             "jms", "org.jboss.jms.server.remoting.MessagingSerializationManager");
-      
-
       JMSWireFormat wf = new JMSWireFormat();
 
       MarshalFactory.addMarshaller("jms", wf, wf);
+
+      handler = new JMSServerInvocationHandler();
    }
 
    private void loadServerAOPConfig() throws Exception
@@ -1001,7 +1040,7 @@
 
       String destType = isQueue ? "Queue" : "Topic";
       String className = "org.jboss.jms.server.destination." + destType + "Service";
-      
+
       String ons ="jboss.messaging.destination:service="+ destType + ",name=" + name;
       ObjectName on = new ObjectName(ons);
 
@@ -1016,7 +1055,7 @@
          "    <attribute name=\"PageSize\">" + pageSize + "</attribute>" +
          "    <attribute name=\"DownCacheSize\">" + downCacheSize + "</attribute>" +
          "</mbean>";
-      
+
       return createDestinationInternal(destinationMBeanConfig, on, jndiName, true, fullSize,
                                        pageSize, downCacheSize);
    }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -127,7 +127,7 @@
                                              defaultTempQueueFullSize,
                                              defaultTempQueuePageSize,
                                              defaultTempQueueDownCacheSize);
-      endpoints.put(uniqueName, endpoint);   
+      endpoints.put(uniqueName, endpoint);
       
       ClientConnectionFactoryDelegate delegate = null;
 
@@ -436,10 +436,7 @@
           }
       }
             
-      ClusteredClientConnectionFactoryDelegate clusteredDelegate =
-         new ClusteredClientConnectionFactoryDelegate(mainDelegate, delArr, failoverMap);
-      
-      return clusteredDelegate;
+      return new ClusteredClientConnectionFactoryDelegate(mainDelegate, delArr, failoverMap);
    }
    
    private void rebindConnectionFactory(Context ic,

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/container/InjectionAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/container/InjectionAspect.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/container/InjectionAspect.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -56,7 +56,7 @@
     {
        MethodInvocation mi = (MethodInvocation)invocation;
        
-       // First we inject the callback client for the connection
+       // First we inject the callback handler for the connection
        
        ServerInvokerCallbackHandler handler =
           (ServerInvokerCallbackHandler)mi.getMetaData(MetaDataConstants.JMS,
@@ -68,7 +68,6 @@
        }
        
        CreateConnectionResult res = (CreateConnectionResult)invocation.invokeNext();
-       
        ClientConnectionDelegate del = (ClientConnectionDelegate)res.getDelegate();
        
        if (del != null)
@@ -78,7 +77,7 @@
           
           ServerConnectionEndpoint endpoint = (ServerConnectionEndpoint)advised.getEndpoint();
           
-          endpoint.setCallbackClient(handler.getCallbackClient());
+          endpoint.setCallbackHandler(handler);
           
           // Then we inject the remoting session id of the client
           String sessionId =

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -118,7 +118,7 @@
             throw new IllegalStateException( "The " + (isQueue() ? "queue" : "topic") + " " +
                                              "name was not properly set in the service's" +
                                              "ObjectName");
-         }
+         }                  
          
          destination.setName(name);                   
       }
@@ -134,7 +134,7 @@
    }
    
    // JMX managed attributes ----------------------------------------
-
+   
    public String getJNDIName()
    {
       return destination.getJndiName();

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConsumerEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConsumerEndpoint.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConsumerEndpoint.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -30,6 +30,8 @@
  * The rest of the methods are handled in the advice stack.
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
  * @version <tt>$Revision$</tt>
  *
  * $Id$
@@ -37,11 +39,23 @@
 public interface ConsumerEndpoint extends Closeable
 {  
    /**
-    * If the client buffer has previously become full because the server was sending at a faster rate than the
-    * client could consume, then the server will stop sending messages.
-    * When the client has emptied the buffer it then needs to inform the server that it can receive more messages
-    * by calling this method
+    * If the client buffer has previously become full because the server was sending at a faster
+    * rate than the client could consume, then the server will stop sending messages. When the
+    * client has emptied the buffer it then needs to inform the server that it can receive more
+    * messages by calling this method.
+    *
     * @throws JMSException
     */
-   void more() throws JMSException;   
+   void more() throws JMSException;
+
+   /**
+    * The server consumer endpoint needs to know at any time how messages are in transit between
+    * server and client. That is why it needs to receive confirmations every time the client
+    * received one (or more) messages. The confirmation is sent asynchronously from client to server.
+    * This is NOT a consumption acknowledgment.
+    *
+    * @param count - the number of messages received by the client in one batch.
+    */
+   void confirmDelivery(int count);
+
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -33,7 +33,7 @@
 import javax.transaction.xa.Xid;
 
 import org.jboss.jms.client.delegate.ClientSessionDelegate;
-import org.jboss.jms.client.remoting.CallbackServerFactory;
+import org.jboss.jms.client.remoting.CallbackManager;
 import org.jboss.jms.delegate.SessionDelegate;
 import org.jboss.jms.destination.JBossDestination;
 import org.jboss.jms.message.JBossMessage;
@@ -57,6 +57,7 @@
 import org.jboss.messaging.core.tx.TransactionRepository;
 import org.jboss.messaging.util.ConcurrentReaderHashSet;
 import org.jboss.remoting.Client;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
 import org.jboss.util.id.GUID;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
@@ -117,7 +118,7 @@
    
    private MessageStore ms;
    
-   private Client callbackClient;
+   private ServerInvokerCallbackHandler callbackHandler;
    
    private byte usingVersion;
    
@@ -427,21 +428,31 @@
    }
    
    //IOC
-   public void setCallbackClient(Client client)
+   public void setCallbackHandler(ServerInvokerCallbackHandler handler)
    {
-      callbackClient = client;
-
-      // TODO not sure if this is the best way to do this, but the callbackClient needs to have
-      //      its "subsystem" set, otherwise remoting cannot find the associated
-      //      ServerInvocationHandler on the callback server
-      callbackClient.setSubsystem(CallbackServerFactory.JMS_CALLBACK_SUBSYSTEM);
-
-      // We explictly set the Marshaller since otherwise remoting tries to resolve the marshaller
-      // every time which is very slow - see org.jboss.remoting.transport.socket.ProcessInvocation
-      // This can make a massive difference on performance. We also do this in
-      // JMSRemotingConnection.setupConnection
-      callbackClient.setMarshaller(new JMSWireFormat());
-      callbackClient.setUnMarshaller(new JMSWireFormat());
+      callbackHandler = handler;
+      Client callbackClient = callbackHandler.getCallbackClient();
+      
+      if (callbackClient != null)
+      {
+         // TODO not sure if this is the best way to do this, but the callbackClient needs to have
+         //      its "subsystem" set, otherwise remoting cannot find the associated
+         //      ServerInvocationHandler on the callback server
+         callbackClient.setSubsystem(CallbackManager.JMS_CALLBACK_SUBSYSTEM);
+         
+         // We explictly set the Marshaller since otherwise remoting tries to resolve the marshaller
+         // every time which is very slow - see org.jboss.remoting.transport.socket.ProcessInvocation
+         // This can make a massive difference on performance. We also do this in
+         // JMSRemotingConnection.setupConnection
+         
+         callbackClient.setMarshaller(new JMSWireFormat());
+         callbackClient.setUnMarshaller(new JMSWireFormat());
+      }
+      else
+      {
+         log.debug("ServerInvokerCallbackHandler callback Client is not available: " +
+                   "must be using pull callbacks");
+      }
    }
    
    // IOC
@@ -494,9 +505,9 @@
    
    // Protected -----------------------------------------------------
    
-   protected Client getCallbackClient()
+   protected ServerInvokerCallbackHandler getCallbackHandler()
    {
-      return callbackClient;
+      return callbackHandler;
    }   
    
    protected int getConnectionID()

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -32,7 +32,6 @@
 import javax.jms.InvalidSelectorException;
 import javax.jms.JMSException;
 
-import org.jboss.jms.client.remoting.HandleMessageResponse;
 import org.jboss.jms.destination.JBossDestination;
 import org.jboss.jms.message.JBossMessage;
 import org.jboss.jms.message.MessageProxy;
@@ -46,6 +45,7 @@
 import org.jboss.messaging.core.Delivery;
 import org.jboss.messaging.core.DeliveryObserver;
 import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.Queue;
 import org.jboss.messaging.core.Receiver;
 import org.jboss.messaging.core.Routable;
 import org.jboss.messaging.core.SimpleDelivery;
@@ -56,6 +56,7 @@
 import org.jboss.messaging.core.tx.TransactionException;
 import org.jboss.messaging.core.tx.TxCallback;
 import org.jboss.messaging.util.Future;
+import org.jboss.remoting.callback.Callback;
 
 import EDU.oswego.cs.dl.util.concurrent.Executor;
 import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
@@ -76,9 +77,9 @@
 
    private static final Logger log = Logger.getLogger(ServerConsumerEndpoint.class);
 
-   // Static --------------------------------------------------------
+   // Static --------------------------------------------------------  
 
-   private static final int MAX_DELIVERY_ATTEMPTS = 10;
+   private static final int MESSAGES_IN_TRANSIT_WAIT_COUNT = 100;
 
    // Attributes ----------------------------------------------------
 
@@ -123,13 +124,18 @@
 
    private Map deliveries;
    
+   private Queue dlq;
+   
+   private Object messagesInTransitLock;
+   private int messagesInTransitCount; // access only from a region guarded by messagesInTransitLock
+   
    // Constructors --------------------------------------------------
 
    protected ServerConsumerEndpoint(int id, PagingFilteredQueue messageQueue, String queueName,
                                     ServerSessionEndpoint sessionEndpoint,
                                     String selector, boolean noLocal, JBossDestination dest,
-                                    int prefetchSize)
-                                    throws InvalidSelectorException
+                                    int prefetchSize, Queue dlq)
+      throws InvalidSelectorException
    {
       if (trace) { log.trace("constructing consumer endpoint " + id); }
 
@@ -138,6 +144,7 @@
       this.queueName = queueName;
       this.sessionEndpoint = sessionEndpoint;
       this.prefetchSize = prefetchSize;
+      this.dlq = dlq;
 
       // We always created with clientConsumerFull = true. This prevents the SCD sending messages to
       // the client before the client has fully finished creating the MessageCallbackHandler.
@@ -193,6 +200,9 @@
       
       // prompt delivery
       messageQueue.deliver(false);
+
+      messagesInTransitLock = new Object();
+      messagesInTransitCount = 0;
       
       log.debug(this + " constructed");
    }
@@ -247,16 +257,14 @@
          {
             return delivery;
          }
-            
-         checkDeliveryCount(delivery);
-         
+                 
          if (delivery.isDone())
          {
             return delivery;
          }
+
+         deliveries.put(new Long(ref.getMessageID()), delivery);
    
-         deliveries.put(new Long(ref.getMessageID()), delivery);                 
-   
          // We don't send the message as-is, instead we create a MessageProxy instance. This allows
          // local fields such as deliveryCount to be handled by the proxy but global data to be
          // fielded by the same underlying Message instance. This allows us to avoid expensive
@@ -404,34 +412,39 @@
    {           
       try
       {
-         /*
-         Set clientConsumerFull to false
-         NOTE! This must be done using a Runnable on the delivery executor - this is to
-         prevent the following race condition:
-         1) Messages are delivered to the client, causing it to be full
-         2) The messages are consumed very quickly on the client causing more to be called()
-         3) more() hits the server BEFORE the deliverer thread has returned from delivering to the client
-         causing clientConsumerFull to be set to false and adding a deliverer to the queue.
-         4) The deliverer thread returns and sets clientConsumerFull to true
-         5) The next deliverer runs but doesn't do anything since clientConsumerFull = true even
-         though the client needs messages
-         */
-         this.executor.execute(new Runnable() { public void run() { clientConsumerFull = false; } });         
+         // Set clientConsumerFull to false.
+         //
+         // NOTE! This must be done using a Runnable on the delivery executor - this is to prevent
+         // the following race condition:
+         //  1) Messages are delivered to the client, causing it to be full.
+         //  2) The messages are consumed very quickly on the client causing more() to be called.
+         //  3) more() hits the server BEFORE the deliverer thread has returned from delivering to
+         //     the client causing clientConsumerFull to be set to false and adding a deliverer to
+         //     the queue.
+         //  4) The deliverer thread returns and sets clientConsumerFull to true.
+         //  5) The next deliverer runs but doesn't do anything since clientConsumerFull = true even
+         //     though the client needs messages.
+
+         executor.execute(new Runnable()
+         {
+            public void run()
+            {
+               if (trace) { log.trace(ServerConsumerEndpoint.this + " is notified that client wants more() messages"); }
+               clientConsumerFull = false;
+            }
+         });
                            
-         //Run a deliverer to deliver any existing ones
-         this.executor.execute(new Deliverer());
+         // Run a deliverer to deliver any existing ones
+         executor.execute(new Deliverer());
          
-         //TODO Why do we need to wait for it to execute??
-         //Why not just return immediately?
+         // TODO Why do we need to wait for it to execute? Why not just return immediately?
          
-         //Now wait for it to execute
+         // Now wait for it to execute
          Future result = new Future();
-         
          this.executor.execute(new Waiter(result));
-         
          result.getResult();
                   
-         //Now we know the deliverer has delivered any outstanding messages to the client buffer
+         // Now we know the deliverer has delivered any outstanding messages to the client buffer
          
          messageQueue.deliver(false);
       }
@@ -444,8 +457,25 @@
          throw ExceptionUtil.handleJMSInvocation(t, this + " more");
       }
    }
-   
-   
+
+   public void confirmDelivery(int count)
+   {
+      synchronized(messagesInTransitLock)
+      {
+         messagesInTransitCount -= count;
+
+         if (trace) { log.trace("confirming delivery of " + count + " message(s), messages in transit " + messagesInTransitCount); }
+
+         if (messagesInTransitCount < 0)
+         {
+            log.error(this + " has an invalid messages in transit count (" +
+                      messagesInTransitCount + ")");
+         }
+
+         messagesInTransitLock.notifyAll();
+      }
+   }
+
    // Public --------------------------------------------------------
    
    public String toString()
@@ -573,18 +603,56 @@
       messageQueue.deliver(false);
    }
    
-   protected void cancelDelivery(Long messageID) throws Throwable
+   protected void sendToDLQ(Long messageID, Transaction tx) throws Throwable
    {
       Delivery del = (Delivery)deliveries.remove(messageID);
+      
       if (del != null)
-      {     
-          del.cancel();
+      { 
+         log.warn(del.getReference() + " has exceed maximum delivery attempts and will be sent to the DLQ");
+         
+         if (dlq != null)
+         {         
+            //reset delivery count to zero
+            del.getReference().setDeliveryCount(0);
+            
+            dlq.handle(null, del.getReference(), tx);
+            
+            del.acknowledge(tx);           
+         }
+         else
+         {
+            log.warn("Cannot send to DLQ since DLQ has not been deployed! The message will be removed");
+            
+            del.acknowledge(tx);
+         }
       }
       else
       {
-          throw new IllegalStateException("Cannot find delivery to cancel:" + id);
+         throw new IllegalStateException("Cannot find delivery to send to DLQ:" + id);
       }
+      
    }
+   
+   protected void cancelDelivery(Long messageID, int deliveryCount) throws Throwable
+   {
+      Delivery del = (Delivery)deliveries.remove(messageID);
+      
+      if (del != null)
+      {                               
+         //Cancel back to the queue
+         
+         //Update the delivery count
+           
+         del.getReference().setDeliveryCount(deliveryCount);
+              
+         del.cancel();         
+      }
+      else
+      {
+         throw new IllegalStateException("Cannot find delivery to cancel:" + id);
+      }
+   }
                
    protected void start()
    {             
@@ -635,18 +703,37 @@
          // Flush any messages waiting to be sent to the client.
          this.executor.execute(new Deliverer());
          
-         // Now wait for it to execute.
-         Future result = new Future();
-         this.executor.execute(new Waiter(result));
-         result.getResult();
-             
+         if (trace) { log.trace(this + " flushed all remaining messages (if any) to the client"); }
+
          // Now we know any deliverer has delivered any outstanding messages to the client buffer.
       }
       catch (InterruptedException e)
       {
          log.warn("Thread interrupted", e);
       }
-            
+
+      // Make sure there are no messages in transit between server and client
+
+      synchronized(messagesInTransitLock)
+      {
+         int loopCount = 0;
+         while(messagesInTransitCount > 0 && loopCount < MESSAGES_IN_TRANSIT_WAIT_COUNT)
+         {
+            log.debug(this + " waiting for " + messagesInTransitCount + " message(s) in transit " +
+                      "to reach the client, " + (loopCount + 1) + " lock grab attempts.");
+            messagesInTransitLock.wait(500);
+            loopCount ++;
+         }
+
+         if (loopCount >= MESSAGES_IN_TRANSIT_WAIT_COUNT)
+         {
+            throw new IllegalStateException("Maximum number of lock grab attempts exceeded, " +
+                                            "giving up to wait for messages in transit");
+         }
+
+         if (trace) { log.trace(this + " has no messages in transit"); }
+      }
+
       // Now we know that there are no in flight messages on the way to the client consumer, but
       // there may be messages still in the toDeliver list since the client consumer might be full,
       // so we need to cancel these.
@@ -659,7 +746,7 @@
             {
                MessageProxy proxy = (MessageProxy)toDeliver.get(i);
                long id = proxy.getMessage().getMessageID();
-               cancelDelivery(new Long(id));
+               cancelDelivery(new Long(id), proxy.getMessage().getDeliveryCount());
             }
          }
                  
@@ -684,27 +771,7 @@
          if (trace) { log.trace(this + " removed from the queue"); }
       }
    }
-     
-   private void checkDeliveryCount(SimpleDelivery del)
-   {
-      //TODO - We need to put the message in a DLQ
-      // For now we just ack it otherwise the message will keep being retried and we'll never get
-      // anywhere
-      if (del.getReference().getDeliveryCount() > MAX_DELIVERY_ATTEMPTS)
-      {
-         log.warn(del.getReference() + " has exceed maximum delivery attempts and will be removed");
-         
-         try
-         {
-            del.acknowledge(null);
-         }
-         catch (Throwable t)
-         {
-            log.error("Failed to acknowledge delivery", t);
-         }
-      }                 
-   }
-   
+
    // Inner classes -------------------------------------------------   
    
    /*
@@ -718,8 +785,7 @@
    {
       public void run()
       {
-         // Is there anything to deliver?
-         // This is ok outside lock - is volatile.
+         // Is there anything to deliver? This is ok outside lock - is volatile.
          if (clientConsumerFull)
          {
             if (trace) { log.trace(this + " client consumer full, do nothing"); }
@@ -751,30 +817,33 @@
          
          int serverId = connection.getServerPeer().getServerPeerID();
 
+         // TODO How can we ensure that messages for the same consumer aren't delivered
+         // concurrently to the same consumer on different threads?
+
+         ClientDelivery del = new ClientDelivery(list, serverId, id);
+         MessagingMarshallable mm = new MessagingMarshallable(connection.getUsingVersion(), del);
+         Callback callback = new Callback(mm);
+
          try
          {
             if (trace) { log.trace(ServerConsumerEndpoint.this + " handing " + list.size() + " message(s) over to the remoting layer"); }
 
-            ClientDelivery del = new ClientDelivery(list, serverId, id);
+            synchronized(messagesInTransitLock)
+            {
+               connection.getCallbackHandler().handleCallback(callback);
+               messagesInTransitCount += list.size();
+            }
 
-            // TODO How can we ensure that messages for the same consumer aren't delivered
-            // concurrently to the same consumer on different threads?
-            MessagingMarshallable mm = new MessagingMarshallable(connection.getUsingVersion(), del);
-
-            MessagingMarshallable resp = (MessagingMarshallable)connection.getCallbackClient().invoke(mm);
-
             if (trace) { log.trace(ServerConsumerEndpoint.this + " handed messages over to the remoting layer"); }
 
-            HandleMessageResponse result = (HandleMessageResponse)resp.getLoad();
+            // We are NOT using Remoting's facility of acknowledging callbacks. A callback is sent
+            // asynchronously, and there is no confirmation that the callback reached the client or
+            // not.
 
-            // For now we don't look at how many messages are accepted since they all will be.
-            // The field is a placeholder for the future.
-            if (result.clientIsFull())
-            {
-               // Stop the server sending any more messages to the client.
-               // This is ok outside lock.
-               clientConsumerFull = true;
-            }
+            // TODO Previously, synchronous server-to-client invocations were used by the client
+            // to report back whether is full or not. This cannot be achieved with asynchronous
+            // callbacks, so the client must explicitely sent this information to the server,
+            // with an invocation on its own.
          }
          catch(Throwable t)
          {
@@ -872,5 +941,4 @@
          delList.add(new Long(messageID));
       }
    }
-   
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -21,6 +21,8 @@
   */
 package org.jboss.jms.server.endpoint;
 
+
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -66,6 +68,7 @@
 import org.jboss.messaging.core.plugin.postoffice.Binding;
 import org.jboss.messaging.core.plugin.postoffice.cluster.LocalClusteredQueue;
 import org.jboss.messaging.core.plugin.postoffice.cluster.RemoteQueueStub;
+import org.jboss.messaging.core.tx.Transaction;
 import org.jboss.messaging.core.tx.TransactionRepository;
 import org.jboss.util.id.GUID;
 
@@ -104,14 +107,16 @@
 
    private PersistenceManager pm;
    private MessageStore ms;
+
    private DestinationManager dm;
    private IdManager idm;
    private QueuedExecutorPool pool;
    private TransactionRepository tr;
    private PostOffice postOffice;
    private int nodeId;
+   private int maxDeliveryAttempts;
+   private Queue dlq;
 
-
    // Constructors --------------------------------------------------
 
    protected ServerSessionEndpoint(int sessionID, ServerConnectionEndpoint connectionEndpoint)
@@ -134,6 +139,10 @@
 
       consumers = new HashMap();
 		browsers = new HashMap();
+      
+      dlq = sp.getDLQ();
+      tr = sp.getTxRepository();
+      maxDeliveryAttempts = sp.getMaxDeliveryAttempts();
    }
 
    // SessionDelegate implementation --------------------------------
@@ -177,12 +186,17 @@
          int prefetchSize = connectionEndpoint.getPrefetchSize();
          
          ServerConsumerEndpoint ep =
-            new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(), binding.getQueue().getName(),
-                     this, selectorString, noLocal, jmsDestination, prefetchSize);
+            new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(),
+                                       binding.getQueue().getName(), this, selectorString, noLocal,
+                                       jmsDestination, prefetchSize, dlq);
+
          
          JMSDispatcher.instance.registerTarget(new Integer(consumerID), new ConsumerAdvised(ep));
          
-         ClientConsumerDelegate stub = new ClientConsumerDelegate(consumerID, binding.getQueue().getChannelID(), prefetchSize);
+         ClientConsumerDelegate stub =
+            new ClientConsumerDelegate(consumerID, binding.getQueue().getChannelID(),
+                                       prefetchSize, maxDeliveryAttempts);
+
          
          putConsumerEndpoint(consumerID, ep); // caching consumer locally
          
@@ -448,12 +462,15 @@
          int prefetchSize = connectionEndpoint.getPrefetchSize();
 
          ServerConsumerEndpoint ep =
-            new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(), binding.getQueue().getName(),
-                                       this, selectorString, noLocal, jmsDestination, prefetchSize);
+            new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(),
+                                       binding.getQueue().getName(), this, selectorString, noLocal,
+                                       jmsDestination, prefetchSize, dlq);
           
          JMSDispatcher.instance.registerTarget(new Integer(consumerID), new ConsumerAdvised(ep));
-                     
-         ClientConsumerDelegate stub = new ClientConsumerDelegate(consumerID, binding.getQueue().getChannelID(), prefetchSize);
+
+         ClientConsumerDelegate stub =
+            new ClientConsumerDelegate(consumerID, binding.getQueue().getChannelID(),
+                                       prefetchSize, maxDeliveryAttempts);
                        
          putConsumerEndpoint(consumerID, ep); // caching consumer locally
          
@@ -648,8 +665,8 @@
       {
          throw ExceptionUtil.handleJMSInvocation(t, this + " acknowledge");
       }
-   }      
-         
+   }
+
    public void cancelDeliveries(List ackInfos) throws JMSException
    {
       try
@@ -658,6 +675,8 @@
           
          Set consumers = new HashSet();
          
+         List forDLQ = null;
+         
          for (int i = ackInfos.size() - 1; i >= 0; i--)
          {
             AckInfo ack = (AckInfo)ackInfos.get(i);
@@ -671,10 +690,58 @@
                throw new IllegalArgumentException("Cannot find consumer id: " + ack.getConsumerID());
             }
             
-            consumer.cancelDelivery(new Long(ack.getMessageID()));
+            if (ack.getDeliveryCount() >= maxDeliveryAttempts)
+            {
+               if (forDLQ == null)
+               {
+                  forDLQ = new ArrayList();
+               }
+               
+               forDLQ.add(ack);
+            }
+            else
+            {            
+               consumer.cancelDelivery(new Long(ack.getMessageID()), ack.getDeliveryCount());
+            }
+            
             consumers.add(consumer);
          }
          
+         //Send stuff to DLQ
+         
+         if (forDLQ != null)
+         {
+            //We do this in a tx so we don't end up with the message in both the original queue
+            //and the dlq if it fails half way through
+            Transaction tx = tr.createTransaction();
+            
+            try
+            {               
+               for (int i = forDLQ.size() - 1; i >= 0; i--)
+               {
+                  AckInfo ack = (AckInfo)forDLQ.get(i);
+                  
+                  ServerConsumerEndpoint consumer =
+                     this.connectionEndpoint.getConsumerEndpoint(ack.getConsumerID());
+         
+                  if (consumer == null)
+                  {
+                     throw new IllegalArgumentException("Cannot find consumer id: " + ack.getConsumerID());
+                  }
+                  
+                  consumer.sendToDLQ(new Long(ack.getMessageID()), tx);                              
+               }
+               
+               tx.commit();
+            }
+            catch (Throwable t)
+            {
+               tx.rollback();
+               
+               throw t;
+            }
+         }
+         
          // need to prompt delivery for all consumers
          
          for(Iterator i = consumers.iterator(); i.hasNext(); )

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConsumerAdvised.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConsumerAdvised.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConsumerAdvised.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -73,6 +73,12 @@
    {
       endpoint.more();
    }
+
+   public void confirmDelivery(int count)
+   {
+      endpoint.confirmDelivery(count);
+   }
+
   
    // AdvisedSupport overrides --------------------------------------
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -37,8 +37,8 @@
 
 import org.jboss.aop.Dispatcher;
 import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.jms.client.remoting.CallbackServerFactory;
 import org.jboss.jms.client.remoting.HandleMessageResponse;
+import org.jboss.jms.client.remoting.CallbackManager;
 import org.jboss.jms.message.JBossMessage;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.server.Version;
@@ -50,6 +50,8 @@
 import org.jboss.messaging.core.plugin.IdBlock;
 import org.jboss.remoting.InvocationRequest;
 import org.jboss.remoting.InvocationResponse;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.invocation.InternalInvocation;
 import org.jboss.remoting.marshal.Marshaller;
 import org.jboss.remoting.marshal.UnMarshaller;
 import org.jboss.serial.io.JBossObjectInputStream;
@@ -81,7 +83,7 @@
 
    private static final Logger log = Logger.getLogger(JMSWireFormat.class);
    
-   private static boolean usingJBossSerialization;
+   private static boolean usingJBossSerialization = true;
 
    // The request codes  - start from zero
 
@@ -103,6 +105,7 @@
    protected static final byte HANDLE_MESSAGE_RESPONSE = 103;
    protected static final byte BROWSE_MESSAGE_RESPONSE = 104;
    protected static final byte BROWSE_MESSAGES_RESPONSE = 105;
+   protected static final byte CALLBACK_LIST = 106;
 
 
    // Static --------------------------------------------------------
@@ -122,21 +125,33 @@
    {
       trace = log.isTraceEnabled();
    }
-   
-   
 
    // Marshaller implementation -------------------------------------
 
    public void write(Object obj, OutputStream out) throws IOException
    {          
-      //Sanity check
-      if (!(out instanceof MessagingObjectOutputStream))
+      DataOutputStream dos;
+      
+      if (out instanceof DataOutputStream)
       {
-         throw new IllegalStateException("Must be MessagingObjectOutputStream");
+         dos = (DataOutputStream)out;
       }
-      
-      DataOutputStream dos = (DataOutputStream)(((MessagingObjectOutputStream)out).getUnderlyingStream());
-            
+      else
+      {
+         //Further sanity check
+         if (out instanceof ObjectOutputStream)
+         {
+            throw new IllegalArgumentException("Invalid stream - are you sure you have configured socket wrappers?");
+         }
+         
+         //This would be the case for the HTTP transport for example
+         //Wrap the stream
+         
+         //TODO Ideally remoting would let us wrap this before invoking the marshaller
+         //but this does not appear to be possible
+         dos = new DataOutputStream(out);
+      }
+                  
       handleVersion(obj, dos);
 
       try
@@ -148,9 +163,26 @@
             InvocationRequest req = (InvocationRequest)obj;
    
             Object param;
-   
-            if (req.getParameter() instanceof MessagingMarshallable)
+            
+            // Unwrap Callback.
+            if (req.getParameter() instanceof InternalInvocation)
             {
+               InternalInvocation ii = (InternalInvocation) req.getParameter();
+               Object[] params = ii.getParameters();
+               
+               if (params != null && params.length > 0 && params[0] instanceof Callback)
+               {
+                  Callback callback = (Callback) params[0];
+                  MessagingMarshallable mm = (MessagingMarshallable)callback.getParameter();
+                  param = mm.getLoad();
+               }
+               else
+               {
+                  param = req.getParameter();
+               }
+            }
+            else if (req.getParameter() instanceof MessagingMarshallable)
+            {
                param = ((MessagingMarshallable)req.getParameter()).getLoad();
             }
             else
@@ -299,6 +331,8 @@
                ClientDelivery dr = (ClientDelivery)param;
    
                dos.writeByte(CALLBACK);
+               
+               dos.writeUTF(req.getSessionId());
    
                dr.write(dos);
    
@@ -409,6 +443,37 @@
                
                if (trace) { log.trace("wrote browse message response"); }
             }
+            else if (res instanceof ArrayList &&
+                     ((ArrayList) res).size() > 0 &&
+                     ((ArrayList) res).get(0) instanceof Callback)
+            {
+               // Comes from polled Callbacks.
+               ArrayList callbackList = (ArrayList)res;
+               dos.write(CALLBACK_LIST);
+               dos.writeUTF(resp.getSessionId());
+               dos.writeInt(callbackList.size());
+               
+               Iterator it = callbackList.iterator();
+               while (it.hasNext())
+               {
+                  Callback callback = (Callback)it.next();
+
+                  // We don't use acknowledgeable push callbacks
+
+//                  Map payload = callback.getReturnPayload();
+//                  String guid = (String)payload.get(ServerInvokerCallbackHandler.CALLBACK_ID);
+//                  dos.writeUTF(guid);
+//                  String listenerId = (String)payload.get(Client.LISTENER_ID_KEY);
+//                  dos.writeUTF(listenerId);
+//                  String acks = (String)payload.get(ServerInvokerCallbackHandler.REMOTING_ACKNOWLEDGES_PUSH_CALLBACKS);
+//                  dos.writeUTF(acks);
+                  
+                  MessagingMarshallable mm = (MessagingMarshallable)callback.getParameter();
+                  ClientDelivery delivery = (ClientDelivery)mm.getLoad();
+                  delivery.write(dos);
+                  dos.flush();
+               }
+            }
             else
             {
                dos.write(SERIALIZED);
@@ -440,15 +505,29 @@
    // UnMarshaller implementation -----------------------------------
 
    public Object read(InputStream in, Map map) throws IOException, ClassNotFoundException
-   {      
-      // Sanity check
-      if (!(in instanceof MessagingObjectInputStream))
+   {            
+      DataInputStream dis;
+      
+      if (in instanceof DataInputStream)
       {
-         throw new IllegalStateException("Must be MessagingObjectInputStream");
+         dis = (DataInputStream)in;         
       }
+      else
+      {        
+         //Further sanity check
+         if (in instanceof ObjectInputStream)
+         {
+            throw new IllegalArgumentException("Invalid stream - are you sure you have configured socket wrappers?");
+         }
+         
+         //This would be the case for the HTTP transport for example
+         //Wrap the stream
+         
+         //TODO Ideally remoting would let us wrap this before invoking the marshaller
+         //but this does not appear to be possible
+         dis = new DataInputStream(in);
+      }
       
-      DataInputStream dis = (DataInputStream)(((MessagingObjectInputStream)in).getUnderlyingStream());
-
       // First byte read is always version
 
       byte version = dis.readByte();
@@ -693,18 +772,51 @@
             }
             case CALLBACK:
             {
+               String sessionId = dis.readUTF();
                ClientDelivery dr = new ClientDelivery();
                
                dr.read(dis);
+
+               // Recreate Callback.
+               MessagingMarshallable mm = new MessagingMarshallable(version, dr);
+               Callback callback = new Callback(mm);
+               InternalInvocation ii
+                  = new InternalInvocation(InternalInvocation.HANDLECALLBACK, new Object[]{callback});
+               InvocationRequest request
+                  = new InvocationRequest(sessionId, CallbackManager.JMS_CALLBACK_SUBSYSTEM,
+                                          ii, null, null, null);
    
-               InvocationRequest request =
-                  new InvocationRequest(null, CallbackServerFactory.JMS_CALLBACK_SUBSYSTEM,
-                                        new MessagingMarshallable(version, dr), null, null, null);
-   
                if (trace) { log.trace("read callback()"); }
    
                return request;
             }
+            case CALLBACK_LIST:
+            {
+               // Recreate ArrayList of Callbacks (for Callback polling).
+               String sessionId = dis.readUTF();
+               int size = dis.readInt();
+               ArrayList callbackList = new ArrayList(size);
+               for (int i = 0; i < size; i++)
+               {
+                  // We don't use acknowledgeable push callbacks
+
+//                  String guid = dis.readUTF();
+//                  String listenerId = dis.readUTF();
+//                  String acks = dis.readUTF();
+                  ClientDelivery delivery = new ClientDelivery();
+                  delivery.read(dis);
+                  MessagingMarshallable mm = new MessagingMarshallable(version, delivery);
+                  Callback callback = new Callback(mm);
+//                  HashMap payload = new HashMap();
+//                  payload.put(ServerInvokerCallbackHandler.CALLBACK_ID, guid);
+//                  payload.put(Client.LISTENER_ID_KEY, listenerId);
+//                  payload.put(ServerInvokerCallbackHandler.REMOTING_ACKNOWLEDGES_PUSH_CALLBACKS, acks);
+//                  callback.setReturnPayload(payload);
+                  callbackList.add(callback);
+               }
+
+               return new InvocationResponse(sessionId, callbackList, false, null);
+            }
             default:
             {
                throw new IllegalStateException("Invalid format type " + formatType);
@@ -823,9 +935,7 @@
          ois = new ObjectInputStream(is);
       }
       
-      Object obj = ois.readObject();
-      
-      return obj;
+      return ois.readObject();
    }
 
    // Inner classes -------------------------------------------------

Deleted: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectInputStream.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectInputStream.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectInputStream.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,201 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * 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.jms.server.remoting;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InvalidObjectException;
-import java.io.NotActiveException;
-import java.io.ObjectInputStream;
-import java.io.ObjectInputValidation;
-
-/**
- * A MessagingObjectInputStream
- * 
- * See comment in MessagingSerializationManager
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class MessagingObjectInputStream extends ObjectInputStream
-{
-   private InputStream in;
-
-   public MessagingObjectInputStream(InputStream in) throws IOException, SecurityException
-   {
-      this.in = in;     
-   }
-   
-   public InputStream getUnderlyingStream()
-   {
-      return in;
-   }
-
-   public int available() throws IOException
-   {
-      return in.available();
-   }
-
-   public void close() throws IOException
-   {
-      in.close();
-   }
-
-   public boolean equals(Object obj)
-   {
-      return in.equals(obj);
-   }
-
-   public int hashCode()
-   {
-      return in.hashCode();
-   }
-
-   public void mark(int readlimit)
-   {
-      in.mark(readlimit);
-   }
-
-   public boolean markSupported()
-   {
-      return in.markSupported();
-   }
-
-   public int read() throws IOException
-   {
-      return in.read();
-   }
-
-   public int read(byte[] b, int off, int len) throws IOException
-   {
-      return in.read(b, off, len);
-   }
-
-   public int read(byte[] b) throws IOException
-   {
-      return in.read(b);
-   }
-
-   public void reset() throws IOException
-   {
-      in.reset();
-   }
-
-   public long skip(long n) throws IOException
-   {
-      return in.skip(n);
-   }
-
-   public String toString()
-   {
-      return in.toString();
-   }
-
-   public void defaultReadObject() throws IOException, ClassNotFoundException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public boolean readBoolean() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public byte readByte() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public char readChar() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public double readDouble() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public GetField readFields() throws IOException, ClassNotFoundException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public float readFloat() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void readFully(byte[] buf, int off, int len) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void readFully(byte[] buf) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public int readInt() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public long readLong() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public short readShort() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public Object readUnshared() throws IOException, ClassNotFoundException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public int readUnsignedByte() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public int readUnsignedShort() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public String readUTF() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void registerValidation(ObjectInputValidation obj, int prio) throws NotActiveException, InvalidObjectException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-}

Deleted: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectOutputStream.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectOutputStream.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingObjectOutputStream.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * 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.jms.server.remoting;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-/**
- * A MessagingObjectOutputStream
- * 
- * See comment in MessagingSerializationManager
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class MessagingObjectOutputStream extends ObjectOutputStream
-{
-   private OutputStream out;
-   
-   public MessagingObjectOutputStream(OutputStream out) throws IOException
-   {
-      this.out = out;
-   }
-   
-   public OutputStream getUnderlyingStream()
-   {
-      return out;
-   }
-
-   public void close() throws IOException
-   {
-      out.close();
-   }
-
-   public boolean equals(Object obj)
-   {
-      return out.equals(obj);
-   }
-
-   public void flush() throws IOException
-   {
-      out.flush();
-   }
-
-   public void write(byte[] b, int off, int len) throws IOException
-   {
-      out.write(b, off, len);
-   }
-
-   public void write(byte[] b) throws IOException
-   {
-      out.write(b);
-   }
-
-   public void write(int b) throws IOException
-   {
-      out.write(b);
-   }
-
-   public void defaultWriteObject() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public PutField putFields() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void reset() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void useProtocolVersion(int version) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeBoolean(boolean val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeByte(int val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeBytes(String str) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeChar(int val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeChars(String str) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeDouble(double val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeFields() throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeFloat(float val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeInt(int val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeLong(long val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeShort(int val) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeUnshared(Object obj) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void writeUTF(String str) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-}

Deleted: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingSerializationManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingSerializationManager.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MessagingSerializationManager.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * 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.jms.server.remoting;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import org.jboss.remoting.serialization.IMarshalledValue;
-import org.jboss.remoting.serialization.SerializationManager;
-
-/**
- * A MessagingSerializationManager
- * 
- * This class and the related ObjectInputStream and ObjectOutputStream classes
- * are a hack to work around a limitiation of JBoss remoting whereby it always assumes
- * the createInput and createOutput methods always return an ObjectInput/OutputStream
- * For the purposes of messaging we want the marshaller and the server and client invokers
- * to use the underlying stream instead, since we do not want all the extra crap that the object input/output
- * streams add to the stream (headers)
- * This should really be fixed properly in remoting
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class MessagingSerializationManager extends SerializationManager
-{
-   public IMarshalledValue createdMarshalledValue(Object arg0) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public ObjectInputStream createInput(InputStream in, ClassLoader cl) throws IOException
-   {
-      return new MessagingObjectInputStream(new DataInputStream(in));
-   }
-   
-   public ObjectOutputStream createOutput(OutputStream out) throws IOException
-   {
-      return new MessagingObjectOutputStream(new DataOutputStream(out));
-   }
-
-   public IMarshalledValue createMarshalledValueForClone(Object arg0) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-  
-   public Object receiveObject(InputStream arg0, ClassLoader arg1) throws IOException, ClassNotFoundException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void sendObject(ObjectOutputStream arg0, Object arg1) throws IOException
-   {
-      throw new UnsupportedOperationException();
-   }
-}

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -46,7 +46,7 @@
    public static final String VERSION_NUMBER = "VERSION_NUMBER";
    
    public static final String JMS_CLIENT_VM_ID = "JMS_CLIENT_VM_ID";
-   
+
    public static final String CF_DELEGATES = "CF_DELEGATES";
    
    public static final String SERVER_ID = "SERVER_ID";
@@ -56,4 +56,6 @@
    public static final String FAILOVER_MAP = "CF_FAIL_IND";
    
    public static final String CONNECTION_VERSION = "CONNECTION_VERSION";
+
+   public static final String MAX_DELIVERIES = "MAX_DELS";
 }

Copied: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java (from rev 1764, trunk/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java)

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/AckInfo.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/AckInfo.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/AckInfo.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -44,10 +44,8 @@
    
    protected long messageID;
    protected int consumerID;
+   protected int deliveryCount;
 
-   // One of Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, etc.
-   private int ackMode;
-   
    protected MessageProxy msg;
    
    // Static --------------------------------------------------------
@@ -60,28 +58,17 @@
 
    public AckInfo(MessageProxy proxy, int consumerID)
    {
-      this(proxy, consumerID, -1);
-   }
-
-   /**
-    * @param ackMode - one of Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, etc.
-    */
-   public AckInfo(MessageProxy proxy, int consumerID, int ackMode)
-   {
       this.msg = proxy;
       this.messageID = proxy.getMessage().getMessageID();
       this.consumerID = consumerID;
-      this.ackMode = ackMode;
    }
    
-   /**
-    * @param ackMode - one of Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, etc.
-    */
-   public AckInfo(long messageID, int consumerID, int ackMode)
+   //Only used for testing
+   public AckInfo(long messageID, int consumerID, int deliveryCount)
    {
       this.messageID = messageID;
       this.consumerID = consumerID;
-      this.ackMode = ackMode;
+      this.deliveryCount = deliveryCount;
    }
 
    // Public --------------------------------------------------------
@@ -106,15 +93,17 @@
    {
       return msg;
    }
-
-   /**
-    *
-    * @return one of Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE ..., or -1 if it has not
-    *         previously set
-    */
-   public int getAckMode()
+   
+   public int getDeliveryCount()
    {
-      return ackMode;
+      if (msg == null)
+      {
+         return deliveryCount;
+      }
+      else
+      {
+         return msg.getDeliveryCount();
+      }
    }
 
    public String toString()
@@ -128,12 +117,21 @@
    {
      out.writeLong(messageID);
      out.writeInt(consumerID);
+     if (msg != null)
+     {
+        out.writeInt(msg.getDeliveryCount());
+     }
+     else
+     {
+        out.writeInt(deliveryCount);
+     }
    }
 
    public void read(DataInputStream in) throws Exception
    {
       messageID = in.readLong();
       consumerID = in.readInt();
+      deliveryCount = in.readInt();
    }
    
    // Class YYY overrides -------------------------------------------

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/ResourceManager.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/tx/ResourceManager.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -345,6 +345,11 @@
          sess.redeliver(acks);
       }  
    }
+   
+   public int size()
+   {
+      return transactions.size();
+   }
 
    // Protected ------------------------------------------------------
    

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/util/XMLUtil.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/util/XMLUtil.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/util/XMLUtil.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -64,7 +64,8 @@
 
       if (Node.CDATA_SECTION_NODE == type)
       {
-         return  n.getNodeValue();
+         //return "<![CDATA[" + n.getNodeValue() + "]]>";
+         return n.getNodeValue();
       }
 
       if (name.startsWith("#"))

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -555,8 +555,7 @@
                {
                   // Reference is not expired
 
-                  // Attempt to push the ref to a receiver, so increment the delivery count
-                  ref.incrementDeliveryCount();
+                  // Attempt to push the ref to a receiver
 
                   Delivery del = router.handle(this, ref, null);
 
@@ -564,23 +563,17 @@
                   
                   if (del == null)
                   {
-                     // No receiver, broken receiver or full receiver so we stop delivering; also
-                     // we need to decrement the delivery count, as no real delivery has been actually performed
-
+                     // No receiver, broken receiver or full receiver so we stop delivering
                      if (trace) { log.trace(this + ": no delivery returned for message" + ref + " so no receiver got the message. Delivery is now complete"); }
 
-                     ref.decrementDeliveryCount();
-                     
                      break;
                   }
                   else if (!del.isSelectorAccepted())
                   {
                      // No receiver accepted the message because no selectors matched, so we create
                      // an iterator (if we haven't already created it) to iterate through the refs
-                     // in the channel. No delivery was really performed, so we decrement the delivery count
-
-                     ref.decrementDeliveryCount();
-
+                     // in the channel. No delivery was really performed
+                     
                      if (iter == null)
                      {
                         iter = messageRefs.iterator();
@@ -788,8 +781,8 @@
       if (trace) { log.trace(this + " removed " + d + " from memory:" + removed); }
       
       return removed;
-   }     
-
+   }    
+   
    protected InMemoryCallback getCallback(Transaction tx, boolean synchronous)
    {
       InMemoryCallback callback = (InMemoryCallback) tx.getCallback(this);            
@@ -811,7 +804,9 @@
 
       return callback;
    }
+
    
+   
    protected boolean cancelInternal(Delivery del) throws Exception
    {
       if (trace) { log.trace(this + " cancelling " + del + " in memory"); }
@@ -829,9 +824,17 @@
       }
       else
       {
-         messageRefs.addFirst(del.getReference(), del.getReference().getPriority());
+         MessageReference ref = del.getReference();
          
-         if (trace) { log.trace(this + " added " + del.getReference() + " back into state"); }
+         messageRefs.addFirst(ref, ref.getPriority());
+         
+         //We may need to update the delivery count in the database
+         if (ref.isReliable())
+         {
+            pm.updateDeliveryCount(this.channelID, ref);
+         }
+         
+         if (trace) { log.trace(this + " added " + ref + " back into state"); }
       }
       
       return removed;

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/Routable.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/Routable.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/Routable.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -83,23 +83,12 @@
    void setPriority(byte priority);
 
    /**
-    * @return true if the delivery of this message had to be repeated at least once.
-    */
-   boolean isRedelivered();
-
-   void setRedelivered(boolean redelivered);
-   
-   /**
     * @return the number of times delivery has been attempted for this routable
     */
    int getDeliveryCount();
    
    void setDeliveryCount(int deliveryCount);
    
-   void incrementDeliveryCount();
-   
-   void decrementDeliveryCount();
-   
    /**
     * Binds a header. If the header map previously contained a mapping for this name, the old value
     * is replaced by the specified value.

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/message/RoutableSupport.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/message/RoutableSupport.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/message/RoutableSupport.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -57,7 +57,6 @@
    protected long expiration;
    protected long timestamp;
    protected Map headers;
-   protected boolean redelivered;
    protected byte priority;
    protected int deliveryCount;   
 
@@ -111,7 +110,6 @@
       this.timestamp = timestamp;
       this.priority = priority;
       this.deliveryCount = deliveryCount;
-      this.redelivered = deliveryCount >= 2;
       if (headers == null)
       {
          this.headers = new HashMap();
@@ -129,7 +127,6 @@
       this.expiration = other.expiration;
       this.timestamp = other.timestamp;
       this.headers = new HashMap(other.headers);
-      this.redelivered = other.redelivered;
       this.deliveryCount = other.deliveryCount;
       this.priority = other.priority;  
    }
@@ -155,17 +152,7 @@
    {
       return timestamp;
    }
-
-   public boolean isRedelivered()
-   {
-      return redelivered;
-   }
-
-   public void setRedelivered(boolean redelivered)
-   {
-      this.redelivered = redelivered;      
-   }
-   
+ 
    public void setReliable(boolean reliable)
    {
       this.reliable = reliable;
@@ -189,10 +176,6 @@
    public void setDeliveryCount(int deliveryCount)
    {
       this.deliveryCount = deliveryCount;
-      if (deliveryCount > 0)
-      {
-         this.redelivered = true;
-      }
    }
 
    public Serializable putHeader(String name, Serializable value)
@@ -244,7 +227,7 @@
       out.writeLong(expiration);
       out.writeLong(timestamp);
       StreamUtils.writeMap(out, headers, true);
-      out.writeBoolean(redelivered);
+    //  out.writeBoolean(redelivered);
       out.writeByte(priority);
       out.writeInt(deliveryCount);
    }
@@ -264,7 +247,7 @@
       {
          headers = (HashMap)m;
       }
-      redelivered = in.readBoolean();
+     // redelivered = in.readBoolean();
       priority = in.readByte();
       deliveryCount = in.readInt();
    }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -82,7 +82,7 @@
    // Constants -----------------------------------------------------
    
    private static final Logger log = Logger.getLogger(JDBCPersistenceManager.class); 
-   
+
    // Static --------------------------------------------------------
    
    // Attributes ----------------------------------------------------
@@ -1402,6 +1402,57 @@
       }
    }
    
+   public void updateDeliveryCount(long channelID, MessageReference ref) throws Exception
+   {
+      TransactionWrapper wrap = new TransactionWrapper();
+      
+      PreparedStatement psReference = null;
+      
+      Connection conn = ds.getConnection();
+       
+      try
+      {                                    
+         psReference = conn.prepareStatement(getSQLStatement("UPDATE_DELIVERYCOUNT"));
+         
+         psReference.setInt(1, ref.getDeliveryCount());
+         
+         psReference.setLong(2, channelID);
+         
+         psReference.setLong(3, ref.getMessageID());
+         
+         int rows = psReference.executeUpdate();                         
+      }
+      catch (Exception e)
+      {
+         wrap.exceptionOccurred();
+         throw e;
+      }
+      finally
+      {
+         if (psReference != null)
+         {
+            try
+            {
+               psReference.close();
+            }
+            catch (Throwable t)
+            {
+            }
+         }         
+         if (conn != null)
+         {
+            try
+            {
+               conn.close();
+            }
+            catch (Throwable t)
+            {
+            }
+         }
+         wrap.end();                        
+      }  
+   }
+   
    public void removeReference(long channelID, MessageReference ref, Transaction tx) throws Exception
    {      
       if (tx != null)
@@ -1668,7 +1719,7 @@
    public String toString()
    {
       return "JDBCPersistenceManager[" + Integer.toHexString(hashCode()) + "]";
-   }
+   }   
    
    // Package protected ---------------------------------------------
    
@@ -3229,6 +3280,7 @@
       map.put("UPDATE_RELIABLE_REFS_NOT_PAGED", "UPDATE JMS_MESSAGE_REFERENCE SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNELID=?");       
       map.put("SELECT_MIN_MAX_PAGE_ORD", "SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID = ?");
       map.put("SELECT_EXISTS_REF", "SELECT MESSAGEID FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID = ? AND MESSAGEID = ?");
+      map.put("UPDATE_DELIVERYCOUNT", "UPDATE JMS_MESSAGE_REFERENCE SET DELIVERYCOUNT = ? WHERE CHANNELID = ? AND MESSAGEID = ?");
       //Message
       map.put("LOAD_MESSAGES",
               "SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, " +

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -74,7 +74,7 @@
    {
       this(holder.getMessage().getMessageID(), holder.getMessage().isReliable(),
            holder.getMessage().getExpiration(), holder.getMessage().getTimestamp(),
-           holder.getMessage().getHeaders(), holder.getMessage().isRedelivered(),
+           holder.getMessage().getHeaders(), holder.getMessage().getDeliveryCount(),
            holder.getMessage().getPriority(), ms);
 
       this.holder = holder;
@@ -88,7 +88,7 @@
    public SimpleMessageReference(SimpleMessageReference other)
    {
       this(other.getMessageID(), other.isReliable(), other.getExpiration(),
-           other.getTimestamp(), other.getHeaders(), other.isRedelivered(),
+           other.getTimestamp(), other.getHeaders(), other.getDeliveryCount(),
            other.getPriority(), other.ms);
       
       this.headers = other.headers;
@@ -96,11 +96,11 @@
    }
    
    protected SimpleMessageReference(long messageID, boolean reliable, long expiration,
-                                    long timestamp, Map headers, boolean redelivered,
+                                    long timestamp, Map headers, int deliveryCount,
                                     byte priority, MessageStore ms)
    {
       super(messageID, reliable, expiration, timestamp, priority, 0, headers);
-      this.redelivered = redelivered;
+      this.deliveryCount = deliveryCount;
       this.ms = ms;
    }
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -40,13 +40,16 @@
    void addReference(long channelID, MessageReference ref, Transaction tx) throws Exception;
 
    void removeReference(long channelID, MessageReference ref, Transaction tx) throws Exception;
-    
+   
+   void updateDeliveryCount(long channelID, MessageReference ref) throws Exception;
+   
+
    // XA Recovery functionality
    
    List retrievePreparedTransactions() throws Exception;
       
    // Paging functionality - TODO we should split this out into its own interface
-   
+
    void pageReferences(long channelID, List references, boolean paged) throws Exception;
    
    void removeDepagedReferences(long channelID, List refs) throws Exception;

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -90,10 +90,13 @@
    public List getPreparedTransactions()
    {
       ArrayList prepared = new ArrayList();
+      
       Iterator iter = globalToLocalMap.values().iterator();
+      
       while (iter.hasNext())
       {
          Transaction tx = (Transaction)iter.next();
+         
          if (tx.xid != null && tx.getState() == Transaction.STATE_PREPARED)
          {
             prepared.add(tx.getXid());
@@ -118,7 +121,9 @@
          while (iter.hasNext())
          {
             Xid xid = (Xid)iter.next();
-            Transaction tx = createTransaction(xid);            
+            
+            Transaction tx = createTransaction(xid);   
+            
             tx.state = Transaction.STATE_PREPARED;
             
             //Load the references for this transaction
@@ -145,20 +150,17 @@
 	   final Xid id = transaction.getXid();
 	   final int state = transaction.getState();
 	   
-	   if (id==null)
+	   if (id == null)
 	   {
-		   Exception ex = new Exception();
-		   log.warn("DeleteTransaction was called for non XA transaction",ex);
-		   return;
+		   throw new IllegalArgumentException("DeleteTransaction was called for non XA transaction");
 	   }
 
-	   if (state!=Transaction.STATE_COMMITTED && state!=Transaction.STATE_ROLLEDBACK)
+	   if (state != Transaction.STATE_COMMITTED && state != Transaction.STATE_ROLLEDBACK)
 	   {
 		   throw new TransactionException("Transaction with xid " + id + " can't be removed as it's not yet commited or rolledback: (Current state is " + Transaction.stateToString(state));
 	   }
 	   
-	   globalToLocalMap.remove(id);
-	   
+	   globalToLocalMap.remove(id);	   
    }
    
    public Transaction createTransaction(Xid xid) throws Exception

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example	2006-12-11 20:50:25 UTC (rev 1765)
@@ -15,11 +15,17 @@
 TEST_DATABASE=hsqldb
 
 #
+# The transport to run tests with. Valid values: "socket", "http". The value specified here
+# overrides the value specified in container.xml.
+#
+
+TEST_REMOTING=socket
+
+#
 # Each test can be run in clustered or non-clustered mode. However, setting CLUSTERED to "true"
 # doesn't guarantee that the test will be actually run in clustered mode, the test database must
 # be also permitting sharing over a LAN. "mysql" allows this, "hsqldb" doesn't. The test will
 # quickly fail in such a situation.
-#
 # It is also possible to configure a test to run in clustered mode by using the "-clustered"
 # switch.
 #

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/runtest
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/runtest	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/runtest	2006-12-11 20:50:25 UTC (rev 1765)
@@ -22,6 +22,7 @@
 ENV_TEST_DATABASE=$TEST_DATABASE
 ENV_TEST_SERIALIZATION=$TEST_SERIALIZATION
 ENV_TEST_CLUSTERED=$TEST_CLUSTERED
+ENV_TEST_REMOTING=$TEST_REMOTING
 
 if [ -z "$TARGET_CLASS" -a -f $reldir/.testrc ]; then
    . $reldir/.testrc
@@ -35,6 +36,7 @@
 if [ "$ENV_TEST_DATABASE" != "" ]; then
    TEST_DATABASE=$ENV_TEST_DATABASE
 fi
+
 if [ "$ENV_TEST_SERIALIZATION" != "" ]; then
    TEST_SERIALIZATION=$ENV_TEST_SERIALIZATION
 fi
@@ -42,6 +44,12 @@
    TEST_CLUSTERED=$ENV_TEST_CLUSTERED
 fi
 
+if [ "$ENV_TEST_REMOTING" != "" ]; then
+   TEST_REMOTING=$ENV_TEST_REMOTING
+fi
+
+TEST_REMOTING=http
+
 #
 # We should use the same test execution classpath as the ant <junit> task, so we run ant to get
 # it from there.
@@ -104,7 +112,7 @@
     shift
 done
 
-JAVA_OPTS="-Xmx1024M $JAVA_OPTS -Dmodule.output=$reldir/../output $REMOTE_TEST -Dtest.database=$TEST_DATABASE -Dtest.serialization=$TEST_SERIALIZATION -Dtest.clustered=$TEST_CLUSTERED -Dbuild.lib=../../output/lib"
+JAVA_OPTS="-Xmx1024M $JAVA_OPTS -Dmodule.output=$reldir/../output $REMOTE_TEST -Dtest.database=$TEST_DATABASE -Dtest.serialization=$TEST_SERIALIZATION -Dtest.clustered=$TEST_CLUSTERED -Dtest.remoting=$TEST_REMOTING -Dbuild.lib=../../output/lib"
 
 if [ "$TARGET_TEST" != "" ]; then
    TARGET_TEST="-t $TARGET_TEST"
@@ -127,7 +135,7 @@
 
 if [ "$isRemote" = "true" ]; then
 
-  export TEST_DATABASE TEST_SERIALIZATION TEST_CLUSTERED
+  export TEST_DATABASE TEST_SERIALIZATION TEST_CLUSTERED TEST_REMOTING
 
   $reldir/start-rmi-server $REMOTE_DEBUG_FLAG_0 -use-existent-test-classpath-file -index 0
 

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server	2006-12-11 20:50:25 UTC (rev 1765)
@@ -66,6 +66,10 @@
    JAVA_OPTS="$JAVA_OPTS -Dtest.server.index=$index"
 fi
 
+if [ "$TEST_REMOTING" != "" ]; then
+   JAVA_OPTS="$JAVA_OPTS -Dtest.remoting=$TEST_REMOTING"
+fi
+
 if [ "$USE_EXISTENT_TEST_CLASSPATH_FILE" = "true" ]; then
    CLASSPATH_FILE="$reldir/.test.execution.classpath"
 else

Modified: branches/Branch_Client_Failover_Experiment/tests/build.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/build.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/build.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -71,6 +71,11 @@
    <property name="clustering.tests.database" value="mysql"/>
 
    <!--
+        Default remoting configuration (must be overrided by tasks that need it set otherwise).
+   -->
+   <property name="test.remoting" value="socket"/>
+
+   <!--
         Project paths.
    -->
 
@@ -188,6 +193,8 @@
       <path refid="mysql.jdbc.driver.classpath"/>
       <path refid="oracle.jdbc.driver.classpath"/>
       <path refid="postgres.jdbc.driver.classpath"/>
+      <path refid="apache.tomcat.classpath"/>
+      <path refid="apache.logging.classpath"/>
    </path>
 
    <path id="stress.test.execution.classpath">
@@ -270,6 +277,7 @@
          <sysproperty key="test.bind.address" value="${test.bind.address}"/>
          <sysproperty key="test.database" value="${functional.tests.database}"/>
          <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.remoting" value="${test.remoting}"/>
          <!--
          <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
          -->
@@ -305,6 +313,7 @@
          <sysproperty key="test.bind.address" value="${test.bind.address}"/>
          <sysproperty key="test.database" value="${stress.tests.database}"/>
          <sysproperty key="test.serialization" value="${stress.tests.serialization}"/>
+         <sysproperty key="test.remoting" value="${test.remoting}"/>
          <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/> -->
          <classpath refid="stress.test.execution.classpath"/>
       </java>
@@ -331,12 +340,18 @@
    <target name="tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
       <antcall target="crash-tests"/>
       <antcall target="invm-tests"/>
-      <antcall target="remote-tests"/>
+      <antcall target="remote-tests"/>  <!-- default remoting configuration (socket) -->
+      <antcall target="remote-tests">
+         <param name="test.remoting" value="http"/>
+      </antcall>
    </target>
 
    <target name="stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
       <antcall target="invm-stress-tests"/>
-      <antcall target="remote-stress-tests"/>
+      <antcall target="remote-stress-tests"/>  <!-- default remoting configuration (socket) -->
+      <antcall target="remote-stress-tests">
+         <param name="test.remoting" value="http"/>
+      </antcall>
    </target>
 
    <target name="invm-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
@@ -379,6 +394,7 @@
                <exclude name="**/jms/MemLeakTest.class"/>
                <exclude name="**/jms/manual/**/*Test.class"/>
                <exclude name="**/jms/clustering/*Test.class"/>
+               <exclude name="**/jms/RemotingConnectionConfigurationTest.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -506,7 +522,7 @@
       <mkdir dir="${build.tests.reports}"/>
 
       <echo message=""/>
-      <echo message="Running remote tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message="Running remote tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}, remoting=${test.remoting}"/>
       <echo message=""/>
 
       <junit printsummary="${junit.printsummary}"
@@ -522,6 +538,7 @@
          <sysproperty key="test.bind.address" value="${test.bind.address}"/>
          <sysproperty key="test.database" value="${functional.tests.database}"/>
          <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.remoting" value="${test.remoting}"/>
          <jvmarg value="-Xmx512M"/>
          <!--
          <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
@@ -542,9 +559,9 @@
             usefile="${junit.formatter.usefile}" extension="-Remote.xml"/>
          -->
 
-         <sysproperty key="messaging-test-configuration" value="Remote"/>
+         <sysproperty key="messaging-test-configuration" value="Remote-${test.remoting}"/>
          <formatter classname="org.jboss.test.messaging.tools.ant.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Remote.xml"/>
+                    usefile="${junit.formatter.usefile}" extension="-Remote-${test.remoting}.xml"/>
 
          <batchtest fork="${junit.batchtest.fork}"
                     todir="${junit.batchtest.todir}"
@@ -592,6 +609,7 @@
          <sysproperty key="test.bind.address" value="${test.bind.address}"/>
          <sysproperty key="test.database" value="${stress.tests.database}"/>
          <sysproperty key="test.serialization" value="${stress.tests.serialization}"/>
+         <sysproperty key="test.remoting" value="${test.remoting}"/>
          <jvmarg value="-Xmx512M"/>
          <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=unittest"/> -->
          <classpath>
@@ -609,9 +627,9 @@
             usefile="${junit.formatter.usefile}" extension="-Remote.xml"/>
          -->
 
-         <sysproperty key="messaging-test-configuration" value="StressRemote"/>
+         <sysproperty key="messaging-test-configuration" value="StressRemote-${test.remoting}"/>
          <formatter classname="org.jboss.test.messaging.tools.ant.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-StressRemote.xml"/>
+                    usefile="${junit.formatter.usefile}" extension="-StressRemote-${test.remoting}.xml"/>
 
          <batchtest fork="${junit.batchtest.fork}"
                     todir="${junit.batchtest.todir}"
@@ -762,42 +780,136 @@
       description="Runs crash tests">
 
       <antcall target="stop-rmi-server"/>
+
+      <!--
+          ClientCrashTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
          <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashTest"/>
       </antcall>
 
+      <!--
+          ClientCrashTest over "http"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashTest"/>
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <!--
+          ClientCrashTwoConnectionsTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
          <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashTwoConnectionsTest"/>
       </antcall>
 
+      <!--
+          ClientCrashTwoConnectionsTest over "http"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashTwoConnectionsTest"/>
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <!--
+          ClientCrashNegativeLeaseTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
-          <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashNegativeLeaseTest"/>
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashNegativeLeaseTest"/>
       </antcall>
 
+      <!--
+          ClientCrashNegativeLeaseTest over "http"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashNegativeLeaseTest"/>
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <!--
+          ClientCrashZeroLeaseTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
           <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashZeroLeaseTest"/>
       </antcall>
 
+      <!--
+          ClientCrashZeroLeaseTest over "http"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashZeroLeaseTest"/>
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <!--
+          ClientCrashLargeLeaseTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
           <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashLargeLeaseTest"/>
       </antcall>
 
+      <!--
+          ClientCrashLargeLeaseTest over "http"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <antcall target="crash-test">
+          <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.ClientCrashLargeLeaseTest"/>
+         <param name="test.remoting" value="http"/>
+      </antcall>
+
+      <!--
+          CallbackFailureTest over "socket"
+      -->
+
       <antcall target="start-rmi-server"/>
 
       <antcall target="crash-test">
           <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.CallbackFailureTest"/>
       </antcall>
 
+      <!--
+          CallbackFailureTest over "http" does not make sense
+      -->
+
    </target>
 
 
@@ -816,6 +928,7 @@
          <sysproperty key="test.bind.address" value="${test.bind.address}"/>
          <sysproperty key="test.database" value="${functional.tests.database}"/>
          <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.remoting" value="${test.remoting}"/>
          <jvmarg value="-Xmx512M"/>
          <!--
          <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
@@ -836,9 +949,9 @@
             usefile="${junit.formatter.usefile}" extension="-Remote.xml"/>
          -->
 
-         <sysproperty key="messaging-test-configuration" value="Crash"/>
+         <sysproperty key="messaging-test-configuration" value="Crash-${test.remoting}"/>
          <formatter classname="org.jboss.test.messaging.tools.ant.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Crash.xml"/>
+                    usefile="${junit.formatter.usefile}" extension="-Crash-${test.remoting}.xml"/>
 
          <test name="${crash.test.name}"
                fork="true"

Modified: branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -68,6 +68,10 @@
 
    <serialization-type>jms</serialization-type>
 
+   <!--
+       Supported values: "socket", "http"
+   -->
+   <remoting-transport>socket</remoting-transport>
 
    <!--
       Specifies whether to start a clustered messaging server or not. If "test.clustered" is set,

Modified: branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml	2006-12-11 20:50:25 UTC (rev 1765)
@@ -29,6 +29,7 @@
    <property name="run.queue.example" value="true"/>
    <property name="run.topic.example" value="true"/>
    <property name="run.mdb.example" value="true"/>
+   <property name="run.http.example" value="true"/>
    <property name="run.stateless.example" value="true"/>
    <property name="run.ejb3mdb.example" value="false"/>
    <property name="run.secure-socket.example" value="true"/>
@@ -76,12 +77,13 @@
 
       <!-- 4.0.0, 4.0.1 NOT SUPPORTED -->
 
+      <!--
+          Note on installer versions.
+          When installing versions to test via the JBoss installer, make sure call by value is *not*
+          selected in the installation process. The reason for testing installer versions is to test
+          the arrangement where JBoss is configured for all pass by reference
+      -->
 
-      <!-- Note on installer versions.
-      When installing versions to test via the JBoss installer, make sure call by value is *not*
-      selected in the installation process. The reason for testing installer versions is to test
-      the arrangement where JBoss is configured for all pass by reference -->
-
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss401sp1.home}"/>
          <param name="run.secure-socket.example" value="false"/>
@@ -311,6 +313,12 @@
          <param name="jboss.home" value="${jboss.home}"/>
       </antcall>
 
+      <antcall target="run-example">
+         <param name="example.name" value="http"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.home" value="${jboss.home}"/>
+      </antcall>
+
       <!-- ====================================================  -->
       <!--                                                       -->
       <!--  End of example list                                  -->
@@ -451,6 +459,10 @@
                <equals arg1="${example.name}" arg2="secure-socket"/>
                <istrue value="${run.secure-socket.example}"/>
             </and>
+            <and>
+               <equals arg1="${example.name}" arg2="http"/>
+               <istrue value="${run.http.example}"/>
+            </and>
          </or>
       </condition>
       <antcall target="run-example-internal"/>

Modified: branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example	2006-12-11 20:50:25 UTC (rev 1765)
@@ -4,17 +4,20 @@
 
 #JBoss AS 4.0.0 and 4.0.1 are not supported
 
-jboss401sp1.home=C:\\dev\jboss-4.0.1sp1-src\\build\\output\\jboss-4.0.1sp1
-jboss402.home=C:\\dev\\jboss-4.0.2-src\\build\\output\\jboss-4.0.2
-jboss403SP1.home=C:\\dev\\jboss-4.0.3SP1-src\\build\\output\\jboss-4.0.3SP1
-jboss403SP1-installer.home=C:\\dev\\jboss-4.0.3SP1-installer
-jboss404GA.home=C:\\dev\\jboss-4.0.4.GA-src\\build\\output\\jboss-4.0.4.GA
-jboss404GA-installer.home=C:\\dev\\jboss-4.0.4.GA0-installer
-jboss405GA.home=C:\\dev\\jboss-4.0.5.GA-src\\build\\output\\jboss-4.0.5.GA
-jboss405GA-installer.home=C:\\dev\\jboss-4.0.5.GA-installer
-jboss405GAejb3.home=C:\\dev\\jboss-4.0.5.GA-installer-ejb3
+jboss401sp1.home=C:\\work\\src\\jboss-4.0.1sp1-src\\build\\output\\jboss-4.0.1sp1
+jboss402.home=C:\\work\\src\\jboss-4.0.2-src\\build\\output\\jboss-4.0.2
+jboss403.home=C:\\work\\src\\jboss-4.0.3-src\\build\\output\\jboss-4.0.3
+jboss403-installer.home=C:\\work\\jnlp\\jboss-4.0.3
+jboss403SP1.home=C:\\work\\src\\jboss-4.0.3SP1-src\\build\\output\\jboss-4.0.3SP1
+jboss403SP1-installer.home=C:\\work\\jnlp\\jboss-4.0.3SP1
+jboss404GA.home=C:\\work\\src\\jboss-4.0.4.GA-src\\build\\output\\jboss-4.0.4.GA
+jboss404GA-installer.home=C:\\work\\jnlp\\jboss-4.0.4.GA
+jboss405GA.home=C:\\work\\src\\jboss-4.0.5.GA-src\\build\\output\\jboss-4.0.5.GA
+jboss405GA-installer.home=C:\\work\\jnlp\\jboss-4.0.5.GA
 
+jboss500Alpha.home=C:\\work\\src\\cvs\\jboss-head\\build\\output\\jboss-5.0.0.Alpha
+
 #
 # Compatibility test configuration
 #
-jboss.compatibility.home=C:\\work\\messaging-compatibility\\jboss-4.0.4.GA
+jboss.compatibility.home=C:\\work\\messaging-compatibility\\jboss-4.0.5.GA

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -884,7 +884,7 @@
       assertEquals(m1.isExpired(), m2.isExpired());
       assertEquals(m1.getTimestamp(), m2.getTimestamp());
       assertEquals(m1.getPriority(), m2.getPriority());
-      assertEquals(m1.isRedelivered(), m2.isRedelivered());
+      assertEquals(m1.getDeliveryCount(), m2.getDeliveryCount());
       Map m1Headers = m1.getHeaders();
       Map m2Headers = m2.getHeaders();
       checkMapsEquivalent(m1Headers, m2Headers);

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/base/MessageStoreTestBase.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/base/MessageStoreTestBase.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/core/plugin/base/MessageStoreTestBase.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -72,7 +72,7 @@
       assertEquals(m.getExpiration(), ref.getExpiration());
       assertEquals(m.getTimestamp(), ref.getTimestamp());
       assertEquals(m.getPriority(), ref.getPriority());
-      assertFalse(ref.isRedelivered());
+      assertEquals(0, ref.getDeliveryCount());
 
       Map messageHeaders = m.getHeaders();
       Map refHeaders = ref.getHeaders();

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -157,14 +157,20 @@
          pub.publish(m);
          sess.commit();
          
+         log.info("sent messages");
+         
          //receive but rollback
          TextMessage m2 = (TextMessage)sub.receive(3000);
+         
+         log.info("received");
             
          assertNotNull(m2);
          assertEquals("testing123", m2.getText());
          
          sess.rollback();
          
+         log.info("rolled back");
+         
          conn.close();
          conn = cf.createTopicConnection();
          conn.start();

Deleted: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/CallbackServerFactoryTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/CallbackServerFactoryTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/CallbackServerFactoryTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1,115 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * 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.test.messaging.jms;
-
-import org.jboss.jms.client.remoting.CallbackServerFactory;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.test.messaging.MessagingTestCase;
-
-/**
- * 
- * A CallbackServerFactoryTest.
- * 
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version $Revision$
- *
- * $Id$
- */
-public class CallbackServerFactoryTest extends MessagingTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-   
-   // Attributes ----------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   public CallbackServerFactoryTest(String name)
-   {
-      super(name);
-   }
-
-   // Public --------------------------------------------------------
-   
-   public void testCallbackServer() throws Exception
-   {
-      String locatorURI1 = "socket://localhost:1234";
-      
-      String locatorURI2 = "sslsocket://localhost:4321";
-      
-      InvokerLocator locator1 = new InvokerLocator(locatorURI1);
-      
-      InvokerLocator locator2 = new InvokerLocator(locatorURI2);
-      
-      Connector server1 = CallbackServerFactory.instance.getCallbackServer(locator1);
-      
-      assertTrue(server1.isStarted());
-      
-      assertTrue(CallbackServerFactory.instance.containsCallbackServer(locator1.getProtocol()));
-      
-      Connector server2 = CallbackServerFactory.instance.getCallbackServer(locator1);
-      
-      assertTrue(server1 == server2);
-      
-      Connector server3 = CallbackServerFactory.instance.getCallbackServer(locator2);
-      
-      assertTrue(server3.isStarted());
-      
-      assertTrue(CallbackServerFactory.instance.containsCallbackServer(locator2.getProtocol()));
-      
-      Connector server4 = CallbackServerFactory.instance.getCallbackServer(locator2);
-      
-      assertTrue(server3 == server4);
-      
-      assertFalse(server1 == server3);
-      
-      
-      CallbackServerFactory.instance.stopCallbackServer(locator1.getProtocol());
-      
-      assertTrue(CallbackServerFactory.instance.containsCallbackServer(locator1.getProtocol()));
-      
-      CallbackServerFactory.instance.stopCallbackServer(locator2.getProtocol());
-      
-      assertTrue(CallbackServerFactory.instance.containsCallbackServer(locator2.getProtocol()));
-      
-      CallbackServerFactory.instance.stopCallbackServer(locator1.getProtocol());
-      
-      assertFalse(CallbackServerFactory.instance.containsCallbackServer(locator1.getProtocol()));
-      
-      CallbackServerFactory.instance.stopCallbackServer(locator2.getProtocol());
-      
-      assertFalse(CallbackServerFactory.instance.containsCallbackServer(locator2.getProtocol()));
-      
-      assertFalse(server1.isStarted());
-      
-      assertFalse(server3.isStarted());
-      
-      
-   }
-
-   
-   // Inner classes -------------------------------------------------
-
-}
-

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -266,6 +266,8 @@
                "<attribute name=\"timeout\">0</attribute>\n" +
                "<attribute name=\"serverBindAddress\">localhost</attribute>\n" +
                "<attribute name=\"leasePeriod\">20000</attribute>\n" +  
+               "<attribute name=\"clientSocketClass\" isParam=\"true\">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>\n" +
+               "<attribute name=\"serverSocketClass\">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>\n" +
             "</invoker>\n" +
             "<handlers>\n" +
                "<handler subsystem=\"JMS\">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>\n" +

Copied: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java (from rev 1764, trunk/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java)

Copied: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/DLQTest.java (from rev 1764, trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java)

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/JMSTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/JMSTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/JMSTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -24,18 +24,19 @@
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.DeliveryMode;
+import javax.jms.Message;
 import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.jms.Message;
-import javax.jms.MessageListener;
+import javax.management.ObjectName;
 import javax.naming.InitialContext;
-import javax.management.ObjectName;
 
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
+
 import EDU.oswego.cs.dl.util.concurrent.Slot;
 
 /**
@@ -86,7 +87,7 @@
 
       super.tearDown();
    }
-
+   
    public void testNoop() throws Exception
    {
       log.info("noop");

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -1104,10 +1104,16 @@
 
           MessageConsumer cons1 = sess.createConsumer(queue);
 
+          log.trace("closing cons1");
+
           cons1.close();
 
+          log.trace("cons1 closed");
+
           MessageConsumer cons2 = sess.createConsumer(queue);
 
+          log.trace("cons2 created");
+
           Message r1 = cons2.receive();
           Message r2 = cons2.receive();
           Message r3 = cons2.receive();
@@ -2999,14 +3005,12 @@
       //don't acknowledge it
       sess1.close();
 
-      log.debug("sess1 closed");
-
       Session sess2 = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
       MessageConsumer cons2 = sess2.createConsumer(queue);
       TextMessage tm3 = (TextMessage)cons2.receive(3000);
       assertNotNull(tm3);
       assertEquals("testRedeliveredDifferentSessions", tm3.getText());
-
+      
       assertTrue(tm3.getJMSRedelivered());
    }
 

Copied: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java (from rev 1764, trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java)

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/SessionTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/SessionTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/SessionTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -37,8 +37,8 @@
 import javax.jms.TopicSession;
 import javax.jms.XAConnection;
 import javax.jms.XASession;
+import javax.management.ObjectName;
 import javax.naming.InitialContext;
-import javax.management.ObjectName;
 
 import org.jboss.jms.client.JBossConnectionFactory;
 import org.jboss.jms.client.JBossSession;
@@ -143,6 +143,7 @@
       
       conn.close();
       
+      assertEquals(0, cState.getResourceManager().size());
    }
 
    public void testCreateProducer() throws Exception
@@ -535,7 +536,7 @@
       conn.start();
       TextMessage rm = (TextMessage)s.createConsumer(queue).receive(1000);
 
-      assertEquals("bex", m.getText());
+      assertEquals("bex", rm.getText());
 
       conn.close();
    }

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -28,8 +28,8 @@
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.naming.InitialContext;
 import javax.management.ObjectName;
+import javax.naming.InitialContext;
 
 import org.jboss.jms.client.JBossConnectionFactory;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -589,11 +589,10 @@
          tm = (TextMessage)cons.receive();
 
          assertEquals("a message", tm.getText());
-         
-         log.info("del count2:" + tm.getIntProperty("JMSXDeliveryCount"));
+ 
+         assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
 
          assertTrue(tm.getJMSRedelivered());
-         assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
       }
       finally
       {

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -26,7 +26,8 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.EOFException;
-import java.io.ObjectInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -45,8 +46,6 @@
 import org.jboss.jms.server.endpoint.ClientDelivery;
 import org.jboss.jms.server.remoting.JMSWireFormat;
 import org.jboss.jms.server.remoting.MessagingMarshallable;
-import org.jboss.jms.server.remoting.MessagingObjectInputStream;
-import org.jboss.jms.server.remoting.MessagingObjectOutputStream;
 import org.jboss.jms.tx.AckInfo;
 import org.jboss.jms.tx.TransactionRequest;
 import org.jboss.jms.tx.TxState;
@@ -55,6 +54,8 @@
 import org.jboss.remoting.InvocationRequest;
 import org.jboss.remoting.InvocationResponse;
 import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.invocation.InternalInvocation;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.jms.message.MessageTest;
 import org.jboss.util.id.GUID;
@@ -75,7 +76,7 @@
    private static final Logger log = Logger.getLogger(WireFormatTest.class);
 
    // TODO - replace with a dynamic value
-   private static final byte CURRENT_VERSION = 7;
+   private static final byte CURRENT_VERSION = 8;
 
    // Static --------------------------------------------------------
       
@@ -264,7 +265,8 @@
          
          long messageID = 123456;
          int consumerID = 65432;
-         AckInfo ack = new AckInfo(messageID, consumerID, -1);
+         int deliveryCount = 765;
+         AckInfo ack = new AckInfo(messageID, consumerID, deliveryCount);
          
          Object[] args = new Object[] { ack };
          
@@ -276,7 +278,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
                   
          wf.write(ir, oos);
          
@@ -309,6 +311,7 @@
          
          assertEquals(ack.getMessageID(), ack2.getMessageID());
          assertEquals(ack.getConsumerID(), ack2.getConsumerID());
+         assertEquals(ack.getDeliveryCount(), ack2.getDeliveryCount());
          
          //Now eos
          try
@@ -323,7 +326,7 @@
          
          bis.reset();
          
-         ObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -354,9 +357,9 @@
          
          mi.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, new Integer(objectId));   
          
-         AckInfo ackA = new AckInfo(1524, 71627, -1);
-         AckInfo ackB = new AckInfo(987987, 45354, -1);
-         AckInfo ackC = new AckInfo(32423, 4533, -1);
+         AckInfo ackA = new AckInfo(1524, 71627, 32);
+         AckInfo ackB = new AckInfo(987987, 45354, 21);
+         AckInfo ackC = new AckInfo(32423, 4533, 6);
          
          List acks = new ArrayList();
          acks.add(ackA);
@@ -373,7 +376,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
                   
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
       
          wf.write(ir, oos);
          
@@ -409,6 +412,7 @@
          
          assertEquals(ackA.getMessageID(), ack.getMessageID());
          assertEquals(ackA.getConsumerID(), ack.getConsumerID());
+         assertEquals(ackA.getDeliveryCount(), ack.getDeliveryCount());
          
          ack = new AckInfo();
          
@@ -416,6 +420,7 @@
          
          assertEquals(ackB.getMessageID(), ack.getMessageID());
          assertEquals(ackB.getConsumerID(), ack.getConsumerID());
+         assertEquals(ackB.getDeliveryCount(), ack.getDeliveryCount());
          
          ack = new AckInfo();
          
@@ -423,6 +428,7 @@
          
          assertEquals(ackC.getMessageID(), ack.getMessageID());
          assertEquals(ackC.getConsumerID(), ack.getConsumerID());
+         assertEquals(ackC.getDeliveryCount(), ack.getDeliveryCount());
          
          
          //Now eos
@@ -438,7 +444,7 @@
          
          bis.reset();
          
-         ObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -496,7 +502,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(ir, oos);
          
@@ -515,7 +521,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
                                  
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -557,7 +563,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(ir, oos);
          
@@ -574,7 +580,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
             
          InvocationResponse ir2 = (InvocationResponse)wf.read(ois, null);
          
@@ -601,7 +607,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(ir, oos);
          
@@ -618,7 +624,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
                   
          InvocationResponse ir2 = (InvocationResponse)wf.read(ois, null);
          
@@ -656,7 +662,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
                   
          wf.write(ir, oos);
          
@@ -707,8 +713,9 @@
          MessageTest.ensureEquivalent(m, m2);
          
          bis.reset();
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
          
+         InputStream ois = new DataInputStream(bis);
+         
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
          mm = (MessagingMarshallable)ir2.getParameter();
@@ -732,7 +739,7 @@
          JBossMessage m = new JBossMessage(123);
          MessageTest.configureMessage(m);
          
-         AckInfo info = new AckInfo(123, 456, -1);
+         AckInfo info = new AckInfo(123, 456, 66);
          
          TxState state = new TxState();
          state.getMessages().add(m);
@@ -756,7 +763,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
                   
          wf.write(ir, oos);
         
@@ -810,10 +817,11 @@
          
          assertEquals(info.getConsumerID(), info2.getConsumerID());
          assertEquals(info.getMessageID(), info2.getMessageID());
+         assertEquals(info.getDeliveryCount(), info2.getDeliveryCount());
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -851,8 +859,8 @@
          
          List ids = new ArrayList();
          
-         AckInfo ack1 = new AckInfo(1254, 78123, -1);
-         AckInfo ack2 = new AckInfo(786, 8979, -1);
+         AckInfo ack1 = new AckInfo(1254, 78123, 22);
+         AckInfo ack2 = new AckInfo(786, 8979, 461);
          ids.add(ack1);
          ids.add(ack2);
          
@@ -868,7 +876,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
                   
          wf.write(ir, oos);
         
@@ -913,9 +921,14 @@
          
          assertEquals(ack1.getMessageID(), rack1.getMessageID());
          
+         assertEquals(ack1.getDeliveryCount(), rack1.getDeliveryCount());
+         
          assertEquals(ack2.getConsumerID(), rack2.getConsumerID());
          
          assertEquals(ack2.getMessageID(), rack2.getMessageID());
+         
+         assertEquals(ack2.getDeliveryCount(), rack2.getDeliveryCount());
+         
           
          //should be eos
                 
@@ -932,7 +945,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -968,7 +981,7 @@
          InvocationResponse resp = new InvocationResponse(null, mm, false, null);
 
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(resp, oos);
          oos.flush();
@@ -998,7 +1011,7 @@
          
          bis.reset();
 
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
 
          InvocationResponse ir2 = (InvocationResponse)wf.read(ois, null);
          
@@ -1028,7 +1041,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
                   
          wf.write(ir, oos);
          
@@ -1066,7 +1079,7 @@
          }
          
          bis.reset();
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
@@ -1111,11 +1124,11 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          MessagingMarshallable mm = new MessagingMarshallable((byte)77, dr);
          
-         InvocationRequest ir = new InvocationRequest(null, null, mm, null, null, null);
+         InvocationRequest ir = new InvocationRequest("dummySessionId", null, mm, null, null, null);
          
          wf.write(ir, oos);
          
@@ -1133,6 +1146,9 @@
          //Second byte should be CALLBACK
          assertEquals(JMSWireFormat.CALLBACK, dis.readByte());
          
+         //Next should be sessionID
+         assertEquals("dummySessionId", dis.readUTF());
+         
          //Next int should be server id
          assertEquals(76543, dis.readInt());
          
@@ -1196,12 +1212,20 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);
          
-         mm = (MessagingMarshallable)ir2.getParameter();
+         InternalInvocation ii = (InternalInvocation) ir2.getParameter();
          
+         Object[] parameters = ii.getParameters();
+         
+         assertNotNull(parameters);
+         
+         Callback callback = (Callback) parameters[0];
+         
+         mm = (MessagingMarshallable)callback.getParameter();
+         
          assertEquals(77, mm.getVersion());
                   
          ClientDelivery dr2 = (ClientDelivery)mm.getLoad();
@@ -1239,7 +1263,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(ir, oos);
          
@@ -1276,7 +1300,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationResponse ir2 = (InvocationResponse)wf.read(ois, null);
          
@@ -1300,7 +1324,7 @@
          
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          
-         MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));
+         OutputStream oos = new DataOutputStream(bos);
          
          wf.write(ir, oos);
          
@@ -1337,7 +1361,7 @@
          
          bis.reset();
          
-         MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));
+         InputStream ois = new DataInputStream(bis);
          
          InvocationResponse ir2 = (InvocationResponse)wf.read(ois, null);
          

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -93,7 +93,7 @@
       super.tearDown();
    }
 
-   public void testSimpleJMSXDeliverCount() throws Exception
+   public void testSimpleJMSXDeliveryCount() throws Exception
    {
       Connection conn = cf.createConnection();
       Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -127,6 +127,8 @@
    public static String USER_TRANSACTION_JNDI_NAME = "UserTransaction";
    public static String JCA_JMS_CONNECTION_FACTORY_JNDI_NAME = "java:/JCAConnectionFactory";
 
+   public static long HTTP_CONNECTOR_CALLBACK_POLL_PERIOD = 102;
+
    static
    {
       try
@@ -182,15 +184,14 @@
    private boolean transaction;
    private boolean database;
    private boolean jca;
-   private boolean remotingSocket;
-   private boolean remotingMultiplex;
+   private boolean remoting;
    private boolean security;
 
    private List toUnbindAtExit;
    private String ipAddressOrHostName;
-   
-   //There may be many service containers on the same machine, so we need to distinguish them
-   //so we don't start up multiple servers with services running on the same port
+
+   // There may be many service containers on the same machine, so we need to distinguish them
+   // so we don't start up multiple servers with services running on the same port
    private int serverIndex;
 
    // Static --------------------------------------------------------
@@ -255,7 +256,7 @@
    {
       this(servicesToStart, null);
    }
-   
+
    public ServiceContainer(String sevicesToStart, int serverIndex) throws Exception
    {
       this(sevicesToStart, null, serverIndex);
@@ -276,7 +277,7 @@
       toUnbindAtExit = new ArrayList();
       this.serverIndex = 0;
    }
-   
+
    public ServiceContainer(String sevicesToStart, TransactionManager tm, int serverIndex) throws Exception
    {
       this.tm = tm;
@@ -368,14 +369,12 @@
                                    DEFAULTDS_MANAGED_CONNECTION_POOL_OBJECT_NAME);
             startWrapperDataSourceService();
          }
-         if (remotingSocket)
+
+         if (remoting)
          {
-            startRemoting(false);
+            startRemoting();
          }
-         if (remotingMultiplex)
-         {
-            startRemoting(true);
-         }
+
          if (security)
          {
             startSecurityManager();
@@ -398,8 +397,9 @@
 
          loadJNDIContexts();
 
-         log.info("Remoting type: ........... " +
-            (remotingSocket ? "socket" : (remotingMultiplex ? "multiplex" : "disabled")));
+         String transport = config.getRemotingTransport();
+
+         log.info("Remoting type: ........... " + (remoting ? transport : "DISABLED"));
          log.info("Serialization type: ...... " + config.getSerializationType());
          log.info("Database: ................ " + config.getDatabaseType());
          log.info("Clustering mode: ......... " +
@@ -498,37 +498,37 @@
    {
       return mbeanServer.invoke(on, "getInstance", new Object[0], new String[0]);
    }
-   
+
    public Properties getPersistenceManagerSQLProperties() throws Exception
    {
       String databaseType = getDatabaseType();
 
       String persistenceConfigFile =
          "server/default/deploy/" + databaseType + "-persistence-service.xml";
-      
+
       log.info("********* Using config file: " + persistenceConfigFile);
-      
+
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
       {
          throw new Exception("Cannot find " + persistenceConfigFile + " in the classpath");
       }
-      
+
       ServiceDeploymentDescriptor pdd = new ServiceDeploymentDescriptor(persistenceConfigFileURL);
-      
+
       MBeanConfigurationElement persistenceManagerConfig =
          (MBeanConfigurationElement)pdd.query("service", "PersistenceManager").iterator().next();
-      
+
       String props = persistenceManagerConfig.getAttributeValue("SqlProperties");
-      
+
       if (props != null)
-      {         
+      {
          ByteArrayInputStream is = new ByteArrayInputStream(props.getBytes());
-         
+
          Properties sqlProperties = new Properties();
-         
-         sqlProperties.load(is);      
-         
+
+         sqlProperties.load(is);
+
          return sqlProperties;
       }
       else
@@ -536,37 +536,37 @@
          return null;
       }
    }
-   
+
    public Properties getPostOfficeSQLProperties() throws Exception
    {
       String databaseType = getDatabaseType();
-      
+
       String persistenceConfigFile =
          "server/default/deploy/" + databaseType + "-persistence-service.xml";
-      
+
       log.info("********* Using config file: " + persistenceConfigFile);
-      
+
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
       {
          throw new Exception("Cannot find " + persistenceConfigFile + " in the classpath");
       }
-      
+
       ServiceDeploymentDescriptor pdd = new ServiceDeploymentDescriptor(persistenceConfigFileURL);
-      
+
       MBeanConfigurationElement postOfficeConfig =
          (MBeanConfigurationElement)pdd.query("service", "QueuePostOffice").iterator().next();
-      
+
       String props = postOfficeConfig.getAttributeValue("SqlProperties");
-      
+
       if (props != null)
-      {         
+      {
          ByteArrayInputStream is = new ByteArrayInputStream(props.getBytes());
-         
+
          Properties sqlProperties = new Properties();
-         
-         sqlProperties.load(is);      
-         
+
+         sqlProperties.load(is);
+
          return sqlProperties;
       }
       else
@@ -574,11 +574,11 @@
          return null;
       }
    }
-   
+
    public Properties getClusteredPostOfficeSQLProperties() throws Exception
    {
       String databaseType = getDatabaseType();
-      
+
       String persistenceConfigFile;
       if (databaseType.equals("hsqldb"))
       {
@@ -590,30 +590,30 @@
          persistenceConfigFile =
             "server/default/deploy/clustered-" + databaseType + "-persistence-service.xml";
       }
-      
+
       log.info("********* Using config file: " + persistenceConfigFile);
-      
+
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
       {
          throw new Exception("Cannot find " + persistenceConfigFile + " in the classpath");
       }
-      
+
       ServiceDeploymentDescriptor pdd = new ServiceDeploymentDescriptor(persistenceConfigFileURL);
-      
+
       MBeanConfigurationElement postOfficeConfig =
          (MBeanConfigurationElement)pdd.query("service", "QueuePostOffice").iterator().next();
-      
+
       String props = postOfficeConfig.getAttributeValue("SqlProperties");
-      
+
       if (props != null)
-      {         
+      {
          ByteArrayInputStream is = new ByteArrayInputStream(props.getBytes());
-         
+
          Properties sqlProperties = new Properties();
-         
-         sqlProperties.load(is);      
-         
+
+         sqlProperties.load(is);
+
          return sqlProperties;
       }
       else
@@ -633,7 +633,7 @@
       }
       return mbeanServer.queryNames(pattern, null);
    }
-  
+
    /**
     * Creates and registers a service based on the MBean service descriptor element. Supports
     * XMBeans. The implementing class and the ObjectName are inferred from the mbean element. If
@@ -803,7 +803,7 @@
    // Protected -----------------------------------------------------
 
    // Private -------------------------------------------------------
-   
+
    /**
     * Note that this method makes no assumption on whether the service was created or started, nor
     * does it attempt to create/start the service.
@@ -814,7 +814,7 @@
    {
       mbeanServer.registerMBean(service, on);
       log.debug(service + " registered as " + on);
-   }  
+   }
 
    private void readConfigurationFile() throws Exception
    {
@@ -1139,39 +1139,49 @@
       stopService(managedConnFactoryObjectName);
    }
 
-   private void startRemoting(boolean multiplex) throws Exception
+   private void startRemoting() throws Exception
    {
-      SerializationStreamFactory.setManagerClassName(
-               "jms", "org.jboss.jms.server.remoting.MessagingSerializationManager");
-              
       RemotingJMXWrapper mbean;
 
-      //String serializationType = config.getSerializationType();
-      
-      String serializationType = "jms";
-      
+      // TODO - use remoting-service.xml parameters, not these ...
+
+      String serializationType = config.getSerializationType();
+
+      //TODO - Actually serializationType is irrelevant since we pass a
+      //DataOutput/InputStream into the marshaller and don't use serialization apart
+      //from one specific case with a JMS ObjectMessage in which case Java serialization
+      //is always currently used - (we could make this configurable)
+
+      String transport = config.getRemotingTransport();
+
       String params = "/?marshaller=org.jboss.jms.server.remoting.JMSWireFormat&" +
                       "unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&" +
                       "serializationtype=" + serializationType + "&" +
                       "dataType=jms&" +
-                      "timeout=0&" +
                       "socket.check_connection=false&" +
-                      "leasePeriod=20000";
+                      "clientLeasePeriod=20000&" +
+                      "callbackStore=org.jboss.remoting.callback.BlockingCallbackStore&" +
+                      "clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&" +
+                      "serverSocketClass=org.jboss.jms.server.remoting.ServerSocketWrapper";
 
-      int portNumber = 9111 + serverIndex;
-      
-      String locatorURI;
-      if (multiplex)
+      // specific parameters per transport
+
+      if ("http".equals(transport))
       {
-         locatorURI = "multiplex://" + ipAddressOrHostName + ":" + portNumber + params;
+         params += "&callbackPollPeriod=" + HTTP_CONNECTOR_CALLBACK_POLL_PERIOD;
       }
       else
       {
-         locatorURI = "socket://" + ipAddressOrHostName + ":" + portNumber + params;
+         params += "&timeout=0";
       }
 
-      log.debug("Using the following locator uri:" + locatorURI);
+//      int freePort = PortUtil.findFreePort(ipAddressOrHostName);
 
+      int freePort = 9111;
+      String locatorURI = transport + "://" + ipAddressOrHostName + ":" + freePort + params;
+
+      log.debug("Using locator uri: " + locatorURI);
+
       InvokerLocator locator = new InvokerLocator(locatorURI);
 
       log.debug("Started remoting connector on uri:" + locator.getLocatorURI());
@@ -1226,7 +1236,7 @@
       try
       {
          log.info("DELETING ALL DATA FROM DATABASE!");
-         
+
          InitialContext ctx = new InitialContext();
 
          TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
@@ -1299,7 +1309,7 @@
       }
       catch (SQLException e)
       {
-         //Ignore - tables might not exist      
+         //Ignore - tables might not exist
       }
    }
 
@@ -1322,7 +1332,7 @@
             transaction = true;
             database = true;
             jca = true;
-            remotingSocket = true;
+            remoting = true;
             security = true;
          }
          else if ("transaction".equals(tok))
@@ -1351,22 +1361,13 @@
          }
          else if ("remoting".equals(tok))
          {
-            remotingSocket = true;
+            remoting = true;
             if (minus)
             {
-               remotingSocket = false;
+               remoting = false;
             }
 
          }
-         else if ("remoting-multiplex".equals(tok))
-         {
-            remotingMultiplex = true;
-            if (minus)
-            {
-               remotingMultiplex = false;
-            }
-
-         }
          else if ("security".equals(tok))
          {
             security = true;
@@ -1380,7 +1381,7 @@
             transaction = false;
             database = false;
             jca = false;
-            remotingSocket = false;
+            remoting = false;
             security = false;
          }
          else

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -76,6 +76,7 @@
    private String database;
    private Map dbConfigurations;
    private String serializationType;
+   private String remotingTransport;
    private Boolean clusteredMode;
 
    // Constructors --------------------------------------------------
@@ -142,6 +143,14 @@
    {
       return serializationType;
    }
+   
+   /**
+    * @return the transport the container wants the Remoting Connector to use.
+    */
+   public String getRemotingTransport()
+   {
+      return remotingTransport;
+   }
 
    /**
     * @return the clustered mode in which the container should run an individual test.
@@ -162,6 +171,7 @@
       Reader reader = new InputStreamReader(is);
       String currentDatabase = null;
       String currentSerializationType = null;
+      String currentRemotingTransport = null;
       boolean currentClusteredMode = DEFAULT_CLUSTERED_MODE;
 
       try
@@ -201,6 +211,10 @@
                {
                   currentSerializationType = XMLUtil.getTextContent(n);
                }
+               else if ("remoting-transport".equals(name))
+               {
+                  currentRemotingTransport = XMLUtil.getTextContent(n);
+               }
                else if ("clustered".equals(name))
                {
                   currentClusteredMode = Boolean.getBoolean(XMLUtil.getTextContent(n));
@@ -215,6 +229,7 @@
 
          setCurrentDatabase(currentDatabase);
          setCurrentSerializationType(currentSerializationType);
+         setCurrentRemotingTransport(currentRemotingTransport);
          setCurrentClusteredMode(currentClusteredMode);
       }
       finally
@@ -248,6 +263,16 @@
          serializationType = xmlConfigSerializationType;
       }
    }
+   
+   private void setCurrentRemotingTransport(String xmlRemotingTransport)
+   {
+      remotingTransport = System.getProperty("test.remoting");
+      if (remotingTransport == null)
+      {
+         remotingTransport = xmlRemotingTransport;
+      }
+   }
+   
 
    /**
     * Always the value of "test.clustered" system property takes precedence over the configuration

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-12-11 16:56:06 UTC (rev 1764)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-12-11 20:50:25 UTC (rev 1765)
@@ -38,7 +38,6 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.contract.MessageStore;
 import org.jboss.messaging.core.plugin.contract.PersistenceManager;
-import org.jboss.messaging.core.plugin.contract.PostOffice;
 import org.jboss.remoting.ServerInvocationHandler;
 import org.jboss.test.messaging.tools.ServerManagement;
 import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
@@ -88,7 +87,7 @@
 
    // List<ObjectName>
    private List connFactoryObjectNames;
-   
+
    private int serverIndex;
 
    // Constructors --------------------------------------------------
@@ -99,11 +98,11 @@
 
       connFactoryObjectNames = new ArrayList();
    }
-   
+
    public LocalTestServer(int serverIndex)
    {
       this();
-      
+
       this.serverIndex = serverIndex;
    }
 
@@ -115,7 +114,7 @@
       {
          return;
       }
-      
+
       log.debug("starting service container");
 
       try
@@ -257,7 +256,7 @@
          // log everything else as INFO
          log.info(text);
       }
-   }   
+   }
 
    public synchronized boolean isStarted() throws Exception
    {
@@ -465,9 +464,9 @@
             //them down.
             //Hence we must catch and ignore or we won't shut everything down
          }
-   
+
          log.debug("stopping ServerPeer's plug-in dependencies");
-               
+
          try
          {
             sc.invoke(jmsUserManagerObjectName, "stop", new Object[0], new String[0]);
@@ -481,7 +480,7 @@
             //them down.
             //Hence we must catch and ignore or we won't shut everything down
          }
-   
+
          try
          {
             sc.invoke(postOfficeObjectName, "stop", new Object[0], new String[0]);
@@ -494,8 +493,8 @@
             //services may be started. The ones that didn't start will fail when attempting to shut
             //them down.
             //Hence we must catch and ignore or we won't shut everything down
-         }         
-   
+         }
+
          try
          {
             sc.invoke(persistenceManagerObjectName, "stop", new Object[0], new String[0]);
@@ -573,13 +572,13 @@
       ServerPeer serverPeer = (ServerPeer)sc.getAttribute(serverPeerObjectName, "Instance");
       return serverPeer.getDestinationManager();
    }
-   
+
    public PersistenceManager getPersistenceManager() throws Exception
    {
       ServerPeer serverPeer = (ServerPeer)sc.getAttribute(serverPeerObjectName, "Instance");
       return serverPeer.getPersistenceManagerInstance();
    }
-   
+
    /**
     * Only for in-VM use!
     */
@@ -611,7 +610,7 @@
    {
       deployDestination(true, name, jndiName, clustered);
    }
-   
+
    public void deployQueue(String name, String jndiName, int fullSize, int pageSize,
                            int downCacheSize, boolean clustered) throws Exception
    {
@@ -642,7 +641,7 @@
       sc.invoke(deston, "create", new Object[0], new String[0]);
       sc.invoke(deston, "start", new Object[0], new String[0]);
    }
-   
+
    public void deployDestination(boolean isQueue,
                                  String name,
                                  String jndiName,
@@ -652,7 +651,7 @@
                                  boolean clustered) throws Exception
    {
       log.info("deploying queue, fullsize:" + fullSize + ", ps:" + pageSize + " dc size:" + downCacheSize);
-      
+
       String config =
          "<mbean code=\"org.jboss.jms.server.destination." + (isQueue ? "QueueService" : "TopicService") + "\"" +
          "       name=\"jboss.messaging.destination:service=" + (isQueue ? "Queue" : "Topic") + ",name=" + name + "\"" +
@@ -715,7 +714,7 @@
    {
       deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1);
    }
-   
+
    public void deployConnectionFactory(String objectName,
                                        String[] jndiBindings) throws Exception
    {
@@ -736,27 +735,27 @@
          "<depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
          "<depends optional-attribute-name=\"Connector\">" + ServiceContainer.REMOTING_OBJECT_NAME +
          "</depends>\n";
-      
+
       if (defaultTempQueueFullSize != -1)
       {
          config += "<attribute name=\"DefaultTempQueueFullSize\">" + defaultTempQueueFullSize + "</attribute>\n";
       }
-      
+
       if (defaultTempQueuePageSize != -1)
       {
          config += "<attribute name=\"DefaultTempQueuePageSize\">" + defaultTempQueuePageSize + "</attribute>\n";
       }
-      
+
       if (defaultTempQueueDownCacheSize != -1)
       {
          config += "<attribute name=\"DefaultTempQueueDownCacheSize\">" + defaultTempQueueDownCacheSize + "</attribute>\n";
       }
-      
+
       if (prefetchSize != -1)
       {
          config += "<attribute name=\"PrefetchSize\">" + prefetchSize + "</attribute>";
       }
-      
+
       config += "<attribute name=\"JNDIBindings\"><bindings>";
 
       for(int i = 0; i < jndiBindings.length; i++)
@@ -805,9 +804,9 @@
       Element element = (Element)sc.getAttribute(serverPeerObjectName, "DefaultSecurityConfig");
       return XMLUtil.elementToString(element);
    }
-   
+
    public Object executeCommand(Command command) throws Exception
-   { 
+   {
       return command.execute();
    }
 




More information about the jboss-cvs-commits mailing list