[jboss-cvs] JBoss Messaging SVN: r2567 - in tags: JBossMessaging_1_2_0_SP1 and 14 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 28 15:41:01 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-03-28 15:40:59 -0400 (Wed, 28 Mar 2007)
New Revision: 2567

Added:
   tags/JBossMessaging_1_2_0_SP1/
   tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml
   tags/JBossMessaging_1_2_0_SP1/docs/README.html
   tags/JBossMessaging_1_2_0_SP1/messaging.iws
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java
   tags/JBossMessaging_1_2_0_SP1/tests/build.xml
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/crash/simultaneousfailure/
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/SomeObject.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml
Removed:
   tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml
   tags/JBossMessaging_1_2_0_SP1/docs/README.html
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/util/ThreadContextClassLoaderChanger.java
   tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java
   tags/JBossMessaging_1_2_0_SP1/tests/build.xml
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
   tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml
Modified:
   tags/JBossMessaging_1_2_0_SP1/build-messaging.xml
   tags/JBossMessaging_1_2_0_SP1/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
   tags/JBossMessaging_1_2_0_SP1/messaging.iml
   tags/JBossMessaging_1_2_0_SP1/messaging.ipr
   tags/JBossMessaging_1_2_0_SP1/util/do-not-distribute.properties
Log:


Copied: tags/JBossMessaging_1_2_0_SP1 (from rev 2547, branches/Branch_1_2_0_SP)

Modified: tags/JBossMessaging_1_2_0_SP1/build-messaging.xml
===================================================================
--- branches/Branch_1_2_0_SP/build-messaging.xml	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/build-messaging.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -49,7 +49,7 @@
    <property name="messaging.version.minor" value="2"/>
    <property name="messaging.version.revision" value="0"/>
    <property name="messaging.version.incrementing" value="11"/>
-   <property name="messaging.version.tag" value="GA"/>
+   <property name="messaging.version.tag" value="sp1"/>
    <property name="messaging.version.name" value="Alkali"/>
    <property name="messaging.version.cvstag" value="JBossMessaging_1_2_0_GA"/>
    <property name="module.name" value="messaging"/>
@@ -742,21 +742,11 @@
       <fail message="Functional test results ${release.output}/test-results/jboss-messaging-functional-test-results-${module.version}.zip not available!"
             unless="functional.test.results.present"/>
 
-      <available file="${release.output}/test-results/jboss-messaging-functional-test-results-Linux-${module.version}.zip"
-                 property="linux.functional.test.results.present" value="true"/>
-      <fail message="Linux functional test results ${release.output}/test-results/jboss-messaging-functional-test-results-Linux-${module.version}.zip not available!"
-            unless="linux.functional.test.results.present"/>
-
       <available file="${release.output}/test-results/jboss-messaging-stress-test-results-${module.version}.zip"
                  property="stress.test.results.present" value="true"/>
       <fail message="Stress test results ${release.output}/test-results/jboss-messaging-stress-test-results-${module.version}.zip not available!"
             unless="stress.test.results.present"/>
 
-      <available file="${release.output}/test-results/jboss-messaging-stress-test-results-Linux-${module.version}.zip"
-                 property="linux.stress.test.results.present" value="true"/>
-      <fail message="Linux stress test results ${release.output}/test-results/jboss-messaging-stress-test-results-Linux-${module.version}.zip not available!"
-            unless="linux.stress.test.results.present"/>
-
    </target>
 
    <target name="deployscoped" depends="scoped-sar">

Deleted: tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml
===================================================================
--- branches/Branch_1_2_0_SP/build-thirdparty.xml	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- =========================================================================================== -->
-<!--                                                                                             -->
-<!-- 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.                                    -->
-<!--                                                                                             -->
-<!-- =========================================================================================== -->
-
-
-<!-- =========================================================================================== -->
-<!--                                                                                             -->
-<!-- $Id$ -->
-<!--                                                                                             -->
-<!-- =========================================================================================== -->
-
-<project name="main.build" default="synchronize">
-
-   <!-- ======================================================================================== -->
-   <!-- Configuration                                                                            -->
-   <!-- ======================================================================================== -->
-
-   <property file="local.properties"/>
-   <property file="synchronize.properties"/>
-   <property name="librariesEntFile" value="./thirdparty/libraries.ent"/>
-
-   <property environment="ENV"/>
-
-   <!--
-      | Allow jbossbuild.repository to be set from (in order or priority)
-      | 1) Command line -Djbossbuild.repository=...
-      | 2) synchronize.properties jbossbuild.repository setting
-      | 3) JBOSS_REPOSITORY environment variable
-   -->
-   <condition property="jbossbuild.repository" value="${ENV.JBOSS_REPOSITORY}">
-      <isset property="ENV.JBOSS_REPOSITORY"/>
-   </condition>
-
-   <!--
-      | Fall back to default.
-   -->
-   <property name="jbossbuild.repository" value="http://repository.jboss.com"/>
-
-   <import file="./tools/etc/jbossbuild/tasks.xml"/>
-
-   <!--
-      | This is where JBoss Messaging external dependencies are declared. The repository is in CVS
-      | under the module repository.jboss.com whose contents are pushed to the
-      | http://repository.jboss.com site.
-   -->
-   <build id="jboss-messaging"
-          impltitle="JBoss Messaging"
-          implversion="undefined"
-          implvendor="JBoss Inc."
-          implurl="http://www.jboss.org"
-          description="JBoss Messaging"
-          cvsroot="${cvs.prefix}@cvs.forge.jboss.com:/cvsroot/jboss"
-          thirdpartypath="./thirdparty/"
-          location="${jbossbuild.repository}"
-          targetdefs="targets">
-
-
-      <!--
-           Dependencies required to build the project.
-      -->
-      <componentref name="retrotranslator" version="0.9.6jboss"/>
-      <componentref name="sun-javacc" version="3.2"/>
-      <componentref name="oswego-concurrent" version="1.3.4"/>
-      <componentref name="apache-log4j" version="1.2.8"/>
-      <componentref name="javassist" version="3.3.0.GA"/>
-      <componentref name="jgroups" version="2.4.1"/>
-      <componentref name="trove" version="1.0.2"/>
-      <componentref name="jboss/common-core" version="2.0.2.GA"/>
-      <componentref name="jboss/common-logging-log4j" version="2.0.2.GA"/>
-      <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
-      <componentref name="jboss/aop" version="1.5.3.GA"/>
-      <componentref name="jboss/serialization" version="1.0.3.GA"/>
-      <componentref name="jboss/remoting" version="2.2.0.Beta1"/>
-      <componentref name="jboss/jbossts" version="4.2.2.GA"/>
-      <componentref name="jboss/test14" version="1.0.0.GA"/>
-      <componentref name="jboss/jbossretro-rt" version="1.0.4.GA"/>
-      <componentref name="jboss/backport-concurrent" version="2.1.0.GA"/>
-
-      <!--
-          Totally unapropriate here, but this is what we need to do for the time being if we
-          want HTTP.
-          See http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022727 for more details.
-      -->
-      <componentref name="apache-tomcat" version="5.5.15"/>
-
-      <!--
-          Need this otherwise project doesn't build in Eclipse. TODO Really?
-      -->
-      <componentref name="apache-logging" version="1.0.4.1jboss"/>
-
-      <!--
-           Dependencies required to test the project.
-      -->
-      <componentref name="junit" version="3.8.1"/>
-      <componentref name="hsqldb" version="1.8.0.2"/>
-      <componentref name="dom4j" version="1.6"/>
-      <componentref name="apache-xerces" version="2.7.1"/> <!-- needed by org.jboss.logging.Log4jLoggerPlugin -->
-      <componentref name="jboss/profiler/jvmti" version="1.0.0.CR5"/>
-      <componentref name="jboss/jbossxb" version="1.0.0.CR6"/>
-
-   </build>
-
-   <synchronizeinfo/>
-
-   <!--
-      | Generate the targets.
-   -->
-   <generate generate="jboss-messaging"/>
-
-   <target name="generate-libraries-ent" depends="synchronize">
-      <gen-lib-file path="tools/etc/buildmagic" filename="${librariesEntFile}"/>
-      <visit-componentref-graph componentVisitor="org.jboss.ant.util.graph.ComponentRefGraphLicenseVisitor"/>
-   </target>
-
-</project>

Copied: tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml (from rev 2557, branches/Branch_1_2_0_SP/build-thirdparty.xml)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/build-thirdparty.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- $Id$ -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+<project name="main.build" default="synchronize">
+
+   <!-- ======================================================================================== -->
+   <!-- Configuration                                                                            -->
+   <!-- ======================================================================================== -->
+
+   <property file="local.properties"/>
+   <property file="synchronize.properties"/>
+   <property name="librariesEntFile" value="./thirdparty/libraries.ent"/>
+
+   <property environment="ENV"/>
+
+   <!--
+      | Allow jbossbuild.repository to be set from (in order or priority)
+      | 1) Command line -Djbossbuild.repository=...
+      | 2) synchronize.properties jbossbuild.repository setting
+      | 3) JBOSS_REPOSITORY environment variable
+   -->
+   <condition property="jbossbuild.repository" value="${ENV.JBOSS_REPOSITORY}">
+      <isset property="ENV.JBOSS_REPOSITORY"/>
+   </condition>
+
+   <!--
+      | Fall back to default.
+   -->
+   <property name="jbossbuild.repository" value="http://repository.jboss.com"/>
+
+   <import file="./tools/etc/jbossbuild/tasks.xml"/>
+
+   <!--
+      | This is where JBoss Messaging external dependencies are declared. The repository is in CVS
+      | under the module repository.jboss.com whose contents are pushed to the
+      | http://repository.jboss.com site.
+   -->
+   <build id="jboss-messaging"
+          impltitle="JBoss Messaging"
+          implversion="undefined"
+          implvendor="JBoss Inc."
+          implurl="http://www.jboss.org"
+          description="JBoss Messaging"
+          cvsroot="${cvs.prefix}@cvs.forge.jboss.com:/cvsroot/jboss"
+          thirdpartypath="./thirdparty/"
+          location="${jbossbuild.repository}"
+          targetdefs="targets">
+
+
+      <!--
+           Dependencies required to build the project.
+      -->
+      <componentref name="retrotranslator" version="0.9.6jboss"/>
+      <componentref name="sun-javacc" version="3.2"/>
+      <componentref name="oswego-concurrent" version="1.3.4"/>
+      <componentref name="apache-log4j" version="1.2.8"/>
+      <componentref name="javassist" version="3.3.0.GA"/>
+      <componentref name="jgroups" version="2.4.1"/>
+      <componentref name="trove" version="1.0.2"/>
+      <componentref name="jboss/common-core" version="2.0.2.GA"/>
+      <componentref name="jboss/common-logging-log4j" version="2.0.2.GA"/>
+      <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
+      <componentref name="jboss/aop" version="1.5.3.GA"/>
+      <componentref name="jboss/serialization" version="1.0.3.GA"/>
+      <componentref name="jboss/remoting" version="2.2.0.GA"/>
+      <componentref name="jboss/jbossts" version="4.2.2.GA"/>
+      <componentref name="jboss/test14" version="1.0.0.GA"/>
+      <componentref name="jboss/jbossretro-rt" version="1.0.4.GA"/>
+      <componentref name="jboss/backport-concurrent" version="2.1.0.GA"/>
+
+      <!--
+          Totally unapropriate here, but this is what we need to do for the time being if we
+          want HTTP.
+          See http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022727 for more details.
+      -->
+      <componentref name="apache-tomcat" version="5.5.15"/>
+
+      <!--
+          Need this otherwise project doesn't build in Eclipse. TODO Really?
+      -->
+      <componentref name="apache-logging" version="1.0.4.1jboss"/>
+
+      <!--
+           Dependencies required to test the project.
+      -->
+      <componentref name="junit" version="3.8.1"/>
+      <componentref name="hsqldb" version="1.8.0.2"/>
+      <componentref name="dom4j" version="1.6"/>
+      <componentref name="apache-xerces" version="2.7.1"/> <!-- needed by org.jboss.logging.Log4jLoggerPlugin -->
+      <componentref name="jboss/profiler/jvmti" version="1.0.0.CR5"/>
+      <componentref name="jboss/jbossxb" version="1.0.0.CR6"/>
+
+   </build>
+
+   <synchronizeinfo/>
+
+   <!--
+      | Generate the targets.
+   -->
+   <generate generate="jboss-messaging"/>
+
+   <target name="generate-libraries-ent" depends="synchronize">
+      <gen-lib-file path="tools/etc/buildmagic" filename="${librariesEntFile}"/>
+      <visit-componentref-graph componentVisitor="org.jboss.ant.util.graph.ComponentRefGraphLicenseVisitor"/>
+   </target>
+
+</project>

Deleted: tags/JBossMessaging_1_2_0_SP1/docs/README.html
===================================================================
--- branches/Branch_1_2_0_SP/docs/README.html	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/docs/README.html	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,796 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-  <meta content="text/html; charset=ISO-8859-1"
- http-equiv="content-type">
-  <title>JBoss Messaging Release Notes</title>
-</head>
-<body>
-<h1><br>
-JBoss Messaging 1.2.0.GA Release Notes</h1>
-<br>
-March 01 2007<br>
-<br>
-<br>
-JBoss
-Messaging is a new JBoss JMS 1.1-compliant JMS provider, aimed to
-replace JBossMQ.&nbsp; This is the first General Availability (GA)
-clustering release. 1.2.0.GA includes full
-clustering, with load balancing and
-transparent failover. An extensive overview of its features, as well as
-installation and configuration instructions are available in the "JBoss
-Messaging 1.2 User Guide". The guide is bundled with this release and
-is
-provided in <a href="./docs/userguide/html/index.html">HTML</a>, <a
- href="./docs/userguide/html_single/index.html">HTML-single</a>
-and <a href="./docs/userguide/pdf/JBossMessagingUsersGuide.pdf">PDF</a>
-formats.&nbsp; The guide is also available on-line at&nbsp; <a
- href="http://labs.jboss.com/portal/jbossmessaging/docs/index.html">http://labs.jboss.com/portal/jbossmessaging/docs/index.html</a><br>
-<br>
-<span style="font-weight: bold;"></span>
-<h2>Summary of Changes<br>
-</h2>
-A complete list of changes introduced since the 1.0.1.GA release, is
-available below.<br>
-<br>
-<h2>Release Notes</h2>
-<big>Includes versions: </big><big> 1.0.1.SP2 1.0.1.SP3 1.0.1.SP4 </big><big>1.2.0.Alpha1
-</big><big>1.2.0.Alpha2 </big><big>1.2.0.Beta1 </big><big>1.2.0.Beta2
-</big><big>1.2.0.CR1 </big><big>1.2.0.GA</big>
-<h2 style="margin-left: 40px;">Feature Requests</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-4">JBMESSAGING-4</a>
-] Load balancing </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-92">JBMESSAGING-92</a>
-] Integrate and enable multiplex transport </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-122">JBMESSAGING-122</a>
-] Implement the stats and monitoring MBean operations on destinations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-127">JBMESSAGING-127</a>
-] Delayed delivery, redelivery count and pluggable expiration behavior </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-162">JBMESSAGING-162</a>
-] Consider implementing different message delivery optimisations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-193">JBMESSAGING-193</a>
-] Enable configurable timeout on all calls of
-RpcServerCall.remoteInvoke(...) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-264">JBMESSAGING-264</a>
-] Message bridge </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-527">JBMESSAGING-527</a>
-] JBoss Messaging should support JMSXDeliveryCount </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-561">JBMESSAGING-561</a>
-] Write a simple example (distributed topic) and include it in the set
-shipped with the release </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-583">JBMESSAGING-583</a>
-] Add an integer check for release-admin.xml's -Did=... </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-611">JBMESSAGING-611</a>
-] Server Side Failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-612">JBMESSAGING-612</a>
-] Client Side Failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-688">JBMESSAGING-688</a>
-] Provide for message forwarding among nodes for a distributed queue. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-694">JBMESSAGING-694</a>
-] Integrate, test and document the "bisocket" remoting transport. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-704">JBMESSAGING-704</a>
-] Close a dead remoting client from failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-768">JBMESSAGING-768</a>
-] Add a test that makes sure there are no threads preventing VM to exit
-on client side. There is a placeholder already:
-org.jboss.test.thirdparty.remoting.DaemonThreadTest </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-830">JBMESSAGING-830</a>
-] Random LoadBalanceFactory for Clustered Connection Factories </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-849">JBMESSAGING-849</a>
-] Port the "mdb failure" smoke test from the 1.0 branch on the trunk </li>
-</ul>
-<h2 style="margin-left: 40px;">Bugs</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-171">JBMESSAGING-171</a>
-] Remoting timeouts </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-247">JBMESSAGING-247</a>
-] Race condition - out of order delivery </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-286">JBMESSAGING-286</a>
-] I am able to create two different durable subscriptions with same
-name using the same client ID on the same topic </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-302">JBMESSAGING-302</a>
-] Invoking Topic management interface's listMessagesDurableSub()/
-listMessagesNonDurableSub() with empty params throws exception </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-331">JBMESSAGING-331</a>
-] Message id generator and resource manager Memory leak </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-371">JBMESSAGING-371</a>
-] MessageListener times out on inactivity, after receiving at least one
-message </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-417">JBMESSAGING-417</a>
-] JMS Client does not exit </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-424">JBMESSAGING-424</a>
-] Cannot access the first message when starting the JMS subscriber </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-435">JBMESSAGING-435</a>
-] PointToPoint delivery with multiple consumers and selectors is broken
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-499">JBMESSAGING-499</a>
-] get-test-execution-classpath assumes windows </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-505">JBMESSAGING-505</a>
-] RoundRobinPointToPointRouter occasionally throws ArithmeticException:
-/ by zero </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-525">JBMESSAGING-525</a>
-] postgresql-persistence-service.xml contains invalid SQL syntax </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-526">JBMESSAGING-526</a>
-] JMSRedelivered flag not correctly set on true in certain redelivery
-scenarios </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-536">JBMESSAGING-536</a>
-] The CallbackServer cannot be contacted for some particular network
-interface configurations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-552">JBMESSAGING-552</a>
-] MessageConsumerTest.testRedeliveryToCompetingConsumerOnSubscription()
-fails on race condition </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-565">JBMESSAGING-565</a>
-] Race Condition between Topic/Queue.getMessageCount and Deliver Thread
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-587">JBMESSAGING-587</a>
-] Fix perf/build.xml </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-589">JBMESSAGING-589</a>
-] DefaultClusteredPostOfficeTest::testClusteredNameUniqueness is
-failing </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-595">JBMESSAGING-595</a>
-] Rebind of clustered durable subscription fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-596">JBMESSAGING-596</a>
-] BrowserTest should close its Connection in tearDown() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-606">JBMESSAGING-606</a>
-] Issue with cancel when paging </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-613">JBMESSAGING-613</a>
-] DelegateSupport::trace shouldn't be serialized </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-616">JBMESSAGING-616</a>
-] Race in creating new counters </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-617">JBMESSAGING-617</a>
-] Stress tests do not run </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-618">JBMESSAGING-618</a>
-] Failure in stress tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-638">JBMESSAGING-638</a>
-] Potential memory leak when using 2pc via JCA adapter. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-644">JBMESSAGING-644</a>
-] Lease fails with a NPE if server is restarted and client still
-running </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-660">JBMESSAGING-660</a>
-] Race Condition Between Session.close and Session.commit or
-Session.rollback </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-664">JBMESSAGING-664</a>
-] The 4.0.5.GA jnlp installer smoke test fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-665">JBMESSAGING-665</a>
-] 4.0.5.GA ejb3 smoke test fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-667">JBMESSAGING-667</a>
-] Clustered ConnectionFactory binding mechanism broken for a
-single-node cluster (and possibly for multi-node cluster) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-683">JBMESSAGING-683</a>
-] MSSQL configuration appears invalid </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-685">JBMESSAGING-685</a>
-] session.commit on an empty transaction causes NPE </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-686">JBMESSAGING-686</a>
-] Inconsistence between DelegateSupport and States </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-687">JBMESSAGING-687</a>
-] Fix clone on HAAspect::performClientSideFailover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-693">JBMESSAGING-693</a>
-] Starting two node clusters simultaneously may end in failed messaging
-server node boot </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-695">JBMESSAGING-695</a>
-] We need to be able to run our functional testsuite with other
-databses besides HSQLDB </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-696">JBMESSAGING-696</a>
-] Closing a connection that failed over can close the Invoker </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-698">JBMESSAGING-698</a>
-] HATest::testTopicSubscriber fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-700">JBMESSAGING-700</a>
-] Delivery count is not updated for transactional sessions on close </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-702">JBMESSAGING-702</a>
-] Dead Lock condition on MessageCallbackHandler when failover is being
-executed </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-705">JBMESSAGING-705</a>
-] ConnectionFactory service is registered under JMX
-"jboss.messaging.destination:" domain, it shoud be
-"jboss.messaging.connectionfactory:" or similar. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-716">JBMESSAGING-716</a>
-] Same message multiple times in DLQ/Expiry Queue </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-721">JBMESSAGING-721</a>
-] Message redelivery doesn't work </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-741">JBMESSAGING-741</a>
-] Message.getJMSDestination could be null on redeployment of a queue </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-744">JBMESSAGING-744</a>
-] org.jboss.test.messaging.jms.QueueTest fails if executed using
-Clustering configuration </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-748">JBMESSAGING-748</a>
-] Messaging server can be locked up by broken or malicious clients </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-749">JBMESSAGING-749</a>
-] Connection Timeouts that can lead to Serialization Exceptions </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-757">JBMESSAGING-757</a>
-] JDBCPersistenceManager incorrectly detects if a replytoId was null
-when restoring a message from a ResultSet </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-762">JBMESSAGING-762</a>
-] JBossRemoting throws java.lang.Exception in certain cases </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-764">JBMESSAGING-764</a>
-] New failover update map code does not use MessagingMarshallable. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-765">JBMESSAGING-765</a>
-] Connection invoker ref counting is broken </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-771">JBMESSAGING-771</a>
-] One way invocations do not return the connection to the pool </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-773">JBMESSAGING-773</a>
-] oneway invocations are not correctly detected inside remoting
-ServerThread.processInvocation() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-774">JBMESSAGING-774</a>
-] Order is not preserved for messages pushed asynchronously by server
-to clients </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-777">JBMESSAGING-777</a>
-] Revise creation of Object*Stream on Remoting/our Marshallers </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-782">JBMESSAGING-782</a>
-] The number of times a callback client invoker retries a failed
-invocation should be at least 2 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-783">JBMESSAGING-783</a>
-] Fix HAStressTest </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-787">JBMESSAGING-787</a>
-] Invocations time out because remoting mismanages client invokers,
-sending bussines traffic over client invokers with small timeout </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-788">JBMESSAGING-788</a>
-] ConcurrentCloseStressTest fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-790">JBMESSAGING-790</a>
-] "DeadLock" If failover happens on a MessageConsumer::receive </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-791">JBMESSAGING-791</a>
-] Duplicates clientIDs are not throwing InvalidClientIDException </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-795">JBMESSAGING-795</a>
-] Bridge tests fail </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-797">JBMESSAGING-797</a>
-] Deadlock in aop stack deployment </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-798">JBMESSAGING-798</a>
-] postoffice.cluster
-RedistributionWithDefaultMessagePullPolicyTest.testConsumeAllPersistentRecoverable()
-fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-799">JBMESSAGING-799</a>
-] org.jboss.test.messaging.jms.DuplicateClientIDTest testDuplicate()
-and testPreconfiguredDuplicateClientID() fail </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-800">JBMESSAGING-800</a>
-] Deadlock in aop stack deployment </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-801">JBMESSAGING-801</a>
-] XAOldJBossTxMgrTest.testMultipleSessionsOneTxRollbackSend() error in
-remoting socket configuration </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-802">JBMESSAGING-802</a>
-] FailoverTest.testBrowserFailoverSendMessagesPostFailure() fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-803">JBMESSAGING-803</a>
-] QueueBrowser doesn't refresh the content of its Enumeration on the
-second getEnumeration() call </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-805">JBMESSAGING-805</a>
-] Fix JMSProviderResourceRecovery </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-807">JBMESSAGING-807</a>
-] security context switch after sending a message </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-808">JBMESSAGING-808</a>
-] Failover can't happen if a failure happens on the middle of an ack
-invocation. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-809">JBMESSAGING-809</a>
-] Extra message created if server fails right after send is completed </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-812">JBMESSAGING-812</a>
-] "Cannot find object in dispatcher..." intermittent failures </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-816">JBMESSAGING-816</a>
-] Verify if pre-configured IDs are throwing an exception properly. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-818">JBMESSAGING-818</a>
-] HTTP transport sends zero length lists of polled callbacks </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-820">JBMESSAGING-820</a>
-] ConnectionFactoryUpdate ClassCastException when using HTTP </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-821">JBMESSAGING-821</a>
-] org.jboss.test.messaging.core.paging tests fail in-VM on Linux </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-824">JBMESSAGING-824</a>
-] queue smoke test fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-825">JBMESSAGING-825</a>
-] Transactions corrupted because sybase truncates trailing zeros </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-826">JBMESSAGING-826</a>
-] Using Pre Configure clientIDs will invalidate the usage of a simple
-createConnection </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-827">JBMESSAGING-827</a>
-] ACK fails during failover on transacted session </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-831">JBMESSAGING-831</a>
-] Simple (non-clustered) smoke test fails with Remoting exceptions on
-client and server-side </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-833">JBMESSAGING-833</a>
-] MDB smoke test fails (in both non-clustered and clustered
-configurations) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-834">JBMESSAGING-834</a>
-] Multiple clustering/failover test failures on dev03 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-836">JBMESSAGING-836</a>
-] Deadlock on ServerConnectionEndpoint </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-840">JBMESSAGING-840</a>
-] Shutting down the Messaging service on JBoss 4.0.1sp1 fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-841">JBMESSAGING-841</a>
-] MDB smoke test fails in clustered configuration (caused by inability
-to create temporary queues in a clustered configuration) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-842">JBMESSAGING-842</a>
-] The current clustered ConnectionFactory is not apropriate for use
-with an MDB container. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-846">JBMESSAGING-846</a>
-] release-admin.xml installation script does not correctly configures
-BindingManager for newly created clustered configurations, in some
-situations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-847">JBMESSAGING-847</a>
-] Some installer-generated JBoss installations (4.0.3, 4.0.3SP1) do not
-contain a BindingManager declaration in their jboss-service.xml, so
-release-admin.xml doesn' t work properly </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-851">JBMESSAGING-851</a>
-] Issue with remoting MAX_RETRIES </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-852">JBMESSAGING-852</a>
-] Unacked message state is not cleaned up after failure in ack </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-853">JBMESSAGING-853</a>
-] Smoke tests fail again after installing bisocket </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-856">JBMESSAGING-856</a>
-] BisocketServerInvoker inadvertently logs "got listener: null" as INFO
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-859">JBMESSAGING-859</a>
-] org.jboss.test.messaging.jms.clustering.MultiThreadFailoverTest
-generates errors </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-860">JBMESSAGING-860</a>
-] MDB Using ClientID would fail because of some ClassLoading Isolation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-862">JBMESSAGING-862</a>
-]
-org.jboss.test.messaging.jms.clustering.FailoverTest.testFailureRightBeforeACK()
-fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-863">JBMESSAGING-863</a>
-] Bisocket test fails with socket listen security violation on
-client-side </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-870">JBMESSAGING-870</a>
-] ClusteredPostOffice will route to durable subscription if node is not
-active </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-887">JBMESSAGING-887</a>
-] Failover breaks after a couple of iterations of stopping/starting
-servers </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-888">JBMESSAGING-888</a>
-] Fix DefaultRouter </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-891">JBMESSAGING-891</a>
-] Failover during an invocation of AnyClientDelegate.close() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-895">JBMESSAGING-895</a>
-] release-admin.xml doesn't handle correctly ServiceBindingManager
-configuration for clustered installations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-896">JBMESSAGING-896</a>
-] FailoverTest::testMergeQueue2 and testMergeQueue fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-898">JBMESSAGING-898</a>
-] Connection factory is not protected for failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-899">JBMESSAGING-899</a>
-] Messages are temporarily lost if message arrives on a closed
-MessageCallbackHandler </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-903">JBMESSAGING-903</a>
-]
-org.jboss.test.messaging.jms.clustering.MergeQueueTest.testMergeQueue2()
-fails on Linux </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-904">JBMESSAGING-904</a>
-]
-org.jboss.test.messaging.jms.clustering.MultipleFailoverTest.testFailoverFloodTwoServers()
-fails on Linux </li>
-</ul>
-<h2 style="margin-left: 40px;">Tasks</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-43">JBMESSAGING-43</a>
-] Change the module name to "messaging" </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-89">JBMESSAGING-89</a>
-] Repository reorganization </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-139">JBMESSAGING-139</a>
-] Consider whether core can be refactored to remove concept of delivery
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-140">JBMESSAGING-140</a>
-] Move responsibility for management of delivery list from receiver
-into channel </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-175">JBMESSAGING-175</a>
-] Unnecessary junit.timeout2 used by tests/build.xml </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-178">JBMESSAGING-178</a>
-] Run TCK continuously in top of JBoss Messaging </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-192">JBMESSAGING-192</a>
-] Refactor Replicator so it won't be forced to provide noop
-implementation for Distributor's methods. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-197">JBMESSAGING-197</a>
-] Refactor Channel, Distributor etc so there is only one receiver per
-channel </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-199">JBMESSAGING-199</a>
-] Fix or mothball remotetopic so it does not require multiple
-deliveries per message reference </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-200">JBMESSAGING-200</a>
-] Complete XA transaction recovery </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-207">JBMESSAGING-207</a>
-] HTTP invoker configuration and testing </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-227">JBMESSAGING-227</a>
-] Complete extension of smoke test to deploy/test non-scoped Messaging
-with JBoss 5.0 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-228">JBMESSAGING-228</a>
-] Re-enable DistributedTopicTest testDistributedTopic_2() and
-testDistributedTopic_4() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-229">JBMESSAGING-229</a>
-] Peristence Optimizations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-246">JBMESSAGING-246</a>
-] Optimise browsing </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-248">JBMESSAGING-248</a>
-] Smart copying for message references </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-250">JBMESSAGING-250</a>
-] Put performance testing framework in it's own subproject </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-255">JBMESSAGING-255</a>
-] Change signature of core interfaces to deal with MessageReferences
-only </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-257">JBMESSAGING-257</a>
-] Optimisation for deliveries immediately returned as done </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-266">JBMESSAGING-266</a>
-] Remove Routable </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-267">JBMESSAGING-267</a>
-] Re-enable distributed tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-268">JBMESSAGING-268</a>
-] Convert destinations to ints in message instance </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-269">JBMESSAGING-269</a>
-] Review ChannelMapper interface for possible functionality separation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-289">JBMESSAGING-289</a>
-] Make service container configurable wrt datasource and persistence
-manager config </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-300">JBMESSAGING-300</a>
-] Deadlock detection </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-307">JBMESSAGING-307</a>
-] Down cache optimisation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-310">JBMESSAGING-310</a>
-] Investigate whether rw lock on ServerConnectionEndpoint is necessary </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-313">JBMESSAGING-313</a>
-] INVM persistent message optimisation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-319">JBMESSAGING-319</a>
-] Enable the Messaging build to use component-info.xml and versioned
-dependencies </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-327">JBMESSAGING-327</a>
-] Improve concurrency for acknowledgement </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-330">JBMESSAGING-330</a>
-] Consider using remoting raw invocations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-332">JBMESSAGING-332</a>
-] Consider how best to factor paging logic out of channel state </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-355">JBMESSAGING-355</a>
-] Remove possibility of delivery race conditions </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-398">JBMESSAGING-398</a>
-] Summarize clustering design discussions and forum threads in a
-Clustering Design document </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-404">JBMESSAGING-404</a>
-] Remove Channel::deliver(Receiver r) method </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-414">JBMESSAGING-414</a>
-] Simplify delivery hierarchy </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-422">JBMESSAGING-422</a>
-] Move channel mapper logic into Queue, Topic, Subscription classes </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-425">JBMESSAGING-425</a>
-] Naming of Pipe and Distributed Pipe </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-437">JBMESSAGING-437</a>
-] Non durable subscription optimization </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-444">JBMESSAGING-444</a>
-] Release 1.2.0.Alpha1 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-445">JBMESSAGING-445</a>
-] Update user documentation with clustering-related details </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-447">JBMESSAGING-447</a>
-] Release 1.2.0 GA after waiting for a week for feedback on the latest
-CR </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-516">JBMESSAGING-516</a>
-] Clustering </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-550">JBMESSAGING-550</a>
-] Add JBoss 4.0.5.CR1 (expanded and installer-generated) to the smoke
-test suite </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-560">JBMESSAGING-560</a>
-] Support all JBossMQ equivalent JMX functionality </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-562">JBMESSAGING-562</a>
-] Adjust the installation script to support a clustered installation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-563">JBMESSAGING-563</a>
-] Update the documentation with a Clustering Intro </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-567">JBMESSAGING-567</a>
-] Bring persistence manager configs up to date </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-568">JBMESSAGING-568</a>
-] Complete the configuration section in the Alpha clustering guide </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-569">JBMESSAGING-569</a>
-] Update clustering design documentation wiki </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-571">JBMESSAGING-571</a>
-] Get unicast to work with clustering </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-573">JBMESSAGING-573</a>
-] Add clustering crash and recovery tests to suite </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-575">JBMESSAGING-575</a>
-] Stabilise the default message pull policy </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-577">JBMESSAGING-577</a>
-] Handle sequence numbers properly for state transfer... </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-578">JBMESSAGING-578</a>
-] Allow messaging to use app server's multiplex JGroups channel </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-579">JBMESSAGING-579</a>
-] Improve shared durable subscription tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-580">JBMESSAGING-580</a>
-] Document configuration and schema changes from 1.0 and publish a
-detailed migration guide </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-581">JBMESSAGING-581</a>
-] ServerManagement needs to be extended to start cluster node instances
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-582">JBMESSAGING-582</a>
-] Modify and test release-admin.xml so it is capable of creating
-clustered configurations using a different database than mysql </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-591">JBMESSAGING-591</a>
-] MessageConsumerTest::testTimeoutReceiveOnClose can randomly fail </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-593">JBMESSAGING-593</a>
-] Analyse current JGroups stack usage </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-594">JBMESSAGING-594</a>
-] Consider having just one post office instance </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-597">JBMESSAGING-597</a>
-] Tracker task for JBSHOTOKU-101 (blogs dont show up in our Labs
-project blog area) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-601">JBMESSAGING-601</a>
-] Place Messaging artifacts in the repository </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-610">JBMESSAGING-610</a>
-] Merge 1.0.1.GA changes (Branch_1_0) into the trunk </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-614">JBMESSAGING-614</a>
-] Remove shutdown logger </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-615">JBMESSAGING-615</a>
-] Add sufficient tracing for a customer environment </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-621">JBMESSAGING-621</a>
-] Modify the smoke test suite to run tests in top of JBoss 4.0.5.GA
-instead of 4.0.5.CR1 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-628">JBMESSAGING-628</a>
-] Investigate message priority in presence of prefetching </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-631">JBMESSAGING-631</a>
-] Update the build script to produce an unscoped SAR </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-632">JBMESSAGING-632</a>
-] Migreate the deployment descriptors and the AS-related artifacts to
-the AS repository </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-649">JBMESSAGING-649</a>
-] Move ClusterRequest and its subclasses to its own package </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-657">JBMESSAGING-657</a>
-] Sort out flow control </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-673">JBMESSAGING-673</a>
-] Extend test suite framework to restart remote servers </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-684">JBMESSAGING-684</a>
-] Validate curisecontrol test results after the test environment is
-configured to use MySQL </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-689">JBMESSAGING-689</a>
-] Add distributed topic smoke test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-690">JBMESSAGING-690</a>
-] Add distributed queue smoke test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-691">JBMESSAGING-691</a>
-] Add failover smoke test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-692">JBMESSAGING-692</a>
-] Modify all smoke tests to run in non-clustered AND clustered version.
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-699">JBMESSAGING-699</a>
-] Ensure remoting implements true asynchronous callbacks </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-701">JBMESSAGING-701</a>
-] Optimisation - Allow onMessage to be executed on the remoting thread </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-706">JBMESSAGING-706</a>
-] Failover mop-up </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-723">JBMESSAGING-723</a>
-] Move Multiplexor to ServiceContainer on the Testsuite </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-727">JBMESSAGING-727</a>
-] ServerPeer.destroyQueue/destroTopic just undeploys, does not destroy </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-731">JBMESSAGING-731</a>
-] Get a new tagged remoting release from the remoting team </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-734">JBMESSAGING-734</a>
-] Create failover tests for failover of XASesions </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-735">JBMESSAGING-735</a>
-] Consider disabling pinging while failover is happening </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-738">JBMESSAGING-738</a>
-] Make sure all functional and stress tests pass </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-739">JBMESSAGING-739</a>
-] Make sure db schema is correct </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-740">JBMESSAGING-740</a>
-] Make sure wireformat is just right </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-743">JBMESSAGING-743</a>
-] Run the whole functional test suite and the stress tests in both
-clustered and non-clustered configurations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-746">JBMESSAGING-746</a>
-] Ensure MDB integration tests exist </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-755">JBMESSAGING-755</a>
-] Bring mdb-failure's README.html up to date </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-756">JBMESSAGING-756</a>
-] Enable mdb-failure smoke test so it will run with the smoke test
-suite </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-758">JBMESSAGING-758</a>
-] Add a client and server shutdown test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-759">JBMESSAGING-759</a>
-] Add new "cluster view update on client" test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-769">JBMESSAGING-769</a>
-] Make ConnectionFactoryUpdateMessage encapsulated in a
-MarshalledMessage object </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-770">JBMESSAGING-770</a>
-] Add tests for ConnectionFactory loadBalanceFactory MBean attribute </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-776">JBMESSAGING-776</a>
-] Specify one way thread pool on the server side too </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-778">JBMESSAGING-778</a>
-] Clear testcases </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-785">JBMESSAGING-785</a>
-] Create long running invocation test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-792">JBMESSAGING-792</a>
-] Modify testing framework to use with priority JGroups stack
-configurations we ship with the release </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-813">JBMESSAGING-813</a>
-] Test failover (and clustering in general) on a QA lab network with
-several physical machines involved </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-822">JBMESSAGING-822</a>
-] Outstanding remoting issues JBREM-690, JBREM-693 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-854">JBMESSAGING-854</a>
-] Integration with JBoss AS 5.0 </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-865">JBMESSAGING-865</a>
-] Modify log4j configuration to mask Remoting's [BisocketServerInvoker]
-got listener: null </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-866">JBMESSAGING-866</a>
-] Revert log4j configuration that masks Remoting's
-[BisocketServerInvoker] got listener: null </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-867">JBMESSAGING-867</a>
-] Validate Sybase Installation script </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-881">JBMESSAGING-881</a>
-] Mention in the release notes and documentation that at least ant
-1.6.3 is required </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-882">JBMESSAGING-882</a>
-] Change mssql-ds.xml to use the sourceforge driver </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-900">JBMESSAGING-900</a>
-] Decide on ClusteredConnectionFactoryTest.testGetAOPBounce() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-902">JBMESSAGING-902</a>
-] Abort the installation script if there are no permissions to create
-temporary files </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-906">JBMESSAGING-906</a>
-] Decide on how to ship DistributeQueueExample (and smoke test):
-disable/null policy/default policy</li>
-</ul>
-<h2 style="margin-left: 40px;">Sub-tasks</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-150">JBMESSAGING-150</a>
-] TCK sould test Messaging, and not JBossMQ, by default </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-235">JBMESSAGING-235</a>
-] Make use of the datasource mappings </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-240">JBMESSAGING-240</a>
-] Review reference counting in the database </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-385">JBMESSAGING-385</a>
-] Generalize jboss testsuite JMS tests to work with both Messaging and
-JBossMQ (where possible) and make sure they pass </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-386">JBMESSAGING-386</a>
-] Isolate JBossMQ-specific tests and make sure they pass </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-456">JBMESSAGING-456</a>
-] Migrate jboss-head/jms subdirectory content to standalone SVN
-repository </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-457">JBMESSAGING-457</a>
-] Modify the build system to use jbossbuild </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-458">JBMESSAGING-458</a>
-] Update JBossMessagingBuildInstructions wiki page </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-460">JBMESSAGING-460</a>
-] Get rid of derelict SVN branches and tags </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-461">JBMESSAGING-461</a>
-] Post on the development forum an announcement that the SVN is
-complete </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-462">JBMESSAGING-462</a>
-] Verify the validity of the artifacts generated by the new build </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-463">JBMESSAGING-463</a>
-] Completely get rid of commented out jboss.aspects.lib references from
-build-messaging.xml </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-464">JBMESSAGING-464</a>
-] log4j output format differs from the CVS version </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-465">JBMESSAGING-465</a>
-] Failed to initalize plugin org.jboss.logging.Log4jLoggerPlugin at 513cf0
-  </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-466">JBMESSAGING-466</a>
-] Take a final decision on whether to use &amp;tools or keep only parts
-of jbossbuild under "tools" </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-468">JBMESSAGING-468</a>
-] Re-activate the perf framework under the new build system </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-469">JBMESSAGING-469</a>
-] Clarify how build-thirdparty.xml's <build> task attributes should be
-used. </build></li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-470">JBMESSAGING-470</a>
-] Modify start-rmi-server and stop-rmi-server to use
-"test.execution.classpath" generated by tests/build.xml </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-471">JBMESSAGING-471</a>
-] Set up a process to update messaging artifacts in repository </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-473">JBMESSAGING-473</a>
-] Remote test reports overwrite local test reports </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-474">JBMESSAGING-474</a>
-] lib/jboss-serialization.jar doesn't override
-thirdparty/jboss/serialization </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-475">JBMESSAGING-475</a>
-] Old build-related tasks </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-482">JBMESSAGING-482</a>
-] stress tests don't work </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-483">JBMESSAGING-483</a>
-] ManifestTest fails </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-517">JBMESSAGING-517</a>
-] Implement intelligent balancer </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-518">JBMESSAGING-518</a>
-] Implement distributed destinations </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-519">JBMESSAGING-519</a>
-] Transparent failover / HA </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-554">JBMESSAGING-554</a>
-] Create an Admin abstraction that would allow running generic JMS
-tests regardless of provider implementation </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-555">JBMESSAGING-555</a>
-] Separate generic JMS tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-556">JBMESSAGING-556</a>
-] Isolate JBossMQ-specific test </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-627">JBMESSAGING-627</a>
-] Create an ant configuration file fragment that would build a
-Messaging configuration for the AS testing, adding things like securiy
-roles, etc. </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-666">JBMESSAGING-666</a>
-] Basic DLQ functionality </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-668">JBMESSAGING-668</a>
-] Basic client-side failover logic </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-669">JBMESSAGING-669</a>
-] Client side valve </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-670">JBMESSAGING-670</a>
-] Redirection of connection if server is not failover server </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-671">JBMESSAGING-671</a>
-] Recreate delivery list on the server when failure occurs </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-672">JBMESSAGING-672</a>
-] Server side valve </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-674">JBMESSAGING-674</a>
-] Propagate changes in server list back to client when server side view
-change occurs </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-675">JBMESSAGING-675</a>
-] Make client side load balancing policy pluggable </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-678">JBMESSAGING-678</a>
-] Merge to trunk </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-707">JBMESSAGING-707</a>
-] Add session-level failover tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-708">JBMESSAGING-708</a>
-] Move SessionState.handleFailoverOnConsumer() consumer failover logic
-to ClientConsumerDelegate/ConsumerState </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-709">JBMESSAGING-709</a>
-] Move SessionState.handleFailoverOnProducer() producer failover logic
-to ClientProducerDelegate/ProducerState </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-710">JBMESSAGING-710</a>
-] Move SessionState.handleFailoverOnBrowser() browser failover logic to
-ClientBrowserDelegate/BrowserState </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-711">JBMESSAGING-711</a>
-] Test to failover a connection that was created using a username and a
-password </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-712">JBMESSAGING-712</a>
-] FailoverTest.testFailoverMessageOnServer2() deadlocks </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-713">JBMESSAGING-713</a>
-] Document better the cases in which failedNodeID of
-ConnectionFactoryEndpoint.createConnectionDelegate(username, password,
-failedNodeID) is disregarded </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-714">JBMESSAGING-714</a>
-] Make sure all dependent instances of the failed connection
-(ConnectionFailureListener included) are propery garbage collected
-after failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-715">JBMESSAGING-715</a>
-] FailoverTest.testFailoverMessageOnServer() fails with "Cannot find
-delivery to acknowledge" after failover </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-719">JBMESSAGING-719</a>
-] Capturing I/O Exceptions from invocation on Valve </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-720">JBMESSAGING-720</a>
-] Clustered ConnectionFactory bound twice on a failover event (and the
-first time is an inconsistent state) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-722">JBMESSAGING-722</a>
-] Bindings containing the new FailedOverQueue need to be properly saved
-in the database (new field needed: failedNodeID) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-729">JBMESSAGING-729</a>
-] Multiple successive failover tests grind to a halt because of
-Remoting ConnectionValidator bug(s) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-730">JBMESSAGING-730</a>
-] Failover valve fails to close in
-FailoverTest.testConsumerFailoverWithConnectionStopped() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-733">JBMESSAGING-733</a>
-] Add test for failure occuring in the middle of high volume traffic
-(tens of threads) </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-766">JBMESSAGING-766</a>
-] Massive functional testsuite failure (108 failures, 99 errors)
-related to the latest remoting changes </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-767">JBMESSAGING-767</a>
-] HTTP tests lock testsuite run </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-775">JBMESSAGING-775</a>
-]
-org.jboss.test.messaging.jms.selector.SelectorTest.testManyQueueWithExpired()
-locks up </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-779">JBMESSAGING-779</a>
-] Fix crash test CallbackFailureTest.testCallbackFailure() </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-780">JBMESSAGING-780</a>
-] Fix thirdparty.remoting HTTP tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-781">JBMESSAGING-781</a>
-] Fix Clustering Tests </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-786">JBMESSAGING-786</a>
-] HTTP remoting client throws different exception on failure </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-796">JBMESSAGING-796</a>
-] Execute and validate the integration testsuite </li>
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-893">JBMESSAGING-893</a>
-] Some request is not completing, causing
-MultiThreadFailoverTest.testMultiThreadFailoverSeveralThreadsTransacted()
-to loop forever </li>
-</ul>
-<h2 style="margin-left: 40px;">Support Patches</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-742">JBMESSAGING-742</a>
-] Update of JBossRemoting to Alpha4 and JBMESSAGING-741 </li>
-</ul>
-<h2 style="margin-left: 40px;">Patches</h2>
-<ul style="margin-left: 40px;">
-  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-625">JBMESSAGING-625</a>
-] ClassCastException String to ManagedDestination </li>
-</ul>
-<div style="margin-left: 40px;"><br>
-<br>
-</div>
-<hr style="width: 100%; height: 2px;">
-</body>
-</html>

Copied: tags/JBossMessaging_1_2_0_SP1/docs/README.html (from rev 2566, branches/Branch_1_2_0_SP/docs/README.html)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/docs/README.html	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/docs/README.html	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,817 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Release Notes</title>
+</head>
+<body>
+
+<br>
+March 28 2007<br>
+<br>
+<br>
+JBoss
+Messaging is a new JBoss JMS 1.1-compliant JMS provider, aimed to
+replace JBossMQ.&nbsp; This is the first General Availability (GA)
+clustering release. 1.2.0.GA includes full
+clustering, with load balancing and
+transparent failover. An extensive overview of its features, as well as
+installation and configuration instructions are available in the "JBoss
+Messaging 1.2 User Guide". The guide is bundled with this release and
+is
+provided in <a href="./docs/userguide/html/index.html">HTML</a>, <a
+ href="./docs/userguide/html_single/index.html">HTML-single</a>
+and <a href="./docs/userguide/pdf/JBossMessagingUsersGuide.pdf">PDF</a>
+formats.&nbsp; The guide is also available on-line at&nbsp; <a
+ href="http://labs.jboss.com/portal/jbossmessaging/docs/index.html">http://labs.jboss.com/portal/jbossmessaging/docs/index.html</a><br>
+
+<h1><br>
+Release Notes - JBoss Messaging - Version 1.2.0.SP1
+</h1>
+    
+<h2>Bug</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-922'>JBMESSAGING-922</a>] - JBossConnection::setExceptionListener needs to set ClassLoader</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-924'>JBMESSAGING-924</a>] - ObjectMessage.getObject() should deserialize using context classloader</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-928'>JBMESSAGING-928</a>] - Server hangs if client is abruptedly killed</li>
+</ul>
+                            
+<h2>Task</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-254'>JBMESSAGING-254</a>] - Remove ThreadContextClassLoaderChanger</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-920'>JBMESSAGING-920</a>] - Memory Leaks when opening/closing connections</li>
+</ul>
+
+
+
+<h1><br>
+JBoss Messaging 1.2.0.GA Release Notes</h1>
+<br>
+<span style="font-weight: bold;"></span>
+<h2>Summary of Changes<br>
+</h2>
+A complete list of changes introduced since the 1.0.1.GA release, is
+available below.<br>
+<br>
+<h2>Release Notes</h2>
+<big>Includes versions: </big><big> 1.0.1.SP2 1.0.1.SP3 1.0.1.SP4 </big><big>1.2.0.Alpha1
+</big><big>1.2.0.Alpha2 </big><big>1.2.0.Beta1 </big><big>1.2.0.Beta2
+</big><big>1.2.0.CR1 </big><big>1.2.0.GA</big>
+<h2 style="margin-left: 40px;">Feature Requests</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-4">JBMESSAGING-4</a>
+] Load balancing </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-92">JBMESSAGING-92</a>
+] Integrate and enable multiplex transport </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-122">JBMESSAGING-122</a>
+] Implement the stats and monitoring MBean operations on destinations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-127">JBMESSAGING-127</a>
+] Delayed delivery, redelivery count and pluggable expiration behavior </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-162">JBMESSAGING-162</a>
+] Consider implementing different message delivery optimisations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-193">JBMESSAGING-193</a>
+] Enable configurable timeout on all calls of
+RpcServerCall.remoteInvoke(...) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-264">JBMESSAGING-264</a>
+] Message bridge </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-527">JBMESSAGING-527</a>
+] JBoss Messaging should support JMSXDeliveryCount </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-561">JBMESSAGING-561</a>
+] Write a simple example (distributed topic) and include it in the set
+shipped with the release </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-583">JBMESSAGING-583</a>
+] Add an integer check for release-admin.xml's -Did=... </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-611">JBMESSAGING-611</a>
+] Server Side Failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-612">JBMESSAGING-612</a>
+] Client Side Failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-688">JBMESSAGING-688</a>
+] Provide for message forwarding among nodes for a distributed queue. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-694">JBMESSAGING-694</a>
+] Integrate, test and document the "bisocket" remoting transport. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-704">JBMESSAGING-704</a>
+] Close a dead remoting client from failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-768">JBMESSAGING-768</a>
+] Add a test that makes sure there are no threads preventing VM to exit
+on client side. There is a placeholder already:
+org.jboss.test.thirdparty.remoting.DaemonThreadTest </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-830">JBMESSAGING-830</a>
+] Random LoadBalanceFactory for Clustered Connection Factories </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-849">JBMESSAGING-849</a>
+] Port the "mdb failure" smoke test from the 1.0 branch on the trunk </li>
+</ul>
+<h2 style="margin-left: 40px;">Bugs</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-171">JBMESSAGING-171</a>
+] Remoting timeouts </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-247">JBMESSAGING-247</a>
+] Race condition - out of order delivery </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-286">JBMESSAGING-286</a>
+] I am able to create two different durable subscriptions with same
+name using the same client ID on the same topic </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-302">JBMESSAGING-302</a>
+] Invoking Topic management interface's listMessagesDurableSub()/
+listMessagesNonDurableSub() with empty params throws exception </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-331">JBMESSAGING-331</a>
+] Message id generator and resource manager Memory leak </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-371">JBMESSAGING-371</a>
+] MessageListener times out on inactivity, after receiving at least one
+message </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-417">JBMESSAGING-417</a>
+] JMS Client does not exit </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-424">JBMESSAGING-424</a>
+] Cannot access the first message when starting the JMS subscriber </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-435">JBMESSAGING-435</a>
+] PointToPoint delivery with multiple consumers and selectors is broken
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-499">JBMESSAGING-499</a>
+] get-test-execution-classpath assumes windows </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-505">JBMESSAGING-505</a>
+] RoundRobinPointToPointRouter occasionally throws ArithmeticException:
+/ by zero </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-525">JBMESSAGING-525</a>
+] postgresql-persistence-service.xml contains invalid SQL syntax </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-526">JBMESSAGING-526</a>
+] JMSRedelivered flag not correctly set on true in certain redelivery
+scenarios </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-536">JBMESSAGING-536</a>
+] The CallbackServer cannot be contacted for some particular network
+interface configurations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-552">JBMESSAGING-552</a>
+] MessageConsumerTest.testRedeliveryToCompetingConsumerOnSubscription()
+fails on race condition </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-565">JBMESSAGING-565</a>
+] Race Condition between Topic/Queue.getMessageCount and Deliver Thread
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-587">JBMESSAGING-587</a>
+] Fix perf/build.xml </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-589">JBMESSAGING-589</a>
+] DefaultClusteredPostOfficeTest::testClusteredNameUniqueness is
+failing </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-595">JBMESSAGING-595</a>
+] Rebind of clustered durable subscription fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-596">JBMESSAGING-596</a>
+] BrowserTest should close its Connection in tearDown() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-606">JBMESSAGING-606</a>
+] Issue with cancel when paging </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-613">JBMESSAGING-613</a>
+] DelegateSupport::trace shouldn't be serialized </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-616">JBMESSAGING-616</a>
+] Race in creating new counters </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-617">JBMESSAGING-617</a>
+] Stress tests do not run </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-618">JBMESSAGING-618</a>
+] Failure in stress tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-638">JBMESSAGING-638</a>
+] Potential memory leak when using 2pc via JCA adapter. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-644">JBMESSAGING-644</a>
+] Lease fails with a NPE if server is restarted and client still
+running </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-660">JBMESSAGING-660</a>
+] Race Condition Between Session.close and Session.commit or
+Session.rollback </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-664">JBMESSAGING-664</a>
+] The 4.0.5.GA jnlp installer smoke test fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-665">JBMESSAGING-665</a>
+] 4.0.5.GA ejb3 smoke test fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-667">JBMESSAGING-667</a>
+] Clustered ConnectionFactory binding mechanism broken for a
+single-node cluster (and possibly for multi-node cluster) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-683">JBMESSAGING-683</a>
+] MSSQL configuration appears invalid </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-685">JBMESSAGING-685</a>
+] session.commit on an empty transaction causes NPE </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-686">JBMESSAGING-686</a>
+] Inconsistence between DelegateSupport and States </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-687">JBMESSAGING-687</a>
+] Fix clone on HAAspect::performClientSideFailover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-693">JBMESSAGING-693</a>
+] Starting two node clusters simultaneously may end in failed messaging
+server node boot </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-695">JBMESSAGING-695</a>
+] We need to be able to run our functional testsuite with other
+databses besides HSQLDB </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-696">JBMESSAGING-696</a>
+] Closing a connection that failed over can close the Invoker </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-698">JBMESSAGING-698</a>
+] HATest::testTopicSubscriber fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-700">JBMESSAGING-700</a>
+] Delivery count is not updated for transactional sessions on close </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-702">JBMESSAGING-702</a>
+] Dead Lock condition on MessageCallbackHandler when failover is being
+executed </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-705">JBMESSAGING-705</a>
+] ConnectionFactory service is registered under JMX
+"jboss.messaging.destination:" domain, it shoud be
+"jboss.messaging.connectionfactory:" or similar. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-716">JBMESSAGING-716</a>
+] Same message multiple times in DLQ/Expiry Queue </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-721">JBMESSAGING-721</a>
+] Message redelivery doesn't work </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-741">JBMESSAGING-741</a>
+] Message.getJMSDestination could be null on redeployment of a queue </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-744">JBMESSAGING-744</a>
+] org.jboss.test.messaging.jms.QueueTest fails if executed using
+Clustering configuration </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-748">JBMESSAGING-748</a>
+] Messaging server can be locked up by broken or malicious clients </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-749">JBMESSAGING-749</a>
+] Connection Timeouts that can lead to Serialization Exceptions </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-757">JBMESSAGING-757</a>
+] JDBCPersistenceManager incorrectly detects if a replytoId was null
+when restoring a message from a ResultSet </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-762">JBMESSAGING-762</a>
+] JBossRemoting throws java.lang.Exception in certain cases </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-764">JBMESSAGING-764</a>
+] New failover update map code does not use MessagingMarshallable. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-765">JBMESSAGING-765</a>
+] Connection invoker ref counting is broken </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-771">JBMESSAGING-771</a>
+] One way invocations do not return the connection to the pool </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-773">JBMESSAGING-773</a>
+] oneway invocations are not correctly detected inside remoting
+ServerThread.processInvocation() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-774">JBMESSAGING-774</a>
+] Order is not preserved for messages pushed asynchronously by server
+to clients </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-777">JBMESSAGING-777</a>
+] Revise creation of Object*Stream on Remoting/our Marshallers </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-782">JBMESSAGING-782</a>
+] The number of times a callback client invoker retries a failed
+invocation should be at least 2 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-783">JBMESSAGING-783</a>
+] Fix HAStressTest </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-787">JBMESSAGING-787</a>
+] Invocations time out because remoting mismanages client invokers,
+sending bussines traffic over client invokers with small timeout </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-788">JBMESSAGING-788</a>
+] ConcurrentCloseStressTest fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-790">JBMESSAGING-790</a>
+] "DeadLock" If failover happens on a MessageConsumer::receive </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-791">JBMESSAGING-791</a>
+] Duplicates clientIDs are not throwing InvalidClientIDException </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-795">JBMESSAGING-795</a>
+] Bridge tests fail </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-797">JBMESSAGING-797</a>
+] Deadlock in aop stack deployment </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-798">JBMESSAGING-798</a>
+] postoffice.cluster
+RedistributionWithDefaultMessagePullPolicyTest.testConsumeAllPersistentRecoverable()
+fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-799">JBMESSAGING-799</a>
+] org.jboss.test.messaging.jms.DuplicateClientIDTest testDuplicate()
+and testPreconfiguredDuplicateClientID() fail </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-800">JBMESSAGING-800</a>
+] Deadlock in aop stack deployment </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-801">JBMESSAGING-801</a>
+] XAOldJBossTxMgrTest.testMultipleSessionsOneTxRollbackSend() error in
+remoting socket configuration </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-802">JBMESSAGING-802</a>
+] FailoverTest.testBrowserFailoverSendMessagesPostFailure() fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-803">JBMESSAGING-803</a>
+] QueueBrowser doesn't refresh the content of its Enumeration on the
+second getEnumeration() call </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-805">JBMESSAGING-805</a>
+] Fix JMSProviderResourceRecovery </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-807">JBMESSAGING-807</a>
+] security context switch after sending a message </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-808">JBMESSAGING-808</a>
+] Failover can't happen if a failure happens on the middle of an ack
+invocation. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-809">JBMESSAGING-809</a>
+] Extra message created if server fails right after send is completed </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-812">JBMESSAGING-812</a>
+] "Cannot find object in dispatcher..." intermittent failures </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-816">JBMESSAGING-816</a>
+] Verify if pre-configured IDs are throwing an exception properly. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-818">JBMESSAGING-818</a>
+] HTTP transport sends zero length lists of polled callbacks </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-820">JBMESSAGING-820</a>
+] ConnectionFactoryUpdate ClassCastException when using HTTP </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-821">JBMESSAGING-821</a>
+] org.jboss.test.messaging.core.paging tests fail in-VM on Linux </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-824">JBMESSAGING-824</a>
+] queue smoke test fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-825">JBMESSAGING-825</a>
+] Transactions corrupted because sybase truncates trailing zeros </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-826">JBMESSAGING-826</a>
+] Using Pre Configure clientIDs will invalidate the usage of a simple
+createConnection </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-827">JBMESSAGING-827</a>
+] ACK fails during failover on transacted session </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-831">JBMESSAGING-831</a>
+] Simple (non-clustered) smoke test fails with Remoting exceptions on
+client and server-side </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-833">JBMESSAGING-833</a>
+] MDB smoke test fails (in both non-clustered and clustered
+configurations) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-834">JBMESSAGING-834</a>
+] Multiple clustering/failover test failures on dev03 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-836">JBMESSAGING-836</a>
+] Deadlock on ServerConnectionEndpoint </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-840">JBMESSAGING-840</a>
+] Shutting down the Messaging service on JBoss 4.0.1sp1 fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-841">JBMESSAGING-841</a>
+] MDB smoke test fails in clustered configuration (caused by inability
+to create temporary queues in a clustered configuration) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-842">JBMESSAGING-842</a>
+] The current clustered ConnectionFactory is not apropriate for use
+with an MDB container. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-846">JBMESSAGING-846</a>
+] release-admin.xml installation script does not correctly configures
+BindingManager for newly created clustered configurations, in some
+situations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-847">JBMESSAGING-847</a>
+] Some installer-generated JBoss installations (4.0.3, 4.0.3SP1) do not
+contain a BindingManager declaration in their jboss-service.xml, so
+release-admin.xml doesn' t work properly </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-851">JBMESSAGING-851</a>
+] Issue with remoting MAX_RETRIES </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-852">JBMESSAGING-852</a>
+] Unacked message state is not cleaned up after failure in ack </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-853">JBMESSAGING-853</a>
+] Smoke tests fail again after installing bisocket </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-856">JBMESSAGING-856</a>
+] BisocketServerInvoker inadvertently logs "got listener: null" as INFO
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-859">JBMESSAGING-859</a>
+] org.jboss.test.messaging.jms.clustering.MultiThreadFailoverTest
+generates errors </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-860">JBMESSAGING-860</a>
+] MDB Using ClientID would fail because of some ClassLoading Isolation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-862">JBMESSAGING-862</a>
+]
+org.jboss.test.messaging.jms.clustering.FailoverTest.testFailureRightBeforeACK()
+fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-863">JBMESSAGING-863</a>
+] Bisocket test fails with socket listen security violation on
+client-side </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-870">JBMESSAGING-870</a>
+] ClusteredPostOffice will route to durable subscription if node is not
+active </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-887">JBMESSAGING-887</a>
+] Failover breaks after a couple of iterations of stopping/starting
+servers </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-888">JBMESSAGING-888</a>
+] Fix DefaultRouter </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-891">JBMESSAGING-891</a>
+] Failover during an invocation of AnyClientDelegate.close() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-895">JBMESSAGING-895</a>
+] release-admin.xml doesn't handle correctly ServiceBindingManager
+configuration for clustered installations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-896">JBMESSAGING-896</a>
+] FailoverTest::testMergeQueue2 and testMergeQueue fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-898">JBMESSAGING-898</a>
+] Connection factory is not protected for failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-899">JBMESSAGING-899</a>
+] Messages are temporarily lost if message arrives on a closed
+MessageCallbackHandler </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-903">JBMESSAGING-903</a>
+]
+org.jboss.test.messaging.jms.clustering.MergeQueueTest.testMergeQueue2()
+fails on Linux </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-904">JBMESSAGING-904</a>
+]
+org.jboss.test.messaging.jms.clustering.MultipleFailoverTest.testFailoverFloodTwoServers()
+fails on Linux </li>
+</ul>
+<h2 style="margin-left: 40px;">Tasks</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-43">JBMESSAGING-43</a>
+] Change the module name to "messaging" </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-89">JBMESSAGING-89</a>
+] Repository reorganization </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-139">JBMESSAGING-139</a>
+] Consider whether core can be refactored to remove concept of delivery
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-140">JBMESSAGING-140</a>
+] Move responsibility for management of delivery list from receiver
+into channel </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-175">JBMESSAGING-175</a>
+] Unnecessary junit.timeout2 used by tests/build.xml </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-178">JBMESSAGING-178</a>
+] Run TCK continuously in top of JBoss Messaging </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-192">JBMESSAGING-192</a>
+] Refactor Replicator so it won't be forced to provide noop
+implementation for Distributor's methods. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-197">JBMESSAGING-197</a>
+] Refactor Channel, Distributor etc so there is only one receiver per
+channel </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-199">JBMESSAGING-199</a>
+] Fix or mothball remotetopic so it does not require multiple
+deliveries per message reference </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-200">JBMESSAGING-200</a>
+] Complete XA transaction recovery </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-207">JBMESSAGING-207</a>
+] HTTP invoker configuration and testing </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-227">JBMESSAGING-227</a>
+] Complete extension of smoke test to deploy/test non-scoped Messaging
+with JBoss 5.0 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-228">JBMESSAGING-228</a>
+] Re-enable DistributedTopicTest testDistributedTopic_2() and
+testDistributedTopic_4() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-229">JBMESSAGING-229</a>
+] Peristence Optimizations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-246">JBMESSAGING-246</a>
+] Optimise browsing </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-248">JBMESSAGING-248</a>
+] Smart copying for message references </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-250">JBMESSAGING-250</a>
+] Put performance testing framework in it's own subproject </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-255">JBMESSAGING-255</a>
+] Change signature of core interfaces to deal with MessageReferences
+only </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-257">JBMESSAGING-257</a>
+] Optimisation for deliveries immediately returned as done </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-266">JBMESSAGING-266</a>
+] Remove Routable </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-267">JBMESSAGING-267</a>
+] Re-enable distributed tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-268">JBMESSAGING-268</a>
+] Convert destinations to ints in message instance </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-269">JBMESSAGING-269</a>
+] Review ChannelMapper interface for possible functionality separation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-289">JBMESSAGING-289</a>
+] Make service container configurable wrt datasource and persistence
+manager config </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-300">JBMESSAGING-300</a>
+] Deadlock detection </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-307">JBMESSAGING-307</a>
+] Down cache optimisation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-310">JBMESSAGING-310</a>
+] Investigate whether rw lock on ServerConnectionEndpoint is necessary </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-313">JBMESSAGING-313</a>
+] INVM persistent message optimisation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-319">JBMESSAGING-319</a>
+] Enable the Messaging build to use component-info.xml and versioned
+dependencies </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-327">JBMESSAGING-327</a>
+] Improve concurrency for acknowledgement </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-330">JBMESSAGING-330</a>
+] Consider using remoting raw invocations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-332">JBMESSAGING-332</a>
+] Consider how best to factor paging logic out of channel state </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-355">JBMESSAGING-355</a>
+] Remove possibility of delivery race conditions </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-398">JBMESSAGING-398</a>
+] Summarize clustering design discussions and forum threads in a
+Clustering Design document </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-404">JBMESSAGING-404</a>
+] Remove Channel::deliver(Receiver r) method </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-414">JBMESSAGING-414</a>
+] Simplify delivery hierarchy </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-422">JBMESSAGING-422</a>
+] Move channel mapper logic into Queue, Topic, Subscription classes </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-425">JBMESSAGING-425</a>
+] Naming of Pipe and Distributed Pipe </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-437">JBMESSAGING-437</a>
+] Non durable subscription optimization </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-444">JBMESSAGING-444</a>
+] Release 1.2.0.Alpha1 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-445">JBMESSAGING-445</a>
+] Update user documentation with clustering-related details </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-447">JBMESSAGING-447</a>
+] Release 1.2.0 GA after waiting for a week for feedback on the latest
+CR </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-516">JBMESSAGING-516</a>
+] Clustering </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-550">JBMESSAGING-550</a>
+] Add JBoss 4.0.5.CR1 (expanded and installer-generated) to the smoke
+test suite </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-560">JBMESSAGING-560</a>
+] Support all JBossMQ equivalent JMX functionality </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-562">JBMESSAGING-562</a>
+] Adjust the installation script to support a clustered installation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-563">JBMESSAGING-563</a>
+] Update the documentation with a Clustering Intro </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-567">JBMESSAGING-567</a>
+] Bring persistence manager configs up to date </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-568">JBMESSAGING-568</a>
+] Complete the configuration section in the Alpha clustering guide </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-569">JBMESSAGING-569</a>
+] Update clustering design documentation wiki </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-571">JBMESSAGING-571</a>
+] Get unicast to work with clustering </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-573">JBMESSAGING-573</a>
+] Add clustering crash and recovery tests to suite </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-575">JBMESSAGING-575</a>
+] Stabilise the default message pull policy </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-577">JBMESSAGING-577</a>
+] Handle sequence numbers properly for state transfer... </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-578">JBMESSAGING-578</a>
+] Allow messaging to use app server's multiplex JGroups channel </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-579">JBMESSAGING-579</a>
+] Improve shared durable subscription tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-580">JBMESSAGING-580</a>
+] Document configuration and schema changes from 1.0 and publish a
+detailed migration guide </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-581">JBMESSAGING-581</a>
+] ServerManagement needs to be extended to start cluster node instances
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-582">JBMESSAGING-582</a>
+] Modify and test release-admin.xml so it is capable of creating
+clustered configurations using a different database than mysql </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-591">JBMESSAGING-591</a>
+] MessageConsumerTest::testTimeoutReceiveOnClose can randomly fail </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-593">JBMESSAGING-593</a>
+] Analyse current JGroups stack usage </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-594">JBMESSAGING-594</a>
+] Consider having just one post office instance </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-597">JBMESSAGING-597</a>
+] Tracker task for JBSHOTOKU-101 (blogs dont show up in our Labs
+project blog area) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-601">JBMESSAGING-601</a>
+] Place Messaging artifacts in the repository </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-610">JBMESSAGING-610</a>
+] Merge 1.0.1.GA changes (Branch_1_0) into the trunk </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-614">JBMESSAGING-614</a>
+] Remove shutdown logger </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-615">JBMESSAGING-615</a>
+] Add sufficient tracing for a customer environment </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-621">JBMESSAGING-621</a>
+] Modify the smoke test suite to run tests in top of JBoss 4.0.5.GA
+instead of 4.0.5.CR1 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-628">JBMESSAGING-628</a>
+] Investigate message priority in presence of prefetching </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-631">JBMESSAGING-631</a>
+] Update the build script to produce an unscoped SAR </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-632">JBMESSAGING-632</a>
+] Migreate the deployment descriptors and the AS-related artifacts to
+the AS repository </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-649">JBMESSAGING-649</a>
+] Move ClusterRequest and its subclasses to its own package </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-657">JBMESSAGING-657</a>
+] Sort out flow control </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-673">JBMESSAGING-673</a>
+] Extend test suite framework to restart remote servers </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-684">JBMESSAGING-684</a>
+] Validate curisecontrol test results after the test environment is
+configured to use MySQL </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-689">JBMESSAGING-689</a>
+] Add distributed topic smoke test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-690">JBMESSAGING-690</a>
+] Add distributed queue smoke test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-691">JBMESSAGING-691</a>
+] Add failover smoke test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-692">JBMESSAGING-692</a>
+] Modify all smoke tests to run in non-clustered AND clustered version.
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-699">JBMESSAGING-699</a>
+] Ensure remoting implements true asynchronous callbacks </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-701">JBMESSAGING-701</a>
+] Optimisation - Allow onMessage to be executed on the remoting thread </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-706">JBMESSAGING-706</a>
+] Failover mop-up </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-723">JBMESSAGING-723</a>
+] Move Multiplexor to ServiceContainer on the Testsuite </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-727">JBMESSAGING-727</a>
+] ServerPeer.destroyQueue/destroTopic just undeploys, does not destroy </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-731">JBMESSAGING-731</a>
+] Get a new tagged remoting release from the remoting team </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-734">JBMESSAGING-734</a>
+] Create failover tests for failover of XASesions </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-735">JBMESSAGING-735</a>
+] Consider disabling pinging while failover is happening </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-738">JBMESSAGING-738</a>
+] Make sure all functional and stress tests pass </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-739">JBMESSAGING-739</a>
+] Make sure db schema is correct </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-740">JBMESSAGING-740</a>
+] Make sure wireformat is just right </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-743">JBMESSAGING-743</a>
+] Run the whole functional test suite and the stress tests in both
+clustered and non-clustered configurations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-746">JBMESSAGING-746</a>
+] Ensure MDB integration tests exist </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-755">JBMESSAGING-755</a>
+] Bring mdb-failure's README.html up to date </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-756">JBMESSAGING-756</a>
+] Enable mdb-failure smoke test so it will run with the smoke test
+suite </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-758">JBMESSAGING-758</a>
+] Add a client and server shutdown test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-759">JBMESSAGING-759</a>
+] Add new "cluster view update on client" test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-769">JBMESSAGING-769</a>
+] Make ConnectionFactoryUpdateMessage encapsulated in a
+MarshalledMessage object </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-770">JBMESSAGING-770</a>
+] Add tests for ConnectionFactory loadBalanceFactory MBean attribute </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-776">JBMESSAGING-776</a>
+] Specify one way thread pool on the server side too </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-778">JBMESSAGING-778</a>
+] Clear testcases </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-785">JBMESSAGING-785</a>
+] Create long running invocation test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-792">JBMESSAGING-792</a>
+] Modify testing framework to use with priority JGroups stack
+configurations we ship with the release </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-813">JBMESSAGING-813</a>
+] Test failover (and clustering in general) on a QA lab network with
+several physical machines involved </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-822">JBMESSAGING-822</a>
+] Outstanding remoting issues JBREM-690, JBREM-693 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-854">JBMESSAGING-854</a>
+] Integration with JBoss AS 5.0 </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-865">JBMESSAGING-865</a>
+] Modify log4j configuration to mask Remoting's [BisocketServerInvoker]
+got listener: null </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-866">JBMESSAGING-866</a>
+] Revert log4j configuration that masks Remoting's
+[BisocketServerInvoker] got listener: null </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-867">JBMESSAGING-867</a>
+] Validate Sybase Installation script </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-881">JBMESSAGING-881</a>
+] Mention in the release notes and documentation that at least ant
+1.6.3 is required </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-882">JBMESSAGING-882</a>
+] Change mssql-ds.xml to use the sourceforge driver </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-900">JBMESSAGING-900</a>
+] Decide on ClusteredConnectionFactoryTest.testGetAOPBounce() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-902">JBMESSAGING-902</a>
+] Abort the installation script if there are no permissions to create
+temporary files </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-906">JBMESSAGING-906</a>
+] Decide on how to ship DistributeQueueExample (and smoke test):
+disable/null policy/default policy</li>
+</ul>
+<h2 style="margin-left: 40px;">Sub-tasks</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-150">JBMESSAGING-150</a>
+] TCK sould test Messaging, and not JBossMQ, by default </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-235">JBMESSAGING-235</a>
+] Make use of the datasource mappings </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-240">JBMESSAGING-240</a>
+] Review reference counting in the database </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-385">JBMESSAGING-385</a>
+] Generalize jboss testsuite JMS tests to work with both Messaging and
+JBossMQ (where possible) and make sure they pass </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-386">JBMESSAGING-386</a>
+] Isolate JBossMQ-specific tests and make sure they pass </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-456">JBMESSAGING-456</a>
+] Migrate jboss-head/jms subdirectory content to standalone SVN
+repository </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-457">JBMESSAGING-457</a>
+] Modify the build system to use jbossbuild </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-458">JBMESSAGING-458</a>
+] Update JBossMessagingBuildInstructions wiki page </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-460">JBMESSAGING-460</a>
+] Get rid of derelict SVN branches and tags </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-461">JBMESSAGING-461</a>
+] Post on the development forum an announcement that the SVN is
+complete </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-462">JBMESSAGING-462</a>
+] Verify the validity of the artifacts generated by the new build </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-463">JBMESSAGING-463</a>
+] Completely get rid of commented out jboss.aspects.lib references from
+build-messaging.xml </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-464">JBMESSAGING-464</a>
+] log4j output format differs from the CVS version </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-465">JBMESSAGING-465</a>
+] Failed to initalize plugin org.jboss.logging.Log4jLoggerPlugin at 513cf0
+  </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-466">JBMESSAGING-466</a>
+] Take a final decision on whether to use &amp;tools or keep only parts
+of jbossbuild under "tools" </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-468">JBMESSAGING-468</a>
+] Re-activate the perf framework under the new build system </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-469">JBMESSAGING-469</a>
+] Clarify how build-thirdparty.xml's <build> task attributes should be
+used. </build></li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-470">JBMESSAGING-470</a>
+] Modify start-rmi-server and stop-rmi-server to use
+"test.execution.classpath" generated by tests/build.xml </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-471">JBMESSAGING-471</a>
+] Set up a process to update messaging artifacts in repository </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-473">JBMESSAGING-473</a>
+] Remote test reports overwrite local test reports </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-474">JBMESSAGING-474</a>
+] lib/jboss-serialization.jar doesn't override
+thirdparty/jboss/serialization </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-475">JBMESSAGING-475</a>
+] Old build-related tasks </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-482">JBMESSAGING-482</a>
+] stress tests don't work </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-483">JBMESSAGING-483</a>
+] ManifestTest fails </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-517">JBMESSAGING-517</a>
+] Implement intelligent balancer </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-518">JBMESSAGING-518</a>
+] Implement distributed destinations </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-519">JBMESSAGING-519</a>
+] Transparent failover / HA </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-554">JBMESSAGING-554</a>
+] Create an Admin abstraction that would allow running generic JMS
+tests regardless of provider implementation </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-555">JBMESSAGING-555</a>
+] Separate generic JMS tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-556">JBMESSAGING-556</a>
+] Isolate JBossMQ-specific test </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-627">JBMESSAGING-627</a>
+] Create an ant configuration file fragment that would build a
+Messaging configuration for the AS testing, adding things like securiy
+roles, etc. </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-666">JBMESSAGING-666</a>
+] Basic DLQ functionality </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-668">JBMESSAGING-668</a>
+] Basic client-side failover logic </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-669">JBMESSAGING-669</a>
+] Client side valve </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-670">JBMESSAGING-670</a>
+] Redirection of connection if server is not failover server </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-671">JBMESSAGING-671</a>
+] Recreate delivery list on the server when failure occurs </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-672">JBMESSAGING-672</a>
+] Server side valve </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-674">JBMESSAGING-674</a>
+] Propagate changes in server list back to client when server side view
+change occurs </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-675">JBMESSAGING-675</a>
+] Make client side load balancing policy pluggable </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-678">JBMESSAGING-678</a>
+] Merge to trunk </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-707">JBMESSAGING-707</a>
+] Add session-level failover tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-708">JBMESSAGING-708</a>
+] Move SessionState.handleFailoverOnConsumer() consumer failover logic
+to ClientConsumerDelegate/ConsumerState </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-709">JBMESSAGING-709</a>
+] Move SessionState.handleFailoverOnProducer() producer failover logic
+to ClientProducerDelegate/ProducerState </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-710">JBMESSAGING-710</a>
+] Move SessionState.handleFailoverOnBrowser() browser failover logic to
+ClientBrowserDelegate/BrowserState </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-711">JBMESSAGING-711</a>
+] Test to failover a connection that was created using a username and a
+password </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-712">JBMESSAGING-712</a>
+] FailoverTest.testFailoverMessageOnServer2() deadlocks </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-713">JBMESSAGING-713</a>
+] Document better the cases in which failedNodeID of
+ConnectionFactoryEndpoint.createConnectionDelegate(username, password,
+failedNodeID) is disregarded </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-714">JBMESSAGING-714</a>
+] Make sure all dependent instances of the failed connection
+(ConnectionFailureListener included) are propery garbage collected
+after failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-715">JBMESSAGING-715</a>
+] FailoverTest.testFailoverMessageOnServer() fails with "Cannot find
+delivery to acknowledge" after failover </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-719">JBMESSAGING-719</a>
+] Capturing I/O Exceptions from invocation on Valve </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-720">JBMESSAGING-720</a>
+] Clustered ConnectionFactory bound twice on a failover event (and the
+first time is an inconsistent state) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-722">JBMESSAGING-722</a>
+] Bindings containing the new FailedOverQueue need to be properly saved
+in the database (new field needed: failedNodeID) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-729">JBMESSAGING-729</a>
+] Multiple successive failover tests grind to a halt because of
+Remoting ConnectionValidator bug(s) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-730">JBMESSAGING-730</a>
+] Failover valve fails to close in
+FailoverTest.testConsumerFailoverWithConnectionStopped() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-733">JBMESSAGING-733</a>
+] Add test for failure occuring in the middle of high volume traffic
+(tens of threads) </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-766">JBMESSAGING-766</a>
+] Massive functional testsuite failure (108 failures, 99 errors)
+related to the latest remoting changes </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-767">JBMESSAGING-767</a>
+] HTTP tests lock testsuite run </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-775">JBMESSAGING-775</a>
+]
+org.jboss.test.messaging.jms.selector.SelectorTest.testManyQueueWithExpired()
+locks up </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-779">JBMESSAGING-779</a>
+] Fix crash test CallbackFailureTest.testCallbackFailure() </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-780">JBMESSAGING-780</a>
+] Fix thirdparty.remoting HTTP tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-781">JBMESSAGING-781</a>
+] Fix Clustering Tests </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-786">JBMESSAGING-786</a>
+] HTTP remoting client throws different exception on failure </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-796">JBMESSAGING-796</a>
+] Execute and validate the integration testsuite </li>
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-893">JBMESSAGING-893</a>
+] Some request is not completing, causing
+MultiThreadFailoverTest.testMultiThreadFailoverSeveralThreadsTransacted()
+to loop forever </li>
+</ul>
+<h2 style="margin-left: 40px;">Support Patches</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-742">JBMESSAGING-742</a>
+] Update of JBossRemoting to Alpha4 and JBMESSAGING-741 </li>
+</ul>
+<h2 style="margin-left: 40px;">Patches</h2>
+<ul style="margin-left: 40px;">
+  <li> [ <a href="http://jira.jboss.com/jira/browse/JBMESSAGING-625">JBMESSAGING-625</a>
+] ClassCastException String to ManagedDestination </li>
+</ul>
+<div style="margin-left: 40px;"><br>
+<br>
+</div>
+<hr style="width: 100%; height: 2px;">
+</body>
+</html>

Modified: tags/JBossMessaging_1_2_0_SP1/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
===================================================================
--- branches/Branch_1_2_0_SP/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -72,22 +72,31 @@
          
          TextMessage message = session.createTextMessage("Hello!");
          message.setJMSReplyTo(temporaryQueue);            
-         
-         sender.send(message);
+
+
+         for (int i=0;i<5000;i++)
+         {
+            sender.send(message);
+
+            log("Send message " + i);
+         }
                      
          log("The " + message.getText() + " message was successfully sent to the " + queue.getQueueName() + " queue");
    
          connection.start();
-         
-         message = (TextMessage)consumer.receive(5000);
+
+         for (int i=0;i<5000;i++)
+         {   x
+            message = (TextMessage)consumer.receive(5000);
+            if (message == null)
+            {
+               throw new Exception("Have not received any reply. The example failed!");
+            }
+
+            log("Received message: " + message.getText());
+         }
               
-         if (message == null)
-         {
-            throw new Exception("Have not received any reply. The example failed!");
-         }
-               
-         log("Received message: " + message.getText());
-         
+
          assertEquals("!olleH", message.getText());
                      
          displayProviderInfo(connection.getMetaData());

Modified: tags/JBossMessaging_1_2_0_SP1/messaging.iml
===================================================================
--- branches/Branch_1_2_0_SP/messaging.iml	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/messaging.iml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module version="4" relativePaths="true" type="JAVA_MODULE">
   <component name="ModuleRootManager" />
-  <component name="NewModuleRootManager">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
     <output url="file://$MODULE_DIR$/classes" />
     <exclude-output />
     <content url="file://$MODULE_DIR$">

Modified: tags/JBossMessaging_1_2_0_SP1/messaging.ipr
===================================================================
--- branches/Branch_1_2_0_SP/messaging.ipr	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/messaging.ipr	2007-03-28 19:40:59 UTC (rev 2567)
@@ -12,13 +12,19 @@
       <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="CLEAR_OUTPUT_DIRECTORY" value="false" />
     <option name="DEPLOY_AFTER_MAKE" value="0" />
     <resourceExtensions>
       <entry name=".+\.(properties|xml|html|dtd|tld)" />
@@ -41,6 +47,20 @@
     <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>
@@ -50,6 +70,36 @@
     <option name="OUTPUT_DIRECTORY" />
   </component>
   <component name="GUI Designer component loader factory" />
+  <component name="IdProvider" IDEtalkID="0BADF0FFE3B73C83A779C03784C46D3E" />
+  <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" />
@@ -71,6 +121,7 @@
     <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">
@@ -81,119 +132,140 @@
     <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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">
+      <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://C:/work/jboss-messaging-labs/jbossmessaging/jbossmessaging-labs.iml" filepath="C:/work/jboss-messaging-labs/jbossmessaging/jbossmessaging-labs.iml" />
       <module fileurl="file://$PROJECT_DIR$/messaging.iml" filepath="$PROJECT_DIR$/messaging.iml" />
-      <module fileurl="file://C:/work/playground/jms/messaging/mdb/messaging-mdb.iml" filepath="C:/work/playground/jms/messaging/mdb/messaging-mdb.iml" />
-      <module fileurl="file://C:/work/playground/jms/messaging/topic/topic.iml" filepath="C:/work/playground/jms/messaging/topic/topic.iml" />
     </modules>
   </component>
   <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="false" project-jdk-name="1.4" />
+  <component name="ProjectRunConfigurationManager" />
   <component name="RmicSettings">
     <option name="IS_EANABLED" value="false" />
     <option name="DEBUGGING_INFO" value="true" />
@@ -201,6 +273,17 @@
     <option name="GENERATE_IIOP_STUBS" value="false" />
     <option name="ADDITIONAL_OPTIONS_STRING" value="" />
   </component>
+  <component name="StarteamVcsAdapter" />
+  <component name="VssVcs">
+    <SourceSafePersistencyRemovedFolder>$PROJECT_DIR$/tests/src/org/jboss/test/messaging/jms/crash/multiconnection</SourceSafePersistencyRemovedFolder>
+  </component>
+  <component name="com.intellij.jsf.UserDefinedFacesConfigs">
+    <option name="USER_DEFINED_CONFIGS">
+      <value>
+        <list size="0" />
+      </value>
+    </option>
+  </component>
   <component name="libraryTable">
     <library name="jboss-common-core">
       <CLASSES>
@@ -365,6 +448,7 @@
   <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>

Added: tags/JBossMessaging_1_2_0_SP1/messaging.iws
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/messaging.iws	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/messaging.iws	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,966 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4" relativePaths="false">
+  <component name="BookmarkManager" />
+  <component name="ChangeBrowserSettings">
+    <option name="MAIN_SPLITTER_PROPORTION" value="0.3" />
+    <option name="MESSAGES_SPLITTER_PROPORTION" value="0.8" />
+    <option name="USE_DATE_BEFORE_FILTER" value="false" />
+    <option name="USE_DATE_AFTER_FILTER" value="false" />
+    <option name="USE_CHANGE_BEFORE_FILTER" value="false" />
+    <option name="USE_CHANGE_AFTER_FILTER" value="false" />
+    <option name="DATE_BEFORE" value="" />
+    <option name="DATE_AFTER" value="" />
+    <option name="CHANGE_BEFORE" value="" />
+    <option name="CHANGE_AFTER" value="" />
+    <option name="USE_USER_FILTER" value="false" />
+    <option name="USER" value="" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" name="Default" comment="">
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/build-messaging.xml" afterPath="$PROJECT_DIR$/build-messaging.xml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/messaging.iml" afterPath="$PROJECT_DIR$/messaging.iml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/messaging.ipr" afterPath="$PROJECT_DIR$/messaging.ipr" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/util/do-not-distribute.properties" afterPath="$PROJECT_DIR$/util/do-not-distribute.properties" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/messaging.iws" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java" afterPath="$PROJECT_DIR$/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java" />
+    </list>
+  </component>
+  <component name="ChangeListSynchronizer" />
+  <component name="ChangesViewManager" flattened_view="true" />
+  <component name="CheckinPanelState" />
+  <component name="Commander">
+    <leftPanel />
+    <rightPanel />
+    <splitter proportion="0.5" />
+  </component>
+  <component name="CompilerWorkspaceConfiguration">
+    <option name="COMPILE_IN_BACKGROUND" value="false" />
+    <option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
+    <option name="CLOSE_MESSAGE_VIEW_IF_SUCCESS" value="true" />
+    <option name="COMPILE_DEPENDENT_FILES" value="false" />
+    <option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
+    <option name="ASSERT_NOT_NULL" value="true" />
+  </component>
+  <component name="CoverageDataManager" />
+  <component name="Cvs2Configuration">
+    <option name="PRUNE_EMPTY_DIRECTORIES" value="true" />
+    <option name="MERGING_MODE" value="0" />
+    <option name="MERGE_WITH_BRANCH1_NAME" value="HEAD" />
+    <option name="MERGE_WITH_BRANCH2_NAME" value="HEAD" />
+    <option name="RESET_STICKY" value="false" />
+    <option name="CREATE_NEW_DIRECTORIES" value="true" />
+    <option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv" />
+    <option name="PROCESS_UNKNOWN_FILES" value="false" />
+    <option name="PROCESS_DELETED_FILES" value="false" />
+    <option name="PROCESS_IGNORED_FILES" value="false" />
+    <option name="RESERVED_EDIT" value="false" />
+    <option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
+      <value>
+        <option name="BRANCH" value="" />
+        <option name="DATE" value="" />
+        <option name="USE_BRANCH" value="false" />
+        <option name="USE_DATE" value="false" />
+      </value>
+    </option>
+    <option name="UPDATE_DATE_OR_REVISION_SETTINGS">
+      <value>
+        <option name="BRANCH" value="" />
+        <option name="DATE" value="" />
+        <option name="USE_BRANCH" value="false" />
+        <option name="USE_DATE" value="false" />
+      </value>
+    </option>
+    <option name="SHOW_CHANGES_REVISION_SETTINGS">
+      <value>
+        <option name="BRANCH" value="" />
+        <option name="DATE" value="" />
+        <option name="USE_BRANCH" value="false" />
+        <option name="USE_DATE" value="false" />
+      </value>
+    </option>
+    <option name="SHOW_OUTPUT" value="false" />
+    <option name="ADD_WATCH_INDEX" value="0" />
+    <option name="REMOVE_WATCH_INDEX" value="0" />
+    <option name="UPDATE_KEYWORD_SUBSTITUTION" />
+    <option name="MAKE_NEW_FILES_READONLY" value="false" />
+    <option name="SHOW_CORRUPTED_PROJECT_FILES" value="0" />
+    <option name="TAG_AFTER_PROJECT_COMMIT" value="false" />
+    <option name="OVERRIDE_EXISTING_TAG_FOR_PROJECT" value="true" />
+    <option name="TAG_AFTER_PROJECT_COMMIT_NAME" value="" />
+    <option name="CLEAN_COPY" value="false" />
+  </component>
+  <component name="DaemonCodeAnalyzer">
+    <disable_hints />
+  </component>
+  <component name="DebuggerManager">
+    <breakpoint_any>
+      <breakpoint>
+        <option name="NOTIFY_CAUGHT" value="true" />
+        <option name="NOTIFY_UNCAUGHT" value="true" />
+        <option name="ENABLED" value="false" />
+        <option name="SUSPEND_POLICY" value="SuspendAll" />
+        <option name="LOG_ENABLED" value="false" />
+        <option name="LOG_EXPRESSION_ENABLED" value="false" />
+        <option name="COUNT_FILTER_ENABLED" value="false" />
+        <option name="COUNT_FILTER" value="0" />
+        <option name="CONDITION_ENABLED" value="false" />
+        <option name="CLASS_FILTERS_ENABLED" value="false" />
+        <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+        <option name="CONDITION" value="" />
+        <option name="LOG_MESSAGE" value="" />
+      </breakpoint>
+      <breakpoint>
+        <option name="NOTIFY_CAUGHT" value="true" />
+        <option name="NOTIFY_UNCAUGHT" value="true" />
+        <option name="ENABLED" value="false" />
+        <option name="SUSPEND_POLICY" value="SuspendAll" />
+        <option name="LOG_ENABLED" value="false" />
+        <option name="LOG_EXPRESSION_ENABLED" value="false" />
+        <option name="COUNT_FILTER_ENABLED" value="false" />
+        <option name="COUNT_FILTER" value="0" />
+        <option name="CONDITION_ENABLED" value="false" />
+        <option name="CLASS_FILTERS_ENABLED" value="false" />
+        <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+        <option name="CONDITION" value="" />
+        <option name="LOG_MESSAGE" value="" />
+      </breakpoint>
+    </breakpoint_any>
+    <breakpoint_rules />
+    <ui_properties />
+  </component>
+  <component name="ErrorTreeViewConfiguration">
+    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="HIDE_WARNINGS" value="false" />
+  </component>
+  <component name="FavoritesManager">
+    <favorites_list name="messaging" />
+  </component>
+  <component name="FavoritesProjectViewPane">
+    <subPane subId="messaging">
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" />
+          <option name="myItemType" value="com.intellij.ide.favoritesTreeView.FavoritesTreeNodeDescriptor" />
+        </PATH_ELEMENT>
+      </PATH>
+    </subPane>
+  </component>
+  <component name="FileEditorManager">
+    <leaf>
+      <file leaf-file-name="SessionAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/SessionAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="75" column="13" selection-start="3097" selection-end="3097" vertical-scroll-proportion="0.014822135">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="CallbackFailureTest.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="164" column="17" selection-start="6105" selection-end="6105" vertical-scroll-proportion="0.9367589">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="StateCreationAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/StateCreationAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="205" column="34" selection-start="9025" selection-end="9025" vertical-scroll-proportion="0.5958498">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ClientLogInterceptor.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ClientLogInterceptor.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="80" column="30" selection-start="2964" selection-end="2964" vertical-scroll-proportion="0.091897234">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ClusteringAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ClusteringAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="91" column="40" selection-start="3583" selection-end="3583" vertical-scroll-proportion="0.014822135">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ConnectionAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ConnectionAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="208" column="54" selection-start="7470" selection-end="7470" vertical-scroll-proportion="0.26976284">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ConsumerAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ConsumerAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="147" column="50" selection-start="6384" selection-end="6384" vertical-scroll-proportion="0.04743083">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Sender.java" pinned="false" current="true" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="88" column="14" selection-start="3452" selection-end="3452" vertical-scroll-proportion="0.4179842">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="FailoverValveInterceptor.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="126" column="63" selection-start="4950" selection-end="4950" vertical-scroll-proportion="0.15118577">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ProducerAspect.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ProducerAspect.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="263" column="52" selection-start="9328" selection-end="9328" vertical-scroll-proportion="0.014822135">
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="FindManager">
+    <FindUsagesManager>
+      <setting name="OPEN_NEW_TAB" value="false" />
+    </FindUsagesManager>
+  </component>
+  <component name="HierarchyBrowserManager">
+    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="SORT_ALPHABETICALLY" value="false" />
+    <option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
+  </component>
+  <component name="InspectionManager">
+    <option name="AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="SPLITTER_PROPORTION" value="0.5" />
+    <option name="GROUP_BY_SEVERITY" value="false" />
+    <option name="FILTER_RESOLVED_ITEMS" value="true" />
+    <option name="ANALYZE_TEST_SOURCES" value="true" />
+    <option name="SHOW_DIFF_WITH_PREVIOUS_RUN" value="false" />
+    <option name="SCOPE_TYPE" value="1" />
+    <option name="CUSTOM_SCOPE_NAME" value="" />
+    <option name="SHOW_ONLY_DIFF" value="false" />
+    <option name="myCurrentProfileName" value="Default" />
+  </component>
+  <component name="J2EEProjectPane" />
+  <component name="JspContextManager" />
+  <component name="ModuleEditorState">
+    <option name="LAST_EDITED_MODULE_NAME" />
+    <option name="LAST_EDITED_TAB_NAME" />
+  </component>
+  <component name="NamedScopeManager" />
+  <component name="PackagesPane">
+    <subPane>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
+        </PATH_ELEMENT>
+      </PATH>
+    </subPane>
+  </component>
+  <component name="PerforceChangeBrowserSettings">
+    <option name="USE_CLIENT_FILTER" value="true" />
+    <option name="CLIENT" value="" />
+  </component>
+  <component name="PerforceDirect.Settings">
+    <option name="useP4CONFIG" value="true" />
+    <option name="port" value="&lt;perforce_server&gt;:1666" />
+    <option name="client" value="" />
+    <option name="user" value="" />
+    <option name="passwd" value="" />
+    <option name="showCmds" value="false" />
+    <option name="useNativeApi" value="false" />
+    <option name="pathToExec" value="p4" />
+    <option name="useCustomPathToExec" value="false" />
+    <option name="SYNC_FORCE" value="false" />
+    <option name="SYNC_RUN_RESOLVE" value="true" />
+    <option name="REVERT_UNCHANGED_FILES" value="true" />
+    <option name="CHARSET" value="none" />
+    <option name="SHOW_BRANCHES_HISTORY" value="true" />
+    <option name="ENABLED" value="true" />
+    <option name="USE_LOGIN" value="false" />
+    <option name="LOGIN_SILENTLY" value="false" />
+    <option name="INTEGRATE_RUN_RESOLVE" value="true" />
+    <option name="INTEGRATE_REVERT_UNCHANGED" value="true" />
+  </component>
+  <component name="ProjectLevelVcsManager">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkin" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <OptionsSetting value="true" id="Undo Check Out" />
+    <OptionsSetting value="true" id="Compare with SourceSafe Version" />
+    <OptionsSetting value="true" id="Get Latest Version" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectPane">
+    <subPane>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="Libraries" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.LibraryGroupNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="Libraries" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.LibraryGroupNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="jboss-j2ee" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="Libraries" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.LibraryGroupNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="jboss-j2ee" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar!/javax" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="Libraries" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.LibraryGroupNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="jboss-j2ee" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar!/javax" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/lib/jboss-j2ee.jar!/javax/jms" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="messaging" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+      </PATH>
+    </subPane>
+  </component>
+  <component name="ProjectReloadState">
+    <option name="STATE" value="0" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="ProjectPane" proportions="0.5" version="1" splitterProportion="0.5">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <showStructure ProjectPane="false" Scope="false" PackagesPane="false" Favorites="false" />
+      <autoscrollToSource ProjectPane="true" />
+      <autoscrollFromSource ProjectPane="true" />
+      <sortByType />
+    </navigator>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="GoToClass.includeJavaFiles" value="false" />
+    <property name="MemberChooser.copyJavadoc" value="false" />
+    <property name="cvs_file_history_treeWidth0" value="454" />
+    <property name="cvs_file_history_flatWidth2" value="454" />
+    <property name="MemberChooser.sorted" value="false" />
+    <property name="cvs_file_history_treeOrder1" value="1" />
+    <property name="cvs_file_history_flatOrder0" value="0" />
+    <property name="cvs_file_history_treeOrder3" value="3" />
+    <property name="GoToFile.includeJavaFiles" value="false" />
+    <property name="cvs_file_history_flatOrder1" value="1" />
+    <property name="cvs_file_history_flatWidth1" value="453" />
+    <property name="cvs_file_history_treeWidth1" value="453" />
+    <property name="cvs_file_history_treeOrder2" value="2" />
+    <property name="cvs_file_history_treeWidth3" value="453" />
+    <property name="GoToClass.includeLibraries" value="false" />
+    <property name="cvs_file_history_flatOrder2" value="2" />
+    <property name="MemberChooser.showClasses" value="true" />
+    <property name="cvs_file_history_flatWidth0" value="454" />
+    <property name="cvs_file_history_flatWidth3" value="453" />
+    <property name="cvs_file_history_treeWidth2" value="454" />
+    <property name="cvs_file_history_flatOrder3" value="3" />
+    <property name="GoToClass.toSaveIncludeLibraries" value="false" />
+    <property name="cvs_file_history_treeOrder0" value="0" />
+  </component>
+  <component name="ReadonlyStatusHandler">
+    <option name="SHOW_DIALOG" value="true" />
+  </component>
+  <component name="RecentsManager" />
+  <component name="RestoreUpdateTree" />
+  <component name="RunManager">
+    <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="TEST_OBJECT" value="class" />
+      <option name="VM_PARAMETERS" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="ADDITIONAL_CLASS_PATH" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="wholeProject" />
+      </option>
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </configuration>
+    <configuration default="true" type="Applet" factoryName="Applet">
+      <module name="" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="HTML_FILE_NAME" />
+      <option name="HTML_USED" value="false" />
+      <option name="WIDTH" value="400" />
+      <option name="HEIGHT" value="300" />
+      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+      <option name="VM_PARAMETERS" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+    </configuration>
+    <configuration default="true" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
+    </configuration>
+    <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+      <option name="MAIN_CLASS_NAME" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <module name="" />
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </configuration>
+    <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
+      <Host>localhost</Host>
+      <Port>5050</Port>
+    </configuration>
+  </component>
+  <component name="ScopeViewComponent">
+    <subPane subId="Project">
+      <PATH>
+        <PATH_ELEMENT USER_OBJECT="Root">
+          <option name="myItemId" value="" />
+          <option name="myItemType" value="" />
+        </PATH_ELEMENT>
+      </PATH>
+    </subPane>
+  </component>
+  <component name="SelectInManager" />
+  <component name="StarteamConfiguration">
+    <option name="SERVER" value="" />
+    <option name="PORT" value="49201" />
+    <option name="USER" value="" />
+    <option name="PASSWORD" value="" />
+    <option name="PROJECT" value="" />
+    <option name="VIEW" value="" />
+    <option name="ALTERNATIVE_WORKING_PATH" value="" />
+  </component>
+  <component name="StructuralSearchPlugin" />
+  <component name="StructureViewFactory">
+    <option name="AUTOSCROLL_MODE" value="true" />
+    <option name="AUTOSCROLL_FROM_SOURCE" value="false" />
+    <option name="ACTIVE_ACTIONS" value="" />
+  </component>
+  <component name="Struts Assistant">
+    <option name="showInputs" value="true" />
+    <option name="resources">
+      <value>
+        <option name="strutsPath" />
+        <option name="strutsHelp" />
+      </value>
+    </option>
+    <option name="selectedTaglibs" />
+    <option name="selectedTaglibs" />
+    <option name="myStrutsValidationEnabled" value="true" />
+    <option name="myTilesValidationEnabled" value="true" />
+    <option name="myValidatorValidationEnabled" value="true" />
+    <option name="myReportErrorsAsWarnings" value="true" />
+  </component>
+  <component name="SvnChangesBrowserSettings">
+    <option name="USE_AUTHOR_FIELD" value="true" />
+    <option name="AUTHOR" value="" />
+    <option name="LOCATION" value="" />
+    <option name="USE_PROJECT_SETTINGS" value="true" />
+    <option name="USE_ALTERNATE_LOCATION" value="false" />
+  </component>
+  <component name="SvnConfiguration">
+    <option name="USER" value="" />
+    <option name="PASSWORD" value="" />
+    <option name="PROCESS_UNRESOLVED" value="false" />
+    <option name="LAST_MERGED_REVISION" />
+    <option name="UPDATE_RUN_STATUS" value="false" />
+    <option name="UPDATE_RECURSIVELY" value="true" />
+    <option name="MERGE_DRY_RUN" value="false" />
+    <configuration useDefault="false">/home/clebert/.subversion</configuration>
+  </component>
+  <component name="TodoView" selected-index="0">
+    <todo-panel id="selected-file">
+      <are-packages-shown value="false" />
+      <are-modules-shown value="false" />
+      <flatten-packages value="false" />
+      <is-autoscroll-to-source value="true" />
+    </todo-panel>
+    <todo-panel id="all">
+      <are-packages-shown value="true" />
+      <are-modules-shown value="false" />
+      <flatten-packages value="false" />
+      <is-autoscroll-to-source value="true" />
+    </todo-panel>
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="0" y="6" width="1920" height="1188" extended-state="0" />
+    <editor active="false" />
+    <layout>
+      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+      <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="14" />
+      <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32957748" order="7" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3295699" order="0" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.60441583" order="1" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="10" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
+      <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="6" />
+      <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="11" />
+      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="4" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
+      <window_info id="Sequence" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32957748" order="12" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="2" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
+      <window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="5" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="0" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="4" />
+      <window_info id="simpleUML" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="4" />
+      <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="13" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32957748" order="9" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
+      <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
+      <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="3" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="5" />
+    </layout>
+  </component>
+  <component name="VCS.FileViewConfiguration">
+    <option name="SELECTED_STATUSES" value="DEFAULT" />
+    <option name="SELECTED_COLUMNS" value="DEFAULT" />
+    <option name="SHOW_FILTERS" value="true" />
+    <option name="CUSTOMIZE_VIEW" value="true" />
+    <option name="SHOW_FILE_HISTORY_AS_TREE" value="true" />
+  </component>
+  <component name="VcsManagerConfiguration">
+    <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+    <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
+    <option name="PERFORM_UPDATE_IN_BACKGROUND" value="false" />
+    <option name="PERFORM_COMMIT_IN_BACKGROUND" value="false" />
+    <option name="PUT_FOCUS_INTO_COMMENT" value="false" />
+    <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+    <option name="LAST_COMMIT_MESSAGE" value="if using AOP2.0 this gerAruments might be a Object[0]" />
+    <option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
+    <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
+    <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+    <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+    <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+    <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+    <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+    <option name="ERROR_OCCURED" value="false" />
+    <option name="ACTIVE_VCS_NAME" />
+    <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+    <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+    <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+    <MESSAGE value="http://jira.jboss.org/jira/browse/JBMESSAGING-254 &amp; http://jira.jboss.org/jira/browse/JBMESSAGING-922 fixes" />
+    <MESSAGE value="http://jira.jboss.org/jira/browse/JBMESSAGING-924 - fix" />
+    <MESSAGE value="minor change" />
+    <MESSAGE value="http://jira.jboss.org/jira/browse/JBMESSAGING-920 - backporting the fix into SP branch" />
+    <MESSAGE value="http://jira.jboss.org/jira/browse/JBMESSAGING-920 - Upgrade remoting (that will also fix memory leaks)" />
+    <MESSAGE value="Fixing testcase after remoting upgrade" />
+    <MESSAGE value="Adding test that would fail if using AOP2." />
+    <MESSAGE value="http://jira.jboss.org/jira/browse/JBMESSAGING-928" />
+    <MESSAGE value="if using AOP2.0 this gerAruments might be a Object[0]" />
+  </component>
+  <component name="VssConfiguration">
+    <option name="CLIENT_PATH" value="" />
+    <option name="SRCSAFEINI_PATH" value="" />
+    <option name="USER_NAME" value="" />
+    <option name="PWD" value="" />
+    <option name="VSS_IS_INITIALIZED" value="true" />
+    <CheckoutOptions>
+      <option name="COMMENT" value="" />
+      <option name="DO_NOT_GET_LATEST_VERSION" value="false" />
+      <option name="REPLACE_WRITABLE" value="false" />
+      <option name="RECURSIVE" value="false" />
+    </CheckoutOptions>
+    <CheckinOptions>
+      <option name="COMMENT" value="" />
+      <option name="KEEP_CHECKED_OUT" value="false" />
+      <option name="RECURSIVE" value="false" />
+    </CheckinOptions>
+    <AddOptions>
+      <option name="COMMENT" value="" />
+      <option name="STORE_ONLY_LATEST_VERSION" value="false" />
+      <option name="CHECK_OUT_IMMEDIATELY" value="false" />
+      <option name="FILE_TYPE" value="0" />
+    </AddOptions>
+    <UndocheckoutOptions>
+      <option name="MAKE_WRITABLE" value="false" />
+      <option name="REPLACE_LOCAL_COPY" value="0" />
+      <option name="RECURSIVE" value="false" />
+    </UndocheckoutOptions>
+    <GetOptions>
+      <option name="REPLACE_WRITABLE" value="0" />
+      <option name="MAKE_WRITABLE" value="false" />
+      <option name="ANSWER_POSITIVELY" value="false" />
+      <option name="RECURSIVE" value="false" />
+    </GetOptions>
+  </component>
+  <component name="antWorkspaceConfiguration">
+    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="FILTER_TARGETS" value="false" />
+    <buildFile url="file://$PROJECT_DIR$/tests/build.xml">
+      <antCommandLine value="" />
+      <runInBackground value="false" />
+      <targetFilters>
+        <filter targetName="http-tests" isVisible="false" />
+        <filter targetName="javadoc" isVisible="false" />
+        <filter targetName="invm-stress-tests" isVisible="true" />
+        <filter targetName="release-bundle" isVisible="false" />
+        <filter targetName="resolve-local-dependencies" isVisible="false" />
+        <filter targetName="release-structure" isVisible="false" />
+        <filter targetName="use-repository-serialization" isVisible="false" />
+        <filter targetName="archive-functional" isVisible="false" />
+        <filter targetName="messagereport" isVisible="false" />
+        <filter targetName="compile-classes" isVisible="false" />
+        <filter targetName="crash-test" isVisible="true" />
+        <filter targetName="remote-tests" isVisible="true" />
+        <filter targetName="crash-tests" isVisible="true" />
+        <filter targetName="tests" isVisible="false" />
+        <filter targetName="memory-leak-tests" isVisible="true" />
+        <filter targetName="jmsreport" isVisible="false" />
+        <filter targetName="get-test-execution-classpath" isVisible="false" />
+        <filter targetName="messagetests" isVisible="true" />
+        <filter targetName="examples" isVisible="false" />
+        <filter targetName="tests-ejb-jar" isVisible="true" />
+        <filter targetName="compile-parsers" isVisible="false" />
+        <filter targetName="test" isVisible="true" />
+        <filter targetName="copy-stylesheets" isVisible="false" />
+        <filter targetName="jar-structure" isVisible="false" />
+        <filter targetName="report" isVisible="false" />
+        <filter targetName="start-rmi-server" isVisible="true" />
+        <filter targetName="bundle-test-results" isVisible="false" />
+        <filter targetName="scoped-sar" isVisible="false" />
+        <filter targetName="tests-jar" isVisible="false" />
+        <filter targetName="deployscoped" isVisible="false" />
+        <filter targetName="local-jms-tests" isVisible="true" />
+        <filter targetName="prepare-testdirs" isVisible="false" />
+        <filter targetName="clean" isVisible="false" />
+        <filter targetName="cts-undeploy" isVisible="false" />
+        <filter targetName="deployejb" isVisible="false" />
+        <filter targetName="scoped-sar-structure" isVisible="false" />
+        <filter targetName="stressreport" isVisible="false" />
+        <filter targetName="deploydefault" isVisible="false" />
+        <filter targetName="artifacts" isVisible="false" />
+        <filter targetName="start-rmi-server-stress" isVisible="true" />
+        <filter targetName="init" isVisible="false" />
+        <filter targetName="stop-rmi-server" isVisible="true" />
+        <filter targetName="extract-server-dependencies" isVisible="false" />
+        <filter targetName="undeployejb" isVisible="false" />
+        <filter targetName="ref-test" isVisible="true" />
+        <filter targetName="client-jar" isVisible="false" />
+        <filter targetName="jmstests" isVisible="true" />
+        <filter targetName="compile" isVisible="false" />
+        <filter targetName="detect-availability" isVisible="false" />
+        <filter targetName="source-bundle" isVisible="false" />
+        <filter targetName="remote-stress-tests" isVisible="true" />
+        <filter targetName="invm-tests" isVisible="true" />
+        <filter targetName="compile-etc" isVisible="false" />
+        <filter targetName="undeploydefault" isVisible="false" />
+        <filter targetName="use-local-remoting" isVisible="false" />
+        <filter targetName="jar" isVisible="false" />
+        <filter targetName="cts-deploy" isVisible="false" />
+        <filter targetName="start-rmi-server-clustering" isVisible="true" />
+        <filter targetName="compile-report" isVisible="false" />
+        <filter targetName="clustering-tests" isVisible="true" />
+        <filter targetName="clear-test-logs" isVisible="false" />
+        <filter targetName="remote-tests-report" isVisible="false" />
+        <filter targetName="use-repository-remoting" isVisible="false" />
+        <filter targetName="functional-tests" isVisible="false" />
+        <filter targetName="stress-tests" isVisible="false" />
+        <filter targetName="corereport" isVisible="false" />
+        <filter targetName="userdoc" isVisible="false" />
+        <filter targetName="use-local-serialization" isVisible="false" />
+        <filter targetName="coretests" isVisible="true" />
+        <filter targetName="archive-stress" isVisible="false" />
+        <filter targetName="stop-rmi-server-clustering" isVisible="true" />
+        <filter targetName="bundle-source" isVisible="false" />
+        <filter targetName="archive-smoke" isVisible="false" />
+      </targetFilters>
+      <treeView value="true" />
+      <verbose value="true" />
+      <viewClosedWhenNoErrors value="false" />
+    </buildFile>
+  </component>
+  <component name="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" proportions="" version="1">
+    <option name="myLastEditedConfigurable" />
+  </component>
+  <component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="" version="1">
+    <option name="myPlainMode" value="false" />
+    <option name="myLastEditedConfigurable" />
+  </component>
+  <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
+    <option name="myLastEditedConfigurable" />
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/tests/tmp-build.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="2" column="0" selection-start="40" selection-end="40" vertical-scroll-proportion="0.029126214">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/tests/build.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="917" column="115" selection-start="44320" selection-end="44320" vertical-scroll-proportion="0.33300972">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="323" column="76" selection-start="11690" selection-end="11690" vertical-scroll-proportion="0.73399013">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/remoting/CallbackManager.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="82" column="0" selection-start="3414" selection-end="3414" vertical-scroll-proportion="0.21359223">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/BrowserAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="110" column="74" selection-start="3423" selection-end="3423" vertical-scroll-proportion="0.9367589">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/SessionAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="75" column="13" selection-start="3097" selection-end="3097" vertical-scroll-proportion="0.014822135">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="164" column="17" selection-start="6105" selection-end="6105" vertical-scroll-proportion="0.9367589">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/StateCreationAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="205" column="34" selection-start="9025" selection-end="9025" vertical-scroll-proportion="0.5958498">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ClientLogInterceptor.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="80" column="30" selection-start="2964" selection-end="2964" vertical-scroll-proportion="0.091897234">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ClusteringAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="91" column="40" selection-start="3583" selection-end="3583" vertical-scroll-proportion="0.014822135">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ConnectionAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="208" column="54" selection-start="7470" selection-end="7470" vertical-scroll-proportion="0.26976284">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ConsumerAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="147" column="50" selection-start="6384" selection-end="6384" vertical-scroll-proportion="0.04743083">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="126" column="63" selection-start="4950" selection-end="4950" vertical-scroll-proportion="0.15118577">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/org/jboss/jms/client/container/ProducerAspect.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="263" column="52" selection-start="9328" selection-end="9328" vertical-scroll-proportion="0.014822135">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/docs/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="88" column="14" selection-start="3452" selection-end="3452" vertical-scroll-proportion="0.4179842">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+  </component>
+  <component name="simpleUML.DiagramSettingsWorkspace" />
+  <component name="simpleUML.UMLToolWindowPlugin">
+    <General>
+      <option name="birdViewUpdateDelay" value="2000" />
+      <option name="defaultFileLocation" value="file://$APPLICATION_HOME_DIR$/bin" />
+    </General>
+    <Classdiagram>
+      <option name="diagramTitleFont" value="SansSerif,1,12" />
+      <option name="diagramFont" value="SansSerif,0,10" />
+      <option name="defaultFieldsExpanded" value="false" />
+      <option name="defaultContructorsExpanded" value="false" />
+      <option name="defaultMethodsExpanded" value="false" />
+      <option name="showParameters" value="true" />
+      <option name="showTooltip" value="true" />
+      <option name="showReturnValues" value="true" />
+      <option name="longModifier" value="true" />
+      <option name="implementsBehaviour" value="1" />
+      <option name="extendsBehaviour" value="1" />
+      <option name="compartmentBehaviour" value="1" />
+      <option name="interfaceBackgroundColor" value="-6494306" />
+      <option name="abstractClassBackgroundColor" value="-1580132" />
+      <option name="classBackgroundColor" value="-6508057" />
+      <option name="diagramBackgroundColor" value="-1" />
+      <option name="useAntialiasedConnectors" value="true" />
+      <option name="quickSourceLinkColor" value="-16776961" />
+      <option name="quickDiagramLinkColor" value="-8454144" />
+      <option name="drawDecorations" value="false" />
+      <option name="hideFieldList" value="" />
+      <option name="showFieldList" value="" />
+      <option name="hideConstructorList" value="" />
+      <option name="showConstructorList" value="" />
+      <option name="hideMethodList" value="" />
+      <option name="showMethodList" value="" />
+      <option name="minimumFigureSize" value="0,0" />
+    </Classdiagram>
+    <Dependencydiagram>
+      <option name="diagramTitleFont" value="SansSerif,1,12" />
+      <option name="diagramFont" value="SansSerif,0,10" />
+      <option name="diagramBackgroundColor" value="-1" />
+      <option name="useAntialiasedConnectors" value="true" />
+      <option name="packageNameCompressionLevel" value="0" />
+    </Dependencydiagram>
+    <Packagediagram>
+      <option name="diagramTitleFont" value="SansSerif,0,12" />
+      <option name="diagramFont" value="SansSerif,0,10" />
+      <option name="packageBackgroundColor" value="-4144960" />
+      <option name="diagramBackgroundColor" value="-1" />
+      <option name="useAntialiasedConnectors" value="true" />
+      <option name="packageNameCompressionLevel" value="2" />
+    </Packagediagram>
+  </component>
+</project>
+

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnection.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,327 +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;
-
-import java.io.Serializable;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionConsumer;
-import javax.jms.ConnectionMetaData;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-import javax.jms.XAConnection;
-import javax.jms.XAQueueConnection;
-import javax.jms.XAQueueSession;
-import javax.jms.XASession;
-import javax.jms.XATopicConnection;
-import javax.jms.XATopicSession;
-
-import org.jboss.jms.client.delegate.ClientConnectionDelegate;
-import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.delegate.ConnectionDelegate;
-import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-
-/**
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JBossConnection implements
-    Connection, QueueConnection, TopicConnection,
-    XAConnection, XAQueueConnection, XATopicConnection, Serializable
-{
-
-   // Constants ------------------------------------------------------------------------------------
-   private static final long serialVersionUID = -3715868654823177898L;
-   
-   static final int TYPE_GENERIC_CONNECTION = 0;
-   static final int TYPE_QUEUE_CONNECTION = 1;
-   static final int TYPE_TOPIC_CONNECTION = 2;
-
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   protected ConnectionDelegate delegate;
-   private int connectionType;
-
-   // Constructors ---------------------------------------------------------------------------------
-
-   public JBossConnection(ConnectionDelegate delegate, int connectionType)
-   {
-      this.delegate = delegate;
-      this.connectionType = connectionType;
-   }
-
-   // Connection implementation --------------------------------------------------------------------
-
-   public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
-   {
-      return createSessionInternal(transacted, acknowledgeMode, false, TYPE_GENERIC_CONNECTION);
-   }
-
-   public String getClientID() throws JMSException
-   {
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         return delegate.getClientID();
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public void setClientID(String clientID) throws JMSException
-   {
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         delegate.setClientID(clientID);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public ConnectionMetaData getMetaData() throws JMSException
-   {
-      return delegate.getConnectionMetaData();
-   }
-
-   public ExceptionListener getExceptionListener() throws JMSException
-   {
-      return delegate.getExceptionListener();
-   }
-
-   public void setExceptionListener(ExceptionListener listener) throws JMSException
-   {
-      delegate.setExceptionListener(listener);
-   }
-
-   public void start() throws JMSException
-   {
-      delegate.start();
-   }
-
-   public void stop() throws JMSException
-   {
-      delegate.stop();
-   }
-
-   public void close() throws JMSException
-   {
-      delegate.closing();
-      delegate.close();
-   }
-
-   public ConnectionConsumer createConnectionConsumer(Destination destination,
-                                                      String messageSelector,
-                                                      ServerSessionPool sessionPool,
-                                                      int maxMessages) throws JMSException
-   {
-      return delegate.
-         createConnectionConsumer(destination, null, messageSelector, sessionPool, maxMessages);
-   }
-
-   public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
-                                                             String subscriptionName,
-                                                             String messageSelector,
-                                                             ServerSessionPool sessionPool,
-                                                             int maxMessages) throws JMSException
-   {
-      // As spec. section 4.11
-      if (connectionType == TYPE_QUEUE_CONNECTION)
-      {
-         String msg = "Cannot create a durable connection consumer on a QueueConnection";
-         throw new IllegalStateException(msg);
-      }
-      return delegate.createConnectionConsumer(topic, subscriptionName, messageSelector,
-                                               sessionPool, maxMessages);
-   }
-
-   // QueueConnection implementation ---------------------------------------------------------------
-
-   public QueueSession createQueueSession(boolean transacted,
-                                          int acknowledgeMode) throws JMSException
-   {
-       return createSessionInternal(transacted, acknowledgeMode, false,
-                                    JBossSession.TYPE_QUEUE_SESSION);
-   }
-
-   public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector,
-                                                      ServerSessionPool sessionPool,
-                                                      int maxMessages) throws JMSException
-    {
-      return delegate.
-         createConnectionConsumer(queue, null, messageSelector, sessionPool, maxMessages);
-    }
-
-   // TopicConnection implementation ---------------------------------------------------------------
-
-   public TopicSession createTopicSession(boolean transacted,
-                                          int acknowledgeMode) throws JMSException
-   {
-      return createSessionInternal(transacted, acknowledgeMode, false,
-                                   JBossSession.TYPE_TOPIC_SESSION);
-   }
-
-   public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector,
-                                                      ServerSessionPool sessionPool,
-                                                      int maxMessages) throws JMSException
-   {
-      return delegate.
-         createConnectionConsumer(topic, null, messageSelector, sessionPool, maxMessages);
-   }
-
-   // XAConnection implementation ------------------------------------------------------------------
-
-   public XASession createXASession() throws JMSException
-   {
-       return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
-                                    JBossSession.TYPE_GENERIC_SESSION);
-   }
-
-   // XAQueueConnection implementation -------------------------------------------------------------
-
-   public XAQueueSession createXAQueueSession() throws JMSException
-   {
-      return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
-                                   JBossSession.TYPE_QUEUE_SESSION);
-
-   }
-
-   // XATopicConnection implementation -------------------------------------------------------------
-
-   public XATopicSession createXATopicSession() throws JMSException
-   {
-      return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
-                                   JBossSession.TYPE_TOPIC_SESSION);
-
-   }
-
-   // Public ---------------------------------------------------------------------------------------
-
-   public String getRemotingClientSessionID()
-   {
-      ConnectionState state = (ConnectionState)((ClientConnectionDelegate)delegate).getState();
-      
-      return state.getRemotingConnection().getRemotingClient().getSessionId();
-   }
-
-   public ConnectionDelegate getDelegate()
-   {
-      return delegate;
-   }
-
-   /**
-    * Convenience method.
-    */
-   public int getServerID()
-   {
-      return ((ConnectionState)((DelegateSupport)delegate).getState()).getServerID();
-   }
-
-   public void registerFailoverListener(FailoverListener listener)
-   {
-      delegate.registerFailoverListener(listener);
-   }
-
-   public synchronized boolean unregisterFailoverListener(FailoverListener listener)
-   {
-      return delegate.unregisterFailoverListener(listener);
-   }
-
-   public String toString()
-   {
-      return "JBossConnection->" + delegate;
-   }
-
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
-   protected JBossSession createSessionInternal(boolean transacted, int acknowledgeMode,
-                                                boolean isXA, int type) throws JMSException
-   {
-      if (transacted)
-      {
-         acknowledgeMode = Session.SESSION_TRANSACTED;
-      }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         SessionDelegate sessionDelegate =
-            delegate.createSessionDelegate(transacted, acknowledgeMode, isXA);
-         return new JBossSession(sessionDelegate, type);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   // Temporarily commented out as it seems to produce random test failures
-   // See http://jira.jboss.org/jira/browse/JBMESSAGING-548
-   
-//   protected void finalize() throws Throwable
-//   {
-//      super.finalize();
-//
-//      // If a user hasn't explicitly closed the connection due to sloppy programming then
-//      // we close it here
-//
-//      if (!delegate.isClosed())
-//      {
-//         close();
-//      }
-//   }
-
-   // Private --------------------------------------------------------------------------------------
-
-   // Inner classes --------------------------------------------------------------------------------
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnection.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnection.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,293 @@
+/*
+  * 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;
+
+import java.io.Serializable;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionConsumer;
+import javax.jms.ConnectionMetaData;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
+import javax.jms.XAConnection;
+import javax.jms.XAQueueConnection;
+import javax.jms.XAQueueSession;
+import javax.jms.XASession;
+import javax.jms.XATopicConnection;
+import javax.jms.XATopicSession;
+
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.state.ConnectionState;
+import org.jboss.jms.delegate.ConnectionDelegate;
+import org.jboss.jms.delegate.SessionDelegate;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JBossConnection implements
+    Connection, QueueConnection, TopicConnection,
+    XAConnection, XAQueueConnection, XATopicConnection, Serializable
+{
+
+   // Constants ------------------------------------------------------------------------------------
+   private static final long serialVersionUID = -3715868654823177898L;
+   
+   static final int TYPE_GENERIC_CONNECTION = 0;
+   static final int TYPE_QUEUE_CONNECTION = 1;
+   static final int TYPE_TOPIC_CONNECTION = 2;
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   protected ConnectionDelegate delegate;
+   private int connectionType;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public JBossConnection(ConnectionDelegate delegate, int connectionType)
+   {
+      this.delegate = delegate;
+      this.connectionType = connectionType;
+   }
+
+   // Connection implementation --------------------------------------------------------------------
+
+   public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
+   {
+      return createSessionInternal(transacted, acknowledgeMode, false, TYPE_GENERIC_CONNECTION);
+   }
+
+   public String getClientID() throws JMSException
+   {
+      return delegate.getClientID();
+   }
+
+   public void setClientID(String clientID) throws JMSException
+   {
+      delegate.setClientID(clientID);
+   }
+
+   public ConnectionMetaData getMetaData() throws JMSException
+   {
+      return delegate.getConnectionMetaData();
+   }
+
+   public ExceptionListener getExceptionListener() throws JMSException
+   {
+      return delegate.getExceptionListener();
+   }
+
+   public void setExceptionListener(ExceptionListener listener) throws JMSException
+   {
+      delegate.setExceptionListener(listener);
+   }
+
+   public void start() throws JMSException
+   {
+      delegate.start();
+   }
+
+   public void stop() throws JMSException
+   {
+      delegate.stop();
+   }
+
+   public void close() throws JMSException
+   {
+      delegate.closing();
+      delegate.close();
+   }
+
+   public ConnectionConsumer createConnectionConsumer(Destination destination,
+                                                      String messageSelector,
+                                                      ServerSessionPool sessionPool,
+                                                      int maxMessages) throws JMSException
+   {
+      return delegate.
+         createConnectionConsumer(destination, null, messageSelector, sessionPool, maxMessages);
+   }
+
+   public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
+                                                             String subscriptionName,
+                                                             String messageSelector,
+                                                             ServerSessionPool sessionPool,
+                                                             int maxMessages) throws JMSException
+   {
+      // As spec. section 4.11
+      if (connectionType == TYPE_QUEUE_CONNECTION)
+      {
+         String msg = "Cannot create a durable connection consumer on a QueueConnection";
+         throw new IllegalStateException(msg);
+      }
+      return delegate.createConnectionConsumer(topic, subscriptionName, messageSelector,
+                                               sessionPool, maxMessages);
+   }
+
+   // QueueConnection implementation ---------------------------------------------------------------
+
+   public QueueSession createQueueSession(boolean transacted,
+                                          int acknowledgeMode) throws JMSException
+   {
+       return createSessionInternal(transacted, acknowledgeMode, false,
+                                    JBossSession.TYPE_QUEUE_SESSION);
+   }
+
+   public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector,
+                                                      ServerSessionPool sessionPool,
+                                                      int maxMessages) throws JMSException
+    {
+      return delegate.
+         createConnectionConsumer(queue, null, messageSelector, sessionPool, maxMessages);
+    }
+
+   // TopicConnection implementation ---------------------------------------------------------------
+
+   public TopicSession createTopicSession(boolean transacted,
+                                          int acknowledgeMode) throws JMSException
+   {
+      return createSessionInternal(transacted, acknowledgeMode, false,
+                                   JBossSession.TYPE_TOPIC_SESSION);
+   }
+
+   public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector,
+                                                      ServerSessionPool sessionPool,
+                                                      int maxMessages) throws JMSException
+   {
+      return delegate.
+         createConnectionConsumer(topic, null, messageSelector, sessionPool, maxMessages);
+   }
+
+   // XAConnection implementation ------------------------------------------------------------------
+
+   public XASession createXASession() throws JMSException
+   {
+       return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
+                                    JBossSession.TYPE_GENERIC_SESSION);
+   }
+
+   // XAQueueConnection implementation -------------------------------------------------------------
+
+   public XAQueueSession createXAQueueSession() throws JMSException
+   {
+      return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
+                                   JBossSession.TYPE_QUEUE_SESSION);
+
+   }
+
+   // XATopicConnection implementation -------------------------------------------------------------
+
+   public XATopicSession createXATopicSession() throws JMSException
+   {
+      return createSessionInternal(true, Session.SESSION_TRANSACTED, true,
+                                   JBossSession.TYPE_TOPIC_SESSION);
+
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public String getRemotingClientSessionID()
+   {
+      ConnectionState state = (ConnectionState)((ClientConnectionDelegate)delegate).getState();
+      
+      return state.getRemotingConnection().getRemotingClient().getSessionId();
+   }
+
+   public ConnectionDelegate getDelegate()
+   {
+      return delegate;
+   }
+
+   /**
+    * Convenience method.
+    */
+   public int getServerID()
+   {
+      return ((ConnectionState)((DelegateSupport)delegate).getState()).getServerID();
+   }
+
+   public void registerFailoverListener(FailoverListener listener)
+   {
+      delegate.registerFailoverListener(listener);
+   }
+
+   public synchronized boolean unregisterFailoverListener(FailoverListener listener)
+   {
+      return delegate.unregisterFailoverListener(listener);
+   }
+
+   public String toString()
+   {
+      return "JBossConnection->" + delegate;
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected JBossSession createSessionInternal(boolean transacted, int acknowledgeMode,
+                                                boolean isXA, int type) throws JMSException
+   {
+      if (transacted)
+      {
+         acknowledgeMode = Session.SESSION_TRANSACTED;
+      }
+
+      SessionDelegate sessionDelegate =
+         delegate.createSessionDelegate(transacted, acknowledgeMode, isXA);
+      return new JBossSession(sessionDelegate, type);
+   }
+
+   // Temporarily commented out as it seems to produce random test failures
+   // See http://jira.jboss.org/jira/browse/JBMESSAGING-548
+   
+//   protected void finalize() throws Throwable
+//   {
+//      super.finalize();
+//
+//      // If a user hasn't explicitly closed the connection due to sloppy programming then
+//      // we close it here
+//
+//      if (!delegate.isClosed())
+//      {
+//         close();
+//      }
+//   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,364 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-
-import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.state.ConsumerState;
-import org.jboss.jms.delegate.ConnectionDelegate;
-import org.jboss.jms.delegate.ConsumerDelegate;
-import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.message.MessageProxy;
-import org.jboss.jms.util.MessageQueueNameHelper;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-import org.jboss.logging.Logger;
-
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
-
-/**
- * This class implements javax.jms.ConnectionConsumer
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * 
- * Partially based on JBossMQ version by:
- * 
- * @author Hiram Chirino (Cojonudo14 at hotmail.com)
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- * 
- * @version $Revision$
- *
- * $Id$
- */
-public class JBossConnectionConsumer implements ConnectionConsumer, Runnable
-{
-   // Constants -----------------------------------------------------
-
-   private static Logger log = Logger.getLogger(JBossConnectionConsumer.class);
-
-   private static boolean trace = log.isTraceEnabled();
-   
-   private static final int TIMEOUT = 20000;
-   
-   // Attributes ----------------------------------------------------
-   
-   private ConsumerDelegate cons;
-   
-   private SessionDelegate sess;
-   
-   private int consumerID;
-   
-   /** The ServerSessionPool that is implemented by the AS */
-   private ServerSessionPool serverSessionPool;
-   
-   /** The maximum number of messages that a single session will be loaded with. */
-   private int maxMessages;
-   
-   /** Is the ConnectionConsumer closed? */
-   private volatile boolean closed;
-     
-   /** The "listening" thread that gets messages from destination and queues
-   them for delivery to sessions */
-   private Thread internalThread;
-   
-   /** The thread id */
-   private int id;
-   
-   /** The thread id generator */
-   private static SynchronizedInt threadId = new SynchronizedInt(0);
-   
-   private int maxDeliveries;
-   
-   private String queueName;
-   
-   // Static --------------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-
-   public JBossConnectionConsumer(ConnectionDelegate conn, JBossDestination dest,
-                                  String subName, String messageSelector,
-                                  ServerSessionPool sessPool, int maxMessages) throws JMSException
-   {
-      this.serverSessionPool = sessPool;
-      this.maxMessages = maxMessages;
-
-      if (this.maxMessages < 1)
-      {
-         this.maxMessages = 1;
-      }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         // Create a consumer. The MessageCallbackhandler knows we are a connection consumer so will
-         // not call pre or postDeliver so messages won't be acked, or stored in session/tx.
-         sess = conn.createSessionDelegate(false, Session.CLIENT_ACKNOWLEDGE, false);
-
-         cons = sess.createConsumerDelegate(dest, messageSelector, false, subName, true);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-
-      ConsumerState state = (ConsumerState)((DelegateSupport)cons).getState();
-
-      this.consumerID = state.getConsumerID();      
-        
-      this.maxDeliveries = state.getMaxDeliveries();
-      
-      if (subName != null)
-      {
-         queueName = MessageQueueNameHelper.createSubscriptionName(conn.getClientID(), subName);
-      }
-      else
-      {
-         queueName = dest.getName();
-      }
-
-      id = threadId.increment();
-      internalThread = new Thread(this, "Connection Consumer for dest " + dest + " id=" + id);
-      internalThread.start();
-
-      if (trace) { log.trace(this + " created"); }
-   }
-   
-   // ConnectionConsumer implementation -----------------------------
-
-   public ServerSessionPool getServerSessionPool() throws JMSException
-   {
-      return serverSessionPool;
-   }
-
-   public void close() throws JMSException
-   {
-      if (trace) { log.trace("close " + this); }
-      
-      doClose();
-      
-      //Wait for internal thread to complete
-      if (trace) { log.trace(this + " Waiting for internal thread to complete"); }
-      
-      try
-      {
-         internalThread.join(TIMEOUT);
-         
-         if (internalThread.isAlive())
-         {            
-            throw new JMSException(this + " Waited " + TIMEOUT + " ms for internal thread to complete, but it didn't");
-         }
-      }
-      catch (InterruptedException e)
-      {
-         if (trace) { log.trace(this + " Thread interrupted while waiting for internal thread to complete"); }
-         //Ignore
-      }
-      
-      if (trace) { log.trace("Closed: " + this); }      
-   }
-   
-   // Runnable implementation ---------------------------------------
-    
-   public void run()
-   {
-      if (trace) { log.trace("running connection consumer"); }
-      try
-      {
-         List mesList = new ArrayList();
-         
-         outer: while (true)
-         {            
-            if (closed)
-            {
-               if (trace) { log.trace("Connection consumer is closed, breaking"); }
-               break;
-            }
-            
-            if (mesList.isEmpty())
-            {
-               // Remove up to maxMessages messages from the consumer
-               inner: for (int i = 0; i < maxMessages; i++)
-               {               
-                  // receiveNoWait
-
-                  if (trace) { log.trace(this + " attempting to get message with receiveNoWait"); }
-                  
-                  Message m = null;
-                  
-                  try
-                  {
-                     m = cons.receive(-1);
-                  }
-                  catch (JMSException e)
-                  {
-                     //If the consumer is closed, we will get a JMSException so we ignore
-                     if (!closed)
-                     {
-                        throw e;
-                     }                        
-                  }
-               
-                  if (m == null)
-                  {
-                     if (trace) { log.trace("receiveNoWait did not retrieve any message"); }
-                     break;
-                  }
-
-                  if (trace) { log.trace("receiveNoWait got message " + m + " adding to queue"); }
-                  mesList.add(m);
-               }
-
-               if (mesList.isEmpty())
-               {
-                  // We didn't get any messages doing receiveNoWait, so let's wait. This returns if
-                  // a message is received or by the consumer closing.
-
-                  if (trace) { log.trace(this + " attempting to get message with blocking receive (no timeout)"); }
-
-                  Message m = null;
-                  
-                  try
-                  {
-                     m = cons.receive(0);                  
-                  }
-                  catch (JMSException e)
-                  {
-                     //If the consumer is closed, we will get a JMSException so we ignore
-                     if (!closed)
-                     {
-                        throw e;
-                     }                        
-                  }          
-                  
-                  if (m != null)
-                  {
-                     if (trace) { log.trace("receive (no timeout) got message " + m + " adding to queue"); }
-                     mesList.add(m);
-                  }
-                  else
-                  {
-                     // The consumer must have closed
-                     if (trace) { log.trace("blocking receive returned null, consumer must have closed"); }
-                     break;
-                  }
-               }
-            }
-            
-            if (!mesList.isEmpty())
-            {
-               if (trace) { log.trace("there are " + mesList.size() + " messages to send to session"); }
-
-               ServerSession serverSession = serverSessionPool.getServerSession();
-               JBossSession session = (JBossSession)serverSession.getSession();
-
-               MessageListener listener = session.getMessageListener();
-
-               if (listener == null)
-               {
-                  // Sanity check
-                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
-               }
-
-               for (int i = 0; i < mesList.size(); i++)
-               {
-                  MessageProxy m = (MessageProxy)mesList.get(i);
-                  session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess);
-                  if (trace) { log.trace("added " + m + " to session"); }
-               }
-
-               if (trace) { log.trace(this + " starting serverSession " + serverSession); }
-
-               serverSession.start();
-
-               if (trace) { log.trace(this + "'s serverSession processed messages"); }
-
-               mesList.clear();
-            }            
-         }
-         if (trace) { log.trace("ConnectionConsumer run() exiting"); }
-      }
-      catch (Throwable t)
-      {
-         log.warn("Connection consumer closing due to error in listening thread " + this, t);
-         
-         try
-         {
-            //Closing
-            doClose();
-         }
-         catch (JMSException e)
-         {
-            log.error("Failed to close connection consumer", e);
-         }
-      }            
-   }
-   
-   protected synchronized void doClose() throws JMSException
-   {
-      if (closed)
-      {
-         return;
-      }
-      
-      closed = true;            
-      
-      //Calling session.closing() will cause the consumer to close which
-      //will make any receive() calls return null
-      //and not return until the consumer close protocol is complete
-      sess.closing();
-      sess.close();           
-      
-      if (trace) { log.trace(this + "Closed message handler"); }
-   }
-
-   // Public --------------------------------------------------------
-
-   public String toString()
-   {
-      return "JBossConnectionConsumer[" + consumerID + ", " + id + "]";
-   }
-
-   // Object overrides ----------------------------------------------
-
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------
-  
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnectionConsumer.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,352 @@
+/*
+  * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.ConnectionConsumer;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ServerSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.state.ConsumerState;
+import org.jboss.jms.delegate.ConnectionDelegate;
+import org.jboss.jms.delegate.ConsumerDelegate;
+import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.message.MessageProxy;
+import org.jboss.jms.util.MessageQueueNameHelper;
+import org.jboss.logging.Logger;
+
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+
+/**
+ * This class implements javax.jms.ConnectionConsumer
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * 
+ * Partially based on JBossMQ version by:
+ * 
+ * @author Hiram Chirino (Cojonudo14 at hotmail.com)
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * 
+ * @version $Revision$
+ *
+ * $Id$
+ */
+public class JBossConnectionConsumer implements ConnectionConsumer, Runnable
+{
+   // Constants -----------------------------------------------------
+
+   private static Logger log = Logger.getLogger(JBossConnectionConsumer.class);
+
+   private static boolean trace = log.isTraceEnabled();
+   
+   private static final int TIMEOUT = 20000;
+   
+   // Attributes ----------------------------------------------------
+   
+   private ConsumerDelegate cons;
+   
+   private SessionDelegate sess;
+   
+   private int consumerID;
+   
+   /** The ServerSessionPool that is implemented by the AS */
+   private ServerSessionPool serverSessionPool;
+   
+   /** The maximum number of messages that a single session will be loaded with. */
+   private int maxMessages;
+   
+   /** Is the ConnectionConsumer closed? */
+   private volatile boolean closed;
+     
+   /** The "listening" thread that gets messages from destination and queues
+   them for delivery to sessions */
+   private Thread internalThread;
+   
+   /** The thread id */
+   private int id;
+   
+   /** The thread id generator */
+   private static SynchronizedInt threadId = new SynchronizedInt(0);
+   
+   private int maxDeliveries;
+   
+   private String queueName;
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   public JBossConnectionConsumer(ConnectionDelegate conn, JBossDestination dest,
+                                  String subName, String messageSelector,
+                                  ServerSessionPool sessPool, int maxMessages) throws JMSException
+   {
+      this.serverSessionPool = sessPool;
+      this.maxMessages = maxMessages;
+
+      if (this.maxMessages < 1)
+      {
+         this.maxMessages = 1;
+      }
+
+      // Create a consumer. The MessageCallbackhandler knows we are a connection consumer so will
+      // not call pre or postDeliver so messages won't be acked, or stored in session/tx.
+      sess = conn.createSessionDelegate(false, Session.CLIENT_ACKNOWLEDGE, false);
+
+      cons = sess.createConsumerDelegate(dest, messageSelector, false, subName, true);
+
+      ConsumerState state = (ConsumerState)((DelegateSupport)cons).getState();
+
+      this.consumerID = state.getConsumerID();      
+        
+      this.maxDeliveries = state.getMaxDeliveries();
+      
+      if (subName != null)
+      {
+         queueName = MessageQueueNameHelper.createSubscriptionName(conn.getClientID(), subName);
+      }
+      else
+      {
+         queueName = dest.getName();
+      }
+
+      id = threadId.increment();
+      internalThread = new Thread(this, "Connection Consumer for dest " + dest + " id=" + id);
+      internalThread.start();
+
+      if (trace) { log.trace(this + " created"); }
+   }
+   
+   // ConnectionConsumer implementation -----------------------------
+
+   public ServerSessionPool getServerSessionPool() throws JMSException
+   {
+      return serverSessionPool;
+   }
+
+   public void close() throws JMSException
+   {
+      if (trace) { log.trace("close " + this); }
+      
+      doClose();
+      
+      //Wait for internal thread to complete
+      if (trace) { log.trace(this + " Waiting for internal thread to complete"); }
+      
+      try
+      {
+         internalThread.join(TIMEOUT);
+         
+         if (internalThread.isAlive())
+         {            
+            throw new JMSException(this + " Waited " + TIMEOUT + " ms for internal thread to complete, but it didn't");
+         }
+      }
+      catch (InterruptedException e)
+      {
+         if (trace) { log.trace(this + " Thread interrupted while waiting for internal thread to complete"); }
+         //Ignore
+      }
+      
+      if (trace) { log.trace("Closed: " + this); }      
+   }
+   
+   // Runnable implementation ---------------------------------------
+    
+   public void run()
+   {
+      if (trace) { log.trace("running connection consumer"); }
+      try
+      {
+         List mesList = new ArrayList();
+         
+         outer: while (true)
+         {            
+            if (closed)
+            {
+               if (trace) { log.trace("Connection consumer is closed, breaking"); }
+               break;
+            }
+            
+            if (mesList.isEmpty())
+            {
+               // Remove up to maxMessages messages from the consumer
+               inner: for (int i = 0; i < maxMessages; i++)
+               {               
+                  // receiveNoWait
+
+                  if (trace) { log.trace(this + " attempting to get message with receiveNoWait"); }
+                  
+                  Message m = null;
+                  
+                  try
+                  {
+                     m = cons.receive(-1);
+                  }
+                  catch (JMSException e)
+                  {
+                     //If the consumer is closed, we will get a JMSException so we ignore
+                     if (!closed)
+                     {
+                        throw e;
+                     }                        
+                  }
+               
+                  if (m == null)
+                  {
+                     if (trace) { log.trace("receiveNoWait did not retrieve any message"); }
+                     break;
+                  }
+
+                  if (trace) { log.trace("receiveNoWait got message " + m + " adding to queue"); }
+                  mesList.add(m);
+               }
+
+               if (mesList.isEmpty())
+               {
+                  // We didn't get any messages doing receiveNoWait, so let's wait. This returns if
+                  // a message is received or by the consumer closing.
+
+                  if (trace) { log.trace(this + " attempting to get message with blocking receive (no timeout)"); }
+
+                  Message m = null;
+                  
+                  try
+                  {
+                     m = cons.receive(0);                  
+                  }
+                  catch (JMSException e)
+                  {
+                     //If the consumer is closed, we will get a JMSException so we ignore
+                     if (!closed)
+                     {
+                        throw e;
+                     }                        
+                  }          
+                  
+                  if (m != null)
+                  {
+                     if (trace) { log.trace("receive (no timeout) got message " + m + " adding to queue"); }
+                     mesList.add(m);
+                  }
+                  else
+                  {
+                     // The consumer must have closed
+                     if (trace) { log.trace("blocking receive returned null, consumer must have closed"); }
+                     break;
+                  }
+               }
+            }
+            
+            if (!mesList.isEmpty())
+            {
+               if (trace) { log.trace("there are " + mesList.size() + " messages to send to session"); }
+
+               ServerSession serverSession = serverSessionPool.getServerSession();
+               JBossSession session = (JBossSession)serverSession.getSession();
+
+               MessageListener listener = session.getMessageListener();
+
+               if (listener == null)
+               {
+                  // Sanity check
+                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
+               }
+
+               for (int i = 0; i < mesList.size(); i++)
+               {
+                  MessageProxy m = (MessageProxy)mesList.get(i);
+                  session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess);
+                  if (trace) { log.trace("added " + m + " to session"); }
+               }
+
+               if (trace) { log.trace(this + " starting serverSession " + serverSession); }
+
+               serverSession.start();
+
+               if (trace) { log.trace(this + "'s serverSession processed messages"); }
+
+               mesList.clear();
+            }            
+         }
+         if (trace) { log.trace("ConnectionConsumer run() exiting"); }
+      }
+      catch (Throwable t)
+      {
+         log.warn("Connection consumer closing due to error in listening thread " + this, t);
+         
+         try
+         {
+            //Closing
+            doClose();
+         }
+         catch (JMSException e)
+         {
+            log.error("Failed to close connection consumer", e);
+         }
+      }            
+   }
+   
+   protected synchronized void doClose() throws JMSException
+   {
+      if (closed)
+      {
+         return;
+      }
+      
+      closed = true;            
+      
+      //Calling session.closing() will cause the consumer to close which
+      //will make any receive() calls return null
+      //and not return until the consumer close protocol is complete
+      sess.closing();
+      sess.close();           
+      
+      if (trace) { log.trace(this + "Closed message handler"); }
+   }
+
+   // Public --------------------------------------------------------
+
+   public String toString()
+   {
+      return "JBossConnectionConsumer[" + consumerID + ", " + id + "]";
+   }
+
+   // Object overrides ----------------------------------------------
+
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+  
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnectionFactory.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,225 +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;
-
-import java.io.Serializable;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XAQueueConnection;
-import javax.jms.XAQueueConnectionFactory;
-import javax.jms.XATopicConnection;
-import javax.jms.XATopicConnectionFactory;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-
-import org.jboss.jms.delegate.ConnectionFactoryDelegate;
-import org.jboss.jms.referenceable.SerializableObjectRefAddr;
-import org.jboss.jms.server.endpoint.CreateConnectionResult;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JBossConnectionFactory implements
-   ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
-   XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory,
-   Serializable/*, Referenceable http://jira.jboss.org/jira/browse/JBMESSAGING-395*/
-{
-   // Constants ------------------------------------------------------------------------------------
-   
-   private final static long serialVersionUID = -2810634789345348326L;
-   
-   private static final Logger log = Logger.getLogger(JBossConnectionFactory.class);
-
-   // Static ---------------------------------------------------------------------------------------
-   
-   // Attributes -----------------------------------------------------------------------------------
-   
-   protected ConnectionFactoryDelegate delegate;
-
-   // Constructors ---------------------------------------------------------------------------------
-   
-   public JBossConnectionFactory(ConnectionFactoryDelegate delegate)
-   {
-      this.delegate = delegate;      
-   }
-   
-   // ConnectionFactory implementation -------------------------------------------------------------
-   
-   public Connection createConnection() throws JMSException
-   {
-      return createConnection(null, null);
-   }
-   
-   public Connection createConnection(String username, String password) throws JMSException
-   {
-      return createConnectionInternal(username, password, false,
-                                      JBossConnection.TYPE_GENERIC_CONNECTION);
-   }
-   
-   // QueueConnectionFactory implementation --------------------------------------------------------
-   
-   public QueueConnection createQueueConnection() throws JMSException
-   {
-      return createQueueConnection(null, null);
-   }
-   
-   public QueueConnection createQueueConnection(String username, String password)
-      throws JMSException
-   {
-      return createConnectionInternal(username, password, false,
-                                      JBossConnection.TYPE_QUEUE_CONNECTION);
-   }
-   
-   // TopicConnectionFactory implementation --------------------------------------------------------
-   
-   public TopicConnection createTopicConnection() throws JMSException
-   {
-      return createTopicConnection(null, null);
-   }
-   
-   public TopicConnection createTopicConnection(String username, String password)
-      throws JMSException
-   {
-      return createConnectionInternal(username, password, false,
-                                      JBossConnection.TYPE_TOPIC_CONNECTION);
-   }
-   
-   // XAConnectionFactory implementation -----------------------------------------------------------
-   
-   public XAConnection createXAConnection() throws JMSException
-   {
-      return createXAConnection(null, null);
-   }
-   
-   public XAConnection createXAConnection(String username, String password) throws JMSException
-   {
-      return createConnectionInternal(username, password, true,
-                                      JBossConnection.TYPE_GENERIC_CONNECTION);
-   }
-   
-   // XAQueueConnectionFactory implementation ------------------------------------------------------
-   
-   public XAQueueConnection createXAQueueConnection() throws JMSException
-   {
-      return createXAQueueConnection(null, null);
-   }
-   
-   public XAQueueConnection createXAQueueConnection(String username, String password)
-      throws JMSException
-   {
-      return createConnectionInternal(username, password, true,
-                                      JBossConnection.TYPE_QUEUE_CONNECTION);
-   }
-   
-   // XATopicConnectionFactory implementation ------------------------------------------------------
-   
-   public XATopicConnection createXATopicConnection() throws JMSException
-   {
-      return createXATopicConnection(null, null);
-   }
-   
-   public XATopicConnection createXATopicConnection(String username, String password)
-      throws JMSException
-   {
-      return createConnectionInternal(username, password, true,
-                                      JBossConnection.TYPE_TOPIC_CONNECTION);
-   }
-   
-   // Referenceable implementation -----------------------------------------------------------------
-   
-   public Reference getReference() throws NamingException
-   {
-      return new Reference("org.jboss.jms.client.JBossConnectionFactory",
-               new SerializableObjectRefAddr("JBM-CF", this),
-               "org.jboss.jms.referenceable.ConnectionFactoryObjectFactory",
-               null);
-   }
-   
-   // Public ---------------------------------------------------------------------------------------
-   
-   public String toString()
-   {
-      return "JBossConnectionFactory->" + delegate;
-   }
-   
-   public ConnectionFactoryDelegate getDelegate()
-   {
-      return delegate;
-   }
-   
-   // Package protected ----------------------------------------------------------------------------
-   
-   // Protected ------------------------------------------------------------------------------------
-   
-   protected JBossConnection createConnectionInternal(String username, String password,
-                                                      boolean isXA, int type)
-      throws JMSException
-   {
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-      
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         try
-         {
-            ClientAOPStackLoader.getInstance().load(delegate);
-         }
-         catch(Exception e)
-         {
-            // Need to log message since no guarantee that client will log it
-            final String msg = "Failed to download and/or install client side AOP stack";
-            log.error(msg, e);
-            throw new RuntimeException(msg, e);
-         }
-   
-         // The version used by the connection is the minimum of the server version for the
-         // connection factory and the client code version
-         
-         CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1);        
-         
-         return new JBossConnection(res.getDelegate(), type);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-   
-   // Private --------------------------------------------------------------------------------------
-      
-   // Inner classes --------------------------------------------------------------------------------
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossConnectionFactory.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossConnectionFactory.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,213 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
+import javax.jms.XAQueueConnection;
+import javax.jms.XAQueueConnectionFactory;
+import javax.jms.XATopicConnection;
+import javax.jms.XATopicConnectionFactory;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import org.jboss.jms.delegate.ConnectionFactoryDelegate;
+import org.jboss.jms.referenceable.SerializableObjectRefAddr;
+import org.jboss.jms.server.endpoint.CreateConnectionResult;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JBossConnectionFactory implements
+   ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
+   XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory,
+   Serializable/*, Referenceable http://jira.jboss.org/jira/browse/JBMESSAGING-395*/
+{
+   // Constants ------------------------------------------------------------------------------------
+   
+   private final static long serialVersionUID = -2810634789345348326L;
+   
+   private static final Logger log = Logger.getLogger(JBossConnectionFactory.class);
+
+   // Static ---------------------------------------------------------------------------------------
+   
+   // Attributes -----------------------------------------------------------------------------------
+   
+   protected ConnectionFactoryDelegate delegate;
+
+   // Constructors ---------------------------------------------------------------------------------
+   
+   public JBossConnectionFactory(ConnectionFactoryDelegate delegate)
+   {
+      this.delegate = delegate;      
+   }
+   
+   // ConnectionFactory implementation -------------------------------------------------------------
+   
+   public Connection createConnection() throws JMSException
+   {
+      return createConnection(null, null);
+   }
+   
+   public Connection createConnection(String username, String password) throws JMSException
+   {
+      return createConnectionInternal(username, password, false,
+                                      JBossConnection.TYPE_GENERIC_CONNECTION);
+   }
+   
+   // QueueConnectionFactory implementation --------------------------------------------------------
+   
+   public QueueConnection createQueueConnection() throws JMSException
+   {
+      return createQueueConnection(null, null);
+   }
+   
+   public QueueConnection createQueueConnection(String username, String password)
+      throws JMSException
+   {
+      return createConnectionInternal(username, password, false,
+                                      JBossConnection.TYPE_QUEUE_CONNECTION);
+   }
+   
+   // TopicConnectionFactory implementation --------------------------------------------------------
+   
+   public TopicConnection createTopicConnection() throws JMSException
+   {
+      return createTopicConnection(null, null);
+   }
+   
+   public TopicConnection createTopicConnection(String username, String password)
+      throws JMSException
+   {
+      return createConnectionInternal(username, password, false,
+                                      JBossConnection.TYPE_TOPIC_CONNECTION);
+   }
+   
+   // XAConnectionFactory implementation -----------------------------------------------------------
+   
+   public XAConnection createXAConnection() throws JMSException
+   {
+      return createXAConnection(null, null);
+   }
+   
+   public XAConnection createXAConnection(String username, String password) throws JMSException
+   {
+      return createConnectionInternal(username, password, true,
+                                      JBossConnection.TYPE_GENERIC_CONNECTION);
+   }
+   
+   // XAQueueConnectionFactory implementation ------------------------------------------------------
+   
+   public XAQueueConnection createXAQueueConnection() throws JMSException
+   {
+      return createXAQueueConnection(null, null);
+   }
+   
+   public XAQueueConnection createXAQueueConnection(String username, String password)
+      throws JMSException
+   {
+      return createConnectionInternal(username, password, true,
+                                      JBossConnection.TYPE_QUEUE_CONNECTION);
+   }
+   
+   // XATopicConnectionFactory implementation ------------------------------------------------------
+   
+   public XATopicConnection createXATopicConnection() throws JMSException
+   {
+      return createXATopicConnection(null, null);
+   }
+   
+   public XATopicConnection createXATopicConnection(String username, String password)
+      throws JMSException
+   {
+      return createConnectionInternal(username, password, true,
+                                      JBossConnection.TYPE_TOPIC_CONNECTION);
+   }
+   
+   // Referenceable implementation -----------------------------------------------------------------
+   
+   public Reference getReference() throws NamingException
+   {
+      return new Reference("org.jboss.jms.client.JBossConnectionFactory",
+               new SerializableObjectRefAddr("JBM-CF", this),
+               "org.jboss.jms.referenceable.ConnectionFactoryObjectFactory",
+               null);
+   }
+   
+   // Public ---------------------------------------------------------------------------------------
+   
+   public String toString()
+   {
+      return "JBossConnectionFactory->" + delegate;
+   }
+   
+   public ConnectionFactoryDelegate getDelegate()
+   {
+      return delegate;
+   }
+   
+   // Package protected ----------------------------------------------------------------------------
+   
+   // Protected ------------------------------------------------------------------------------------
+   
+   protected JBossConnection createConnectionInternal(String username, String password,
+                                                      boolean isXA, int type)
+      throws JMSException
+   {
+      try
+      {
+         ClientAOPStackLoader.getInstance().load(delegate);
+      }
+      catch(Exception e)
+      {
+         // Need to log message since no guarantee that client will log it
+         final String msg = "Failed to download and/or install client side AOP stack";
+         log.error(msg, e);
+         throw new RuntimeException(msg, e);
+      }
+
+      // The version used by the connection is the minimum of the server version for the
+      // connection factory and the client code version
+
+      CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1);
+
+      return new JBossConnection(res.getDelegate(), type);
+   }
+   
+   // Private --------------------------------------------------------------------------------------
+      
+   // Inner classes --------------------------------------------------------------------------------
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossMessageProducer.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,246 +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;
-
-import java.io.Serializable;
-
-import javax.jms.Destination;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueSender;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-
-import org.jboss.jms.delegate.ProducerDelegate;
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JBossMessageProducer implements MessageProducer, QueueSender, TopicPublisher, Serializable
-{
-   // Constants -----------------------------------------------------
-   
-   private static final long serialVersionUID = 1080736785725023015L;
-
-   // Static --------------------------------------------------------      
-
-   private static final Logger log = Logger.getLogger(JBossMessageProducer.class);
-   
-   // Attributes ----------------------------------------------------
-   
-   protected ProducerDelegate delegate;
-
-   // Constructors --------------------------------------------------
-   
-   public JBossMessageProducer(ProducerDelegate delegate)
-   {
-      this.delegate = delegate;     
-   }
-   
-   // MessageProducer implementation --------------------------------
-   
-   public void setDisableMessageID(boolean value) throws JMSException
-   {
-      log.warn("JBoss Messaging does not support disabling message ID generation");
-
-      delegate.setDisableMessageID(value);
-   }
-   
-   public boolean getDisableMessageID() throws JMSException
-   {
-      return delegate.getDisableMessageID();
-   }
-   
-   public void setDisableMessageTimestamp(boolean value) throws JMSException
-   {
-      delegate.setDisableMessageTimestamp(value);
-   }
-   
-   public boolean getDisableMessageTimestamp() throws JMSException
-   {
-      return delegate.getDisableMessageTimestamp();
-   }
-   
-   public void setDeliveryMode(int deliveryMode) throws JMSException
-   {
-      delegate.setDeliveryMode(deliveryMode);
-   }
-   
-   public int getDeliveryMode() throws JMSException
-   {
-      return delegate.getDeliveryMode();
-   }
-   
-   public void setPriority(int defaultPriority) throws JMSException
-   {
-      delegate.setPriority(defaultPriority);
-   }
-   
-   public int getPriority() throws JMSException
-   {
-      return delegate.getPriority();
-   }
-   
-   public void setTimeToLive(long timeToLive) throws JMSException
-   {
-      delegate.setTimeToLive(timeToLive);
-   }
-   
-   public long getTimeToLive() throws JMSException
-   {
-      return delegate.getTimeToLive();
-   }
-   
-   public Destination getDestination() throws JMSException
-   {
-      return delegate.getDestination();
-   }
-   
-   public void close() throws JMSException
-   {
-      delegate.closing();
-      delegate.close();
-   }
-   
-   public void send(Message message) throws JMSException
-   {
-      // by default the message never expires
-      send(message, -1, -1, Long.MIN_VALUE);
-   }
-   
-   /**
-    * @param timeToLive - 0 means never expire.
-    */
-   public void send(Message message, int deliveryMode, int priority, long timeToLive)
-      throws JMSException
-   { 
-      send(null, message, deliveryMode, priority, timeToLive);
-   }
-   
-   public void send(Destination destination, Message message) throws JMSException
-   {      
-      send(destination, message, -1, -1, Long.MIN_VALUE);
-   }
-
-   public void send(Destination destination,
-                    Message m,
-                    int deliveryMode,
-                    int priority,
-                    long timeToLive) throws JMSException
-   {
-      if (destination != null && !(destination instanceof JBossDestination))
-      {
-         throw new InvalidDestinationException("Not a JBossDestination:" + destination);
-      }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         delegate.send((JBossDestination)destination, m, deliveryMode, priority, timeToLive);
-      }
-      finally
-      {
-         tccc.restore();
-      }      
-   }
-
-
-   // TopicPublisher Implementation ---------------------------------
-
-   public Topic getTopic() throws JMSException
-   {
-      return (Topic)getDestination();
-   }
-   
-   public void publish(Message message) throws JMSException
-   {
-      send(message);
-   }
-   
-   public void publish(Topic topic, Message message) throws JMSException
-   {
-      send(topic, message);
-   }
-   
-   public void publish(Message message, int deliveryMode, int priority, long timeToLive)
-      throws JMSException
-   {
-      send(message, deliveryMode, priority, timeToLive);
-   }
-   
-   public void publish(Topic topic, Message message, int deliveryMode,
-                       int priority, long timeToLive) throws JMSException
-   {
-      send(topic, message, deliveryMode, priority, timeToLive);
-   }
-
-   // QueueSender Implementation ------------------------------------
-
-   public void send(Queue queue, Message message) throws JMSException
-   {
-      send((Destination)queue, message);
-   }
-   
-   public void send(Queue queue, Message message, int deliveryMode, int priority,
-                    long timeToLive) throws JMSException
-   {
-      send((Destination)queue, message, deliveryMode, priority, timeToLive);
-   }
-   
-   public Queue getQueue() throws JMSException
-   {
-      return (Queue)getDestination();
-   }
-   
-   // Public --------------------------------------------------------
-
-   public ProducerDelegate getDelegate()
-   {
-      return delegate;
-   }
-
-   public String toString()
-   {
-      return "JBossMessageProducer->" + delegate;
-   }
-
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossMessageProducer.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossMessageProducer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,234 @@
+/*
+  * 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;
+
+import java.io.Serializable;
+
+import javax.jms.Destination;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueSender;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+
+import org.jboss.jms.delegate.ProducerDelegate;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JBossMessageProducer implements MessageProducer, QueueSender, TopicPublisher, Serializable
+{
+   // Constants -----------------------------------------------------
+   
+   private static final long serialVersionUID = 1080736785725023015L;
+
+   // Static --------------------------------------------------------      
+
+   private static final Logger log = Logger.getLogger(JBossMessageProducer.class);
+   
+   // Attributes ----------------------------------------------------
+   
+   protected ProducerDelegate delegate;
+
+   // Constructors --------------------------------------------------
+   
+   public JBossMessageProducer(ProducerDelegate delegate)
+   {
+      this.delegate = delegate;     
+   }
+   
+   // MessageProducer implementation --------------------------------
+   
+   public void setDisableMessageID(boolean value) throws JMSException
+   {
+      log.warn("JBoss Messaging does not support disabling message ID generation");
+
+      delegate.setDisableMessageID(value);
+   }
+   
+   public boolean getDisableMessageID() throws JMSException
+   {
+      return delegate.getDisableMessageID();
+   }
+   
+   public void setDisableMessageTimestamp(boolean value) throws JMSException
+   {
+      delegate.setDisableMessageTimestamp(value);
+   }
+   
+   public boolean getDisableMessageTimestamp() throws JMSException
+   {
+      return delegate.getDisableMessageTimestamp();
+   }
+   
+   public void setDeliveryMode(int deliveryMode) throws JMSException
+   {
+      delegate.setDeliveryMode(deliveryMode);
+   }
+   
+   public int getDeliveryMode() throws JMSException
+   {
+      return delegate.getDeliveryMode();
+   }
+   
+   public void setPriority(int defaultPriority) throws JMSException
+   {
+      delegate.setPriority(defaultPriority);
+   }
+   
+   public int getPriority() throws JMSException
+   {
+      return delegate.getPriority();
+   }
+   
+   public void setTimeToLive(long timeToLive) throws JMSException
+   {
+      delegate.setTimeToLive(timeToLive);
+   }
+   
+   public long getTimeToLive() throws JMSException
+   {
+      return delegate.getTimeToLive();
+   }
+   
+   public Destination getDestination() throws JMSException
+   {
+      return delegate.getDestination();
+   }
+   
+   public void close() throws JMSException
+   {
+      delegate.closing();
+      delegate.close();
+   }
+   
+   public void send(Message message) throws JMSException
+   {
+      // by default the message never expires
+      send(message, -1, -1, Long.MIN_VALUE);
+   }
+   
+   /**
+    * @param timeToLive - 0 means never expire.
+    */
+   public void send(Message message, int deliveryMode, int priority, long timeToLive)
+      throws JMSException
+   { 
+      send(null, message, deliveryMode, priority, timeToLive);
+   }
+   
+   public void send(Destination destination, Message message) throws JMSException
+   {      
+      send(destination, message, -1, -1, Long.MIN_VALUE);
+   }
+
+   public void send(Destination destination,
+                    Message m,
+                    int deliveryMode,
+                    int priority,
+                    long timeToLive) throws JMSException
+   {
+      if (destination != null && !(destination instanceof JBossDestination))
+      {
+         throw new InvalidDestinationException("Not a JBossDestination:" + destination);
+      }
+
+      delegate.send((JBossDestination)destination, m, deliveryMode, priority, timeToLive);
+   }
+
+
+   // TopicPublisher Implementation ---------------------------------
+
+   public Topic getTopic() throws JMSException
+   {
+      return (Topic)getDestination();
+   }
+   
+   public void publish(Message message) throws JMSException
+   {
+      send(message);
+   }
+   
+   public void publish(Topic topic, Message message) throws JMSException
+   {
+      send(topic, message);
+   }
+   
+   public void publish(Message message, int deliveryMode, int priority, long timeToLive)
+      throws JMSException
+   {
+      send(message, deliveryMode, priority, timeToLive);
+   }
+   
+   public void publish(Topic topic, Message message, int deliveryMode,
+                       int priority, long timeToLive) throws JMSException
+   {
+      send(topic, message, deliveryMode, priority, timeToLive);
+   }
+
+   // QueueSender Implementation ------------------------------------
+
+   public void send(Queue queue, Message message) throws JMSException
+   {
+      send((Destination)queue, message);
+   }
+   
+   public void send(Queue queue, Message message, int deliveryMode, int priority,
+                    long timeToLive) throws JMSException
+   {
+      send((Destination)queue, message, deliveryMode, priority, timeToLive);
+   }
+   
+   public Queue getQueue() throws JMSException
+   {
+      return (Queue)getDestination();
+   }
+   
+   // Public --------------------------------------------------------
+
+   public ProducerDelegate getDelegate()
+   {
+      return delegate;
+   }
+
+   public String toString()
+   {
+      return "JBossMessageProducer->" + delegate;
+   }
+
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossQueueBrowser.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,143 +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;
-
-import javax.jms.QueueBrowser;
-import javax.jms.Queue;
-import javax.jms.JMSException;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-
-import org.jboss.jms.delegate.BrowserDelegate;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-
-/**
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * $Id$
- */
-public class JBossQueueBrowser implements QueueBrowser, Serializable
-{
-   // Constants ------------------------------------------------------------------------------------
-
-   private static final long serialVersionUID = 4245650830082712281L;
-
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   private BrowserDelegate delegate;
-   private Queue queue;
-   private String messageSelector;
-
-   // Constructors ---------------------------------------------------------------------------------
-
-   JBossQueueBrowser(Queue queue, String messageSelector, BrowserDelegate delegate)
-   {
-      this.delegate = delegate;
-      this.queue = queue;
-      this.messageSelector = messageSelector;
-   }
-
-   // QueueBrowser implementation -------------------------------------------------------------------
-
-   public void close() throws JMSException
-   {
-      delegate.closing();
-      delegate.close();
-   }
-
-   public Enumeration getEnumeration() throws JMSException
-   {
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-         delegate.reset();
-      }
-      finally
-      {
-         tccc.restore();
-      }
-      
-      return new BrowserEnumeration();
-   }
-
-   public String getMessageSelector() throws JMSException
-   {
-      return messageSelector;
-   }
-
-   public Queue getQueue() throws JMSException
-   {
-      return queue;
-   }
-
-   // Public ---------------------------------------------------------------------------------------
-
-   public String toString()
-   {
-      return "JBossQueueBrowser->" + delegate;
-   }
-
-   public BrowserDelegate getDelegate()
-   {
-      return delegate;
-   }
-
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
-   // Private --------------------------------------------------------------------------------------
-
-   // Inner classes --------------------------------------------------------------------------------
-
-   private class BrowserEnumeration implements Enumeration
-   {
-      public boolean hasMoreElements()
-      {
-         try
-         {
-            return delegate.hasNextMessage();
-         }
-         catch (JMSException e)
-         {
-            throw new IllegalStateException(e.getMessage());
-         }
-      }
-
-      public Object nextElement()
-      {
-         try
-         {
-            return delegate.nextMessage();
-         }
-         catch (JMSException e)
-         {
-            throw new IllegalStateException(e.getMessage());
-         }
-      }
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossQueueBrowser.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossQueueBrowser.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,131 @@
+/*
+  * 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;
+
+import javax.jms.QueueBrowser;
+import javax.jms.Queue;
+import javax.jms.JMSException;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+
+import org.jboss.jms.delegate.BrowserDelegate;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * $Id$
+ */
+public class JBossQueueBrowser implements QueueBrowser, Serializable
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final long serialVersionUID = 4245650830082712281L;
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private BrowserDelegate delegate;
+   private Queue queue;
+   private String messageSelector;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   JBossQueueBrowser(Queue queue, String messageSelector, BrowserDelegate delegate)
+   {
+      this.delegate = delegate;
+      this.queue = queue;
+      this.messageSelector = messageSelector;
+   }
+
+   // QueueBrowser implementation -------------------------------------------------------------------
+
+   public void close() throws JMSException
+   {
+      delegate.closing();
+      delegate.close();
+   }
+
+   public Enumeration getEnumeration() throws JMSException
+   {
+      delegate.reset();
+      return new BrowserEnumeration();
+   }
+
+   public String getMessageSelector() throws JMSException
+   {
+      return messageSelector;
+   }
+
+   public Queue getQueue() throws JMSException
+   {
+      return queue;
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public String toString()
+   {
+      return "JBossQueueBrowser->" + delegate;
+   }
+
+   public BrowserDelegate getDelegate()
+   {
+      return delegate;
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+   private class BrowserEnumeration implements Enumeration
+   {
+      public boolean hasMoreElements()
+      {
+         try
+         {
+            return delegate.hasNextMessage();
+         }
+         catch (JMSException e)
+         {
+            throw new IllegalStateException(e.getMessage());
+         }
+      }
+
+      public Object nextElement()
+      {
+         try
+         {
+            return delegate.nextMessage();
+         }
+         catch (JMSException e)
+         {
+            throw new IllegalStateException(e.getMessage());
+         }
+      }
+   }
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossSession.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,533 +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;
-
-import java.io.Serializable;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.XAQueueSession;
-import javax.jms.XASession;
-import javax.jms.XATopicSession;
-import javax.transaction.xa.XAResource;
-
-import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.state.SessionState;
-import org.jboss.jms.delegate.BrowserDelegate;
-import org.jboss.jms.delegate.ConsumerDelegate;
-import org.jboss.jms.delegate.ProducerDelegate;
-import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.destination.JBossTemporaryQueue;
-import org.jboss.jms.destination.JBossTemporaryTopic;
-import org.jboss.jms.destination.JBossTopic;
-import org.jboss.jms.message.MessageProxy;
-import org.jboss.jms.util.ThreadContextClassLoaderChanger;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * 
- * @version <tt>$Revision$</tt>
- * 
- * $Id$
- */
-public class JBossSession implements
-   Session, XASession, QueueSession, XAQueueSession,
-   TopicSession, XATopicSession, Serializable
-{   
-   // Constants -----------------------------------------------------
-   
-   private static final long serialVersionUID = 2235942510476264909L;
-   
-   static final int TYPE_GENERIC_SESSION = 0;
-   
-   static final int TYPE_QUEUE_SESSION = 1;
-   
-   static final int TYPE_TOPIC_SESSION = 2;
-
-   // Static --------------------------------------------------------
-   
-   private static final Logger log = Logger.getLogger(JBossSession.class);
-   
-   // Attributes ----------------------------------------------------
-   
-   protected SessionDelegate delegate;
-
-   protected int sessionType;
-
-   // Constructors --------------------------------------------------
-
-   public JBossSession(SessionDelegate sessionDelegate, int sessionType)
-   {
-      this.delegate = sessionDelegate;
-      this.sessionType = sessionType;
-   }
-
-   // Session implementation ----------------------------------------
-
-   public BytesMessage createBytesMessage() throws JMSException
-   {
-   	return delegate.createBytesMessage();
-   }
-
-   public MapMessage createMapMessage() throws JMSException
-   {
-   	return delegate.createMapMessage();
-   }
-
-   public Message createMessage() throws JMSException
-   {
-      return delegate.createMessage();
-   }
-
-   public ObjectMessage createObjectMessage() throws JMSException
-   {
-   	return delegate.createObjectMessage();
-   }
-
-   public ObjectMessage createObjectMessage(Serializable object) throws JMSException
-   {
-   	return delegate.createObjectMessage(object);
-   }
-
-   public StreamMessage createStreamMessage() throws JMSException
-   {
-   	return delegate.createStreamMessage();
-   }
-
-   public TextMessage createTextMessage() throws JMSException
-   {
-   	return delegate.createTextMessage();
-   }
-
-   public TextMessage createTextMessage(String text) throws JMSException
-   {
-   	return delegate.createTextMessage(text);
-   }
-
-   public boolean getTransacted() throws JMSException
-   {
-      return delegate.getTransacted();
-   }
-
-   public int getAcknowledgeMode() throws JMSException
-   {
-      return delegate.getAcknowledgeMode();
-   }
-
-   public void commit() throws JMSException
-   {
-      delegate.commit();
-   }
-
-   public void rollback() throws JMSException
-   {
-      delegate.rollback();
-   }
-
-   public void close() throws JMSException
-   {
-      delegate.closing();
-      delegate.close();
-   }
-
-   public void recover() throws JMSException
-   {
-      delegate.recover();
-   }
-
-   public MessageListener getMessageListener() throws JMSException
-   {
-      if (log.isTraceEnabled()) { log.trace("getMessageListener() called"); }
-      return delegate.getMessageListener();
-   }
-
-   public void setMessageListener(MessageListener listener) throws JMSException
-   {
-      if (log.isTraceEnabled()) { log.trace("setMessageListener(" + listener + ") called"); }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         delegate.setMessageListener(listener);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public void run()
-   {
-      if (log.isTraceEnabled()) { log.trace("run() called"); }
-      delegate.run();
-   }
-
-   public MessageProducer createProducer(Destination d) throws JMSException
-   {
-      if (d != null && !(d instanceof JBossDestination))
-      {
-         throw new InvalidDestinationException("Not a JBossDestination:" + d);
-      }
-           
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         ProducerDelegate producerDelegate = delegate.createProducerDelegate((JBossDestination)d);
-         return new JBossMessageProducer(producerDelegate);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-  public MessageConsumer createConsumer(Destination d) throws JMSException
-  {
-     return createConsumer(d, null, false);
-  }
-
-  public MessageConsumer createConsumer(Destination d, String messageSelector) throws JMSException
-  {
-     return createConsumer(d, messageSelector, false);
-  }
-
-   public MessageConsumer createConsumer(Destination d, String messageSelector, boolean noLocal)
-         throws JMSException
-   {
-      if (d == null)
-      {
-         throw new InvalidDestinationException("Cannot create a consumer with a null destination");
-      }
-      if (!(d instanceof JBossDestination))
-      {
-         throw new InvalidDestinationException("Not a JBossDestination:" + d);
-      }
-
-      log.debug("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : ", messageSelector: " + messageSelector) + (noLocal ? ", noLocal = true" : ""));
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         ConsumerDelegate cd = delegate.
-            createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false);
-         
-         return new JBossMessageConsumer(cd);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public Queue createQueue(String queueName) throws JMSException
-   {
-      //As per spec. section 4.11
-      if (sessionType == TYPE_TOPIC_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a queue using a TopicSession");
-      }
-      return delegate.createQueue(queueName);
-   }
-
-   public Topic createTopic(String topicName) throws JMSException
-   {
-      //As per spec. section 4.11
-      if (sessionType == TYPE_QUEUE_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a topic on a QueueSession");
-      }
-      return delegate.createTopic(topicName);
-   }
-
-   public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException
-   {
-      //As per spec. section 4.11
-      if (sessionType == TYPE_QUEUE_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
-      }
-      if (topic == null)
-      {
-         throw new InvalidDestinationException("Cannot create a durable subscriber on a null topic");
-      }
-      if (!(topic instanceof JBossTopic))
-      {
-         throw new InvalidDestinationException("Not a JBossTopic:" + topic);
-      }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         ConsumerDelegate cd =
-            delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false);
-
-         return new JBossMessageConsumer(cd);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public TopicSubscriber createDurableSubscriber(Topic topic,
-                                                  String name,
-                                                  String messageSelector,
-                                                  boolean noLocal)
-         throws JMSException
-   {
-      //As per spec. section 4.11
-      if (sessionType == TYPE_QUEUE_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
-      }
-      if (topic == null)
-      {
-         throw new InvalidDestinationException("Cannot create a durable subscriber on a null topic");
-      }
-      if (!(topic instanceof JBossTopic))
-      {
-         throw new InvalidDestinationException("Not a JBossTopic:" + topic);
-      }
-      if ("".equals(messageSelector))
-      {
-         messageSelector = null;
-      }
-
-      ConsumerDelegate cd = delegate.
-         createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false);
-
-      return new JBossMessageConsumer(cd);
-   }
-
-   public QueueBrowser createBrowser(Queue queue) throws JMSException
-   {
-      return createBrowser(queue, null);
-   }
-
-   public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException
-   {
-      //As per spec. section 4.11
-      if (sessionType == TYPE_TOPIC_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a browser on a TopicSession");
-      }
-      if (queue == null)
-      {
-         throw new InvalidDestinationException("Cannot create a browser with a null queue");
-      }
-      if (!(queue instanceof JBossQueue))
-      {
-         throw new InvalidDestinationException("Not a JBossQueue:" + queue);
-      }
-      if ("".equals(messageSelector))
-      {
-         messageSelector = null;
-      }
-
-      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
-
-      try
-      {
-         tccc.set(getClass().getClassLoader());
-
-         BrowserDelegate del =
-            delegate.createBrowserDelegate((JBossQueue)queue, messageSelector);
-         
-         return new JBossQueueBrowser(queue, messageSelector, del);
-      }
-      finally
-      {
-         tccc.restore();
-      }
-   }
-
-   public TemporaryQueue createTemporaryQueue() throws JMSException
-   {
-      // As per spec. section 4.11
-      if (sessionType == TYPE_TOPIC_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a temporary queue using a TopicSession");
-      }
-      JBossTemporaryQueue queue = new JBossTemporaryQueue(delegate);
-      delegate.addTemporaryDestination(queue);
-      return queue;
-   }
-
-   public TemporaryTopic createTemporaryTopic() throws JMSException
-   {
-      // As per spec. section 4.11
-      if (sessionType == TYPE_QUEUE_SESSION)
-      {
-         throw new IllegalStateException("Cannot create a temporary topic on a QueueSession");
-      }
-      JBossTemporaryTopic topic = new JBossTemporaryTopic(delegate);
-      delegate.addTemporaryDestination(topic);
-      return topic;
-   }
-
-   public void unsubscribe(String name) throws JMSException
-   {
-      // As per spec. section 4.11
-      if (sessionType == TYPE_QUEUE_SESSION)
-      {
-         throw new IllegalStateException("Cannot unsubscribe using a QueueSession");
-      }
-      delegate.unsubscribe(name);
-   }
-   
-   // XASession implementation
-   
-   public Session getSession() throws JMSException
-   {      
-      SessionState state = (SessionState)((DelegateSupport)delegate).getState();
-      if (!state.isXA())
-      {
-         throw new IllegalStateException("Isn't an XASession");
-      }
-      
-      return this;
-   }
-  
-   public XAResource getXAResource()
-   {          
-      return delegate.getXAResource();
-   }
-   
-   // QueueSession implementation
-   
-   public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException
-   {
-      return (QueueReceiver)createConsumer(queue, messageSelector);
-   }
-
-   public QueueReceiver createReceiver(Queue queue) throws JMSException
-   {
-      return (QueueReceiver)createConsumer(queue);
-   }
-
-   public QueueSender createSender(Queue queue) throws JMSException
-   {
-      return (QueueSender)createProducer(queue);
-   }
-   
-   // XAQueueSession implementation
-   
-   public QueueSession getQueueSession() throws JMSException
-   {
-      return (QueueSession)getSession();
-   }
-   
-   // TopicSession implementation
-   
-   public TopicPublisher createPublisher(Topic topic) throws JMSException
-   {
-      return (TopicPublisher)createProducer(topic);
-   }
-
-   public TopicSubscriber createSubscriber(Topic topic, String messageSelector,
-         boolean noLocal) throws JMSException
-   {
-      return (TopicSubscriber)createConsumer(topic, messageSelector, noLocal);
-   }
-
-   public TopicSubscriber createSubscriber(Topic topic) throws JMSException
-   {
-      return (TopicSubscriber)createConsumer(topic);
-   }
-   
-   // XATopicSession implementation
-   
-   public TopicSession getTopicSession() throws JMSException
-   {
-      return (TopicSession)getSession();
-   }
-
-   // Public --------------------------------------------------------
-
-   public String toString()
-   {
-      return "JBossSession->" + delegate;
-   }
-   
-   public SessionDelegate getDelegate()
-   {
-      return delegate;
-   }
-
-   // Package protected ---------------------------------------------
-   
-   /*
-    * 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, String queueName, int maxDeliveries,
-                      SessionDelegate connectionConsumerSession)
-   {
-      delegate.addAsfMessage(m, consumerID, queueName, maxDeliveries, connectionConsumerSession);
-   }
-      
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-    
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/JBossSession.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/JBossSession.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,477 @@
+/*
+  * 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;
+
+import java.io.Serializable;
+
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.IllegalStateException;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.jms.XAQueueSession;
+import javax.jms.XASession;
+import javax.jms.XATopicSession;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.BrowserDelegate;
+import org.jboss.jms.delegate.ConsumerDelegate;
+import org.jboss.jms.delegate.ProducerDelegate;
+import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.destination.JBossQueue;
+import org.jboss.jms.destination.JBossTemporaryQueue;
+import org.jboss.jms.destination.JBossTemporaryTopic;
+import org.jboss.jms.destination.JBossTopic;
+import org.jboss.jms.message.MessageProxy;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ * 
+ * $Id$
+ */
+public class JBossSession implements
+   Session, XASession, QueueSession, XAQueueSession,
+   TopicSession, XATopicSession, Serializable
+{   
+   // Constants -----------------------------------------------------
+   
+   private static final long serialVersionUID = 2235942510476264909L;
+   
+   static final int TYPE_GENERIC_SESSION = 0;
+   
+   static final int TYPE_QUEUE_SESSION = 1;
+   
+   static final int TYPE_TOPIC_SESSION = 2;
+
+   // Static --------------------------------------------------------
+   
+   private static final Logger log = Logger.getLogger(JBossSession.class);
+   
+   // Attributes ----------------------------------------------------
+   
+   protected SessionDelegate delegate;
+
+   protected int sessionType;
+
+   // Constructors --------------------------------------------------
+
+   public JBossSession(SessionDelegate sessionDelegate, int sessionType)
+   {
+      this.delegate = sessionDelegate;
+      this.sessionType = sessionType;
+   }
+
+   // Session implementation ----------------------------------------
+
+   public BytesMessage createBytesMessage() throws JMSException
+   {
+   	return delegate.createBytesMessage();
+   }
+
+   public MapMessage createMapMessage() throws JMSException
+   {
+   	return delegate.createMapMessage();
+   }
+
+   public Message createMessage() throws JMSException
+   {
+      return delegate.createMessage();
+   }
+
+   public ObjectMessage createObjectMessage() throws JMSException
+   {
+   	return delegate.createObjectMessage();
+   }
+
+   public ObjectMessage createObjectMessage(Serializable object) throws JMSException
+   {
+   	return delegate.createObjectMessage(object);
+   }
+
+   public StreamMessage createStreamMessage() throws JMSException
+   {
+   	return delegate.createStreamMessage();
+   }
+
+   public TextMessage createTextMessage() throws JMSException
+   {
+   	return delegate.createTextMessage();
+   }
+
+   public TextMessage createTextMessage(String text) throws JMSException
+   {
+   	return delegate.createTextMessage(text);
+   }
+
+   public boolean getTransacted() throws JMSException
+   {
+      return delegate.getTransacted();
+   }
+
+   public int getAcknowledgeMode() throws JMSException
+   {
+      return delegate.getAcknowledgeMode();
+   }
+
+   public void commit() throws JMSException
+   {
+      delegate.commit();
+   }
+
+   public void rollback() throws JMSException
+   {
+      delegate.rollback();
+   }
+
+   public void close() throws JMSException
+   {
+      delegate.closing();
+      delegate.close();
+   }
+
+   public void recover() throws JMSException
+   {
+      delegate.recover();
+   }
+
+   public MessageListener getMessageListener() throws JMSException
+   {
+      if (log.isTraceEnabled()) { log.trace("getMessageListener() called"); }
+      return delegate.getMessageListener();
+   }
+
+   public void setMessageListener(MessageListener listener) throws JMSException
+   {
+      if (log.isTraceEnabled()) { log.trace("setMessageListener(" + listener + ") called"); }
+
+      delegate.setMessageListener(listener);
+   }
+
+   public void run()
+   {
+      if (log.isTraceEnabled()) { log.trace("run() called"); }
+      delegate.run();
+   }
+
+   public MessageProducer createProducer(Destination d) throws JMSException
+   {
+      if (d != null && !(d instanceof JBossDestination))
+      {
+         throw new InvalidDestinationException("Not a JBossDestination:" + d);
+      }
+           
+      ProducerDelegate producerDelegate = delegate.createProducerDelegate((JBossDestination)d);
+      return new JBossMessageProducer(producerDelegate);
+   }
+
+  public MessageConsumer createConsumer(Destination d) throws JMSException
+  {
+     return createConsumer(d, null, false);
+  }
+
+  public MessageConsumer createConsumer(Destination d, String messageSelector) throws JMSException
+  {
+     return createConsumer(d, messageSelector, false);
+  }
+
+   public MessageConsumer createConsumer(Destination d, String messageSelector, boolean noLocal)
+         throws JMSException
+   {
+      if (d == null)
+      {
+         throw new InvalidDestinationException("Cannot create a consumer with a null destination");
+      }
+      if (!(d instanceof JBossDestination))
+      {
+         throw new InvalidDestinationException("Not a JBossDestination:" + d);
+      }
+
+      log.debug("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : ", messageSelector: " + messageSelector) + (noLocal ? ", noLocal = true" : ""));
+
+      ConsumerDelegate cd = delegate.
+         createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false);
+
+      return new JBossMessageConsumer(cd);
+   }
+
+   public Queue createQueue(String queueName) throws JMSException
+   {
+      //As per spec. section 4.11
+      if (sessionType == TYPE_TOPIC_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a queue using a TopicSession");
+      }
+      return delegate.createQueue(queueName);
+   }
+
+   public Topic createTopic(String topicName) throws JMSException
+   {
+      //As per spec. section 4.11
+      if (sessionType == TYPE_QUEUE_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a topic on a QueueSession");
+      }
+      return delegate.createTopic(topicName);
+   }
+
+   public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException
+   {
+      //As per spec. section 4.11
+      if (sessionType == TYPE_QUEUE_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
+      }
+      if (topic == null)
+      {
+         throw new InvalidDestinationException("Cannot create a durable subscriber on a null topic");
+      }
+      if (!(topic instanceof JBossTopic))
+      {
+         throw new InvalidDestinationException("Not a JBossTopic:" + topic);
+      }
+
+      ConsumerDelegate cd =
+         delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false);
+
+      return new JBossMessageConsumer(cd);
+   }
+
+   public TopicSubscriber createDurableSubscriber(Topic topic,
+                                                  String name,
+                                                  String messageSelector,
+                                                  boolean noLocal)
+         throws JMSException
+   {
+      //As per spec. section 4.11
+      if (sessionType == TYPE_QUEUE_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
+      }
+      if (topic == null)
+      {
+         throw new InvalidDestinationException("Cannot create a durable subscriber on a null topic");
+      }
+      if (!(topic instanceof JBossTopic))
+      {
+         throw new InvalidDestinationException("Not a JBossTopic:" + topic);
+      }
+      if ("".equals(messageSelector))
+      {
+         messageSelector = null;
+      }
+
+      ConsumerDelegate cd = delegate.
+         createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false);
+
+      return new JBossMessageConsumer(cd);
+   }
+
+   public QueueBrowser createBrowser(Queue queue) throws JMSException
+   {
+      return createBrowser(queue, null);
+   }
+
+   public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException
+   {
+      //As per spec. section 4.11
+      if (sessionType == TYPE_TOPIC_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a browser on a TopicSession");
+      }
+      if (queue == null)
+      {
+         throw new InvalidDestinationException("Cannot create a browser with a null queue");
+      }
+      if (!(queue instanceof JBossQueue))
+      {
+         throw new InvalidDestinationException("Not a JBossQueue:" + queue);
+      }
+      if ("".equals(messageSelector))
+      {
+         messageSelector = null;
+      }
+
+      BrowserDelegate del =
+         delegate.createBrowserDelegate((JBossQueue)queue, messageSelector);
+
+      return new JBossQueueBrowser(queue, messageSelector, del);
+   }
+
+   public TemporaryQueue createTemporaryQueue() throws JMSException
+   {
+      // As per spec. section 4.11
+      if (sessionType == TYPE_TOPIC_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a temporary queue using a TopicSession");
+      }
+      JBossTemporaryQueue queue = new JBossTemporaryQueue(delegate);
+      delegate.addTemporaryDestination(queue);
+      return queue;
+   }
+
+   public TemporaryTopic createTemporaryTopic() throws JMSException
+   {
+      // As per spec. section 4.11
+      if (sessionType == TYPE_QUEUE_SESSION)
+      {
+         throw new IllegalStateException("Cannot create a temporary topic on a QueueSession");
+      }
+      JBossTemporaryTopic topic = new JBossTemporaryTopic(delegate);
+      delegate.addTemporaryDestination(topic);
+      return topic;
+   }
+
+   public void unsubscribe(String name) throws JMSException
+   {
+      // As per spec. section 4.11
+      if (sessionType == TYPE_QUEUE_SESSION)
+      {
+         throw new IllegalStateException("Cannot unsubscribe using a QueueSession");
+      }
+      delegate.unsubscribe(name);
+   }
+   
+   // XASession implementation
+   
+   public Session getSession() throws JMSException
+   {      
+      SessionState state = (SessionState)((DelegateSupport)delegate).getState();
+      if (!state.isXA())
+      {
+         throw new IllegalStateException("Isn't an XASession");
+      }
+      
+      return this;
+   }
+  
+   public XAResource getXAResource()
+   {          
+      return delegate.getXAResource();
+   }
+   
+   // QueueSession implementation
+   
+   public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException
+   {
+      return (QueueReceiver)createConsumer(queue, messageSelector);
+   }
+
+   public QueueReceiver createReceiver(Queue queue) throws JMSException
+   {
+      return (QueueReceiver)createConsumer(queue);
+   }
+
+   public QueueSender createSender(Queue queue) throws JMSException
+   {
+      return (QueueSender)createProducer(queue);
+   }
+   
+   // XAQueueSession implementation
+   
+   public QueueSession getQueueSession() throws JMSException
+   {
+      return (QueueSession)getSession();
+   }
+   
+   // TopicSession implementation
+   
+   public TopicPublisher createPublisher(Topic topic) throws JMSException
+   {
+      return (TopicPublisher)createProducer(topic);
+   }
+
+   public TopicSubscriber createSubscriber(Topic topic, String messageSelector,
+         boolean noLocal) throws JMSException
+   {
+      return (TopicSubscriber)createConsumer(topic, messageSelector, noLocal);
+   }
+
+   public TopicSubscriber createSubscriber(Topic topic) throws JMSException
+   {
+      return (TopicSubscriber)createConsumer(topic);
+   }
+   
+   // XATopicSession implementation
+   
+   public TopicSession getTopicSession() throws JMSException
+   {
+      return (TopicSession)getSession();
+   }
+
+   // Public --------------------------------------------------------
+
+   public String toString()
+   {
+      return "JBossSession->" + delegate;
+   }
+   
+   public SessionDelegate getDelegate()
+   {
+      return delegate;
+   }
+
+   // Package protected ---------------------------------------------
+   
+   /*
+    * 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, String queueName, int maxDeliveries,
+                      SessionDelegate connectionConsumerSession)
+   {
+      delegate.addAsfMessage(m, consumerID, queueName, maxDeliveries, connectionConsumerSession);
+   }
+      
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+    
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,207 +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.container;
-
-import javax.jms.MessageListener;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.remoting.CallbackManager;
-import org.jboss.jms.client.remoting.MessageCallbackHandler;
-import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.client.state.ConsumerState;
-import org.jboss.jms.client.state.SessionState;
-import org.jboss.jms.delegate.ConsumerDelegate;
-import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.util.MessageQueueNameHelper;
-
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
-
-/**
- * 
- * Handles operations related to the consumer.
- * 
- * This aspect is PER_VM.
- * 
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ConsumerAspect
-{
-   // Constants ------------------------------------------------------------------------------------
-   
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   // Constructors ---------------------------------------------------------------------------------
-
-   // Public ---------------------------------------------------------------------------------------
-
-   public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable
-   {
-      MethodInvocation mi = (MethodInvocation)invocation;
-
-      ConsumerDelegate consumerDelegate = (ConsumerDelegate)invocation.invokeNext();
-
-      boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();
-
-      // Create the message handler
-      SessionState sessionState =
-         (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
-      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
-      SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
-      ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
-      int consumerID = consumerState.getConsumerID();
-      int prefetchSize = consumerState.getBufferSize();
-      QueuedExecutor sessionExecutor = sessionState.getExecutor();
-      int maxDeliveries = consumerState.getMaxDeliveries();
-      
-      //We need the queue name for recovering any deliveries after failover
-      String queueName = null;
-      if (consumerState.getSubscriptionName() != null)
-      {
-         queueName = MessageQueueNameHelper.
-            createSubscriptionName(connectionState.getClientID(),
-                                   consumerState.getSubscriptionName());
-      }
-      else if (consumerState.getDestination().isQueue())
-      {
-         queueName = consumerState.getDestination().getName();
-      }
-      
-      MessageCallbackHandler messageHandler =
-         new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
-                                    sessionDelegate, consumerDelegate, consumerID, queueName,
-                                    prefetchSize, sessionExecutor, maxDeliveries);
-      
-      sessionState.addCallbackHandler(messageHandler);
-      
-      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
-      cm.registerHandler(consumerID, messageHandler);
-         
-      consumerState.setMessageCallbackHandler(messageHandler);
-      
-      //Now we have finished creating the client consumer, we can tell the SCD
-      //we are ready
-      consumerDelegate.changeRate(1);
-
-      return consumerDelegate;
-   }
-   
-   public Object handleClosing(Invocation invocation) throws Throwable
-   {      
-      ConsumerState consumerState = getState(invocation);
-                       
-      // We make sure closing is called on the ServerConsumerEndpoint.
-      // This returns us the last delivery id sent
-      
-      Long l  = (Long)invocation.invokeNext();
-      
-      long lastDeliveryId = l.longValue();
-      
-      // First we call close on the messagecallbackhandler which waits for onMessage invocations      
-      // to complete and the last delivery to arrive
-      consumerState.getMessageCallbackHandler().close(lastDeliveryId);
-                
-      SessionState sessionState = (SessionState)consumerState.getParent();
-      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
-                 
-      sessionState.removeCallbackHandler(consumerState.getMessageCallbackHandler());
-
-      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
-      cm.unregisterHandler(consumerState.getConsumerID());
-         
-      //And then we cancel any messages still in the message callback handler buffer     
-      consumerState.getMessageCallbackHandler().cancelBuffer();
-                                   
-      return l;
-   }      
-   
-   public Object handleReceive(Invocation invocation) throws Throwable
-   {
-      MethodInvocation mi = (MethodInvocation)invocation;
-      Object[] args = mi.getArguments();
-      long timeout = args == null ? 0 : ((Long)args[0]).longValue();
-      
-      return getMessageCallbackHandler(invocation).receive(timeout);
-   }
-   
-   public Object handleReceiveNoWait(Invocation invocation) throws Throwable
-   {      
-      return getMessageCallbackHandler(invocation).receive(-1);
-   }
-   
-   public Object handleSetMessageListener(Invocation invocation) throws Throwable
-   {   
-      MethodInvocation mi = (MethodInvocation)invocation;
-      Object[] args = mi.getArguments();
-      MessageListener l = (MessageListener)args[0];
-      
-      getMessageCallbackHandler(invocation).setMessageListener(l);
-      
-      return null;
-   }
-   
-   public MessageListener handleGetMessageListener(Invocation invocation) throws Throwable
-   {       
-      return getMessageCallbackHandler(invocation).getMessageListener();
-   }
-   
-   public Object handleGetDestination(Invocation invocation) throws Throwable
-   {
-      return getState(invocation).getDestination();
-   }
-   
-   public Object handleGetNoLocal(Invocation invocation) throws Throwable
-   {
-      return getState(invocation).isNoLocal() ? Boolean.TRUE : Boolean.FALSE;
-   }
-   
-   public Object handleGetMessageSelector(Invocation invocation) throws Throwable
-   {
-      return getState(invocation).getSelector();
-   }
-   
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
-   // Private --------------------------------------------------------------------------------------
-   
-   private ConsumerState getState(Invocation inv)
-   {
-      return (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
-   }
-   
-   private MessageCallbackHandler getMessageCallbackHandler(Invocation inv)
-   {      
-      ConsumerState state = (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
-      return state.getMessageCallbackHandler();      
-   }
-   
-   // Inner classes --------------------------------------------------------------------------------
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java (from rev 2562, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/ConsumerAspect.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,207 @@
+/*
+  * 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.container;
+
+import javax.jms.MessageListener;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.remoting.CallbackManager;
+import org.jboss.jms.client.remoting.MessageCallbackHandler;
+import org.jboss.jms.client.state.ConnectionState;
+import org.jboss.jms.client.state.ConsumerState;
+import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.ConsumerDelegate;
+import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.util.MessageQueueNameHelper;
+
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+
+/**
+ * 
+ * Handles operations related to the consumer.
+ * 
+ * This aspect is PER_VM.
+ * 
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ConsumerAspect
+{
+   // Constants ------------------------------------------------------------------------------------
+   
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable
+   {
+      MethodInvocation mi = (MethodInvocation)invocation;
+
+      ConsumerDelegate consumerDelegate = (ConsumerDelegate)invocation.invokeNext();
+
+      boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();
+
+      // Create the message handler
+      SessionState sessionState =
+         (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
+      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
+      SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
+      ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
+      int consumerID = consumerState.getConsumerID();
+      int prefetchSize = consumerState.getBufferSize();
+      QueuedExecutor sessionExecutor = sessionState.getExecutor();
+      int maxDeliveries = consumerState.getMaxDeliveries();
+      
+      //We need the queue name for recovering any deliveries after failover
+      String queueName = null;
+      if (consumerState.getSubscriptionName() != null)
+      {
+         queueName = MessageQueueNameHelper.
+            createSubscriptionName(connectionState.getClientID(),
+                                   consumerState.getSubscriptionName());
+      }
+      else if (consumerState.getDestination().isQueue())
+      {
+         queueName = consumerState.getDestination().getName();
+      }
+      
+      MessageCallbackHandler messageHandler =
+         new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
+                                    sessionDelegate, consumerDelegate, consumerID, queueName,
+                                    prefetchSize, sessionExecutor, maxDeliveries);
+      
+      sessionState.addCallbackHandler(messageHandler);
+      
+      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
+      cm.registerHandler(consumerID, messageHandler);
+         
+      consumerState.setMessageCallbackHandler(messageHandler);
+      
+      //Now we have finished creating the client consumer, we can tell the SCD
+      //we are ready
+      consumerDelegate.changeRate(1);
+
+      return consumerDelegate;
+   }
+   
+   public Object handleClosing(Invocation invocation) throws Throwable
+   {      
+      ConsumerState consumerState = getState(invocation);
+                       
+      // We make sure closing is called on the ServerConsumerEndpoint.
+      // This returns us the last delivery id sent
+      
+      Long l  = (Long)invocation.invokeNext();
+      
+      long lastDeliveryId = l.longValue();
+      
+      // First we call close on the messagecallbackhandler which waits for onMessage invocations      
+      // to complete and the last delivery to arrive
+      consumerState.getMessageCallbackHandler().close(lastDeliveryId);
+                
+      SessionState sessionState = (SessionState)consumerState.getParent();
+      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
+                 
+      sessionState.removeCallbackHandler(consumerState.getMessageCallbackHandler());
+
+      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
+      cm.unregisterHandler(consumerState.getConsumerID());
+         
+      //And then we cancel any messages still in the message callback handler buffer     
+      consumerState.getMessageCallbackHandler().cancelBuffer();
+                                   
+      return l;
+   }      
+   
+   public Object handleReceive(Invocation invocation) throws Throwable
+   {
+      MethodInvocation mi = (MethodInvocation)invocation;
+      Object[] args = mi.getArguments();
+      long timeout = (args == null || args.length==0) ? 0 : ((Long)args[0]).longValue();
+      
+      return getMessageCallbackHandler(invocation).receive(timeout);
+   }
+   
+   public Object handleReceiveNoWait(Invocation invocation) throws Throwable
+   {      
+      return getMessageCallbackHandler(invocation).receive(-1);
+   }
+   
+   public Object handleSetMessageListener(Invocation invocation) throws Throwable
+   {   
+      MethodInvocation mi = (MethodInvocation)invocation;
+      Object[] args = mi.getArguments();
+      MessageListener l = (MessageListener)args[0];
+      
+      getMessageCallbackHandler(invocation).setMessageListener(l);
+      
+      return null;
+   }
+   
+   public MessageListener handleGetMessageListener(Invocation invocation) throws Throwable
+   {       
+      return getMessageCallbackHandler(invocation).getMessageListener();
+   }
+   
+   public Object handleGetDestination(Invocation invocation) throws Throwable
+   {
+      return getState(invocation).getDestination();
+   }
+   
+   public Object handleGetNoLocal(Invocation invocation) throws Throwable
+   {
+      return getState(invocation).isNoLocal() ? Boolean.TRUE : Boolean.FALSE;
+   }
+   
+   public Object handleGetMessageSelector(Invocation invocation) throws Throwable
+   {
+      return getState(invocation).getSelector();
+   }
+   
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+   
+   private ConsumerState getState(Invocation inv)
+   {
+      return (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
+   }
+   
+   private MessageCallbackHandler getMessageCallbackHandler(Invocation inv)
+   {      
+      ConsumerState state = (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
+      return state.getMessageCallbackHandler();      
+   }
+   
+   // Inner classes --------------------------------------------------------------------------------
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,127 +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.container;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.AspectXmlLoader;
-import org.w3c.dom.Document;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * This class deploys the client side AOP config from a byte[] representation of the 
- * client aop config file.
- * This allows the config to be kep on the server but the advising to be done on the client.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * 
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JmsClientAspectXMLLoader extends AspectXmlLoader
-{
-   public JmsClientAspectXMLLoader()
-   {
-      super();
-      this.setManager(AspectManager.instance());
-   }
-   
-   /*
-    * Deploy aop config from byte[]
-    */
-   public void deployXML(byte[] config) throws Exception
-   {
-      
-      //We need to synchronized to prevent a deadlock
-      //See http://jira.jboss.com/jira/browse/JBMESSAGING-797
-      synchronized (AspectManager.instance())
-      {         
-         InputStream is = null;
-         
-         try
-         {
-            is = new ByteArrayInputStream(config);      
-         
-            DocumentBuilderFactory docBuilderFactory = null;
-            
-            docBuilderFactory = DocumentBuilderFactory.newInstance();
-            
-            docBuilderFactory.setValidating(false);
-            
-            InputSource source = new InputSource(is);
-            
-            URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
-            
-            source.setSystemId(url.toString());
-            
-            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
-            
-            docBuilder.setEntityResolver(new Resolver());
-            
-            Document doc = docBuilder.parse(source);
-            
-            this.deployXML(doc, null);              
-         }
-         finally
-         {
-            if (is != null)
-            {
-               is.close();
-            }
-         }
-      }
-   }
-   
-   /* From AspectXMLLoader.Resolver */
-   private static class Resolver implements EntityResolver
-   {
-      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
-      {
-         if (systemId.endsWith("jboss-aop_1_0.dtd"))
-         {
-            try
-            {
-               URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
-               InputStream is = url.openStream();
-               return new InputSource(is);
-            }
-            catch (IOException e)
-            {
-               e.printStackTrace();
-               return null;
-            }
-         }
-         return null;
-      }
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/JmsClientAspectXMLLoader.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,127 @@
+/*
+  * 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.container;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This class deploys the client side AOP config from a byte[] representation of the 
+ * client aop config file.
+ * This allows the config to be kep on the server but the advising to be done on the client.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JmsClientAspectXMLLoader extends AspectXmlLoader
+{
+   public JmsClientAspectXMLLoader()
+   {
+      super();
+      this.setManager(AspectManager.instance());
+   }
+   
+   /*
+    * Deploy aop config from byte[]
+    */
+   public void deployXML(byte[] config) throws Exception
+   {
+      
+      //We need to synchronized to prevent a deadlock
+      //See http://jira.jboss.com/jira/browse/JBMESSAGING-797
+      synchronized (AspectManager.instance())
+      {         
+         InputStream is = null;
+         
+         try
+         {
+            is = new ByteArrayInputStream(config);      
+         
+            DocumentBuilderFactory docBuilderFactory = null;
+            
+            docBuilderFactory = DocumentBuilderFactory.newInstance();
+            
+            docBuilderFactory.setValidating(false);
+            
+            InputSource source = new InputSource(is);
+            
+            URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
+            
+            source.setSystemId(url.toString());
+            
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            
+            docBuilder.setEntityResolver(new Resolver());
+            
+            Document doc = docBuilder.parse(source);
+            
+            this.deployXML(doc, null, this.getClass().getClassLoader());              
+         }
+         finally
+         {
+            if (is != null)
+            {
+               is.close();
+            }
+         }
+      }
+   }
+   
+   /* From AspectXMLLoader.Resolver */
+   private static class Resolver implements EntityResolver
+   {
+      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+      {
+         if (systemId.endsWith("jboss-aop_1_0.dtd"))
+         {
+            try
+            {
+               URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
+               InputStream is = url.openStream();
+               return new InputSource(is);
+            }
+            catch (IOException e)
+            {
+               e.printStackTrace();
+               return null;
+            }
+         }
+         return null;
+      }
+   }
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,880 +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.container;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.jms.IllegalStateException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TransactionInProgressException;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.jms.client.JBossConnectionConsumer;
-import org.jboss.jms.client.delegate.ClientSessionDelegate;
-import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.remoting.MessageCallbackHandler;
-import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.client.state.SessionState;
-import org.jboss.jms.delegate.ConnectionDelegate;
-import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.message.BytesMessageProxy;
-import org.jboss.jms.message.JBossBytesMessage;
-import org.jboss.jms.message.JBossMapMessage;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.message.JBossObjectMessage;
-import org.jboss.jms.message.JBossStreamMessage;
-import org.jboss.jms.message.JBossTextMessage;
-import org.jboss.jms.message.MapMessageProxy;
-import org.jboss.jms.message.MessageProxy;
-import org.jboss.jms.message.ObjectMessageProxy;
-import org.jboss.jms.message.StreamMessageProxy;
-import org.jboss.jms.message.TextMessageProxy;
-import org.jboss.jms.server.endpoint.DefaultCancel;
-import org.jboss.jms.server.endpoint.DeliveryInfo;
-import org.jboss.jms.tx.LocalTx;
-import org.jboss.jms.tx.ResourceManager;
-import org.jboss.logging.Logger;
-
-/**
- * This aspect handles JMS session related logic
- * 
- * This aspect is PER_VM
- *
- * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
- * @author <a href="mailto:ovidiu at jboss.com>Ovidiu Feodorov</a>
- *
- * $Id$
- */
-public class SessionAspect
-{
-   // Constants -----------------------------------------------------
-   
-   private static final Logger log = Logger.getLogger(SessionAspect.class);
-   
-   // Attributes ----------------------------------------------------
-   
-   private boolean trace = log.isTraceEnabled();
-   
-   // Static --------------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-   
-   // Public --------------------------------------------------------
-   
-   public Object handleClosing(Invocation invocation) throws Throwable
-   {
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
-            
-      if (trace) { log.trace("handleClosing()"); }
-
-      //Sanity check
-      if (state.isXA())
-      {
-         if (trace) { log.trace("Session is XA"); }
-         
-         ConnectionState connState = (ConnectionState)state.getParent();
-         
-         ResourceManager rm = connState.getResourceManager();
-         
-         // An XASession should never be closed if there is prepared ack work that has not yet been
-         // committed or rolled back. Imagine if messages had been consumed in the session, and
-         // prepared but not committed. Then the connection was explicitly closed causing the
-         // session to close. Closing the session causes any outstanding delivered but unacked
-         // messages to be cancelled to the server which means they would be available for other
-         // consumers to consume. If another consumer then consumes them, then recover() is called
-         // and the original transaction is committed, then this means the same message has been
-         // delivered twice which breaks the once and only once delivery guarantee.
-         
-         if (rm.checkForAcksInSession(state.getSessionID()))
-         {
-            throw new IllegalStateException(
-               "Attempt to close an XASession when there are still uncommitted acknowledgements!");
-         }        
-      }
-            
-      int ackMode = state.getAcknowledgeMode();
-  
-      //We need to either ack (for auto_ack) or cancel (for client_ack)
-      //any deliveries - this is because the message listener might have closed
-      //before on message had finished executing
-      
-      if (ackMode == Session.AUTO_ACKNOWLEDGE)
-      {
-         //Acknowledge or cancel any outstanding auto ack
-         
-         DeliveryInfo remainingAutoAck = state.getAutoAckInfo();
-         
-         if (remainingAutoAck != null)
-         {
-            if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
-            
-            try
-            {
-               ackDelivery(del, remainingAutoAck);
-               
-               if (trace) { log.trace(this + " acked it"); }               
-            }
-            finally
-            {                        
-               state.setAutoAckInfo(null);
-            }
-         }
-      }
-      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
-      {
-         //Ack any remaining deliveries
-                          
-         if (!state.getClientAckList().isEmpty())
-         {               
-            try
-            {
-               del.acknowledgeDeliveries(state.getClientAckList());
-            }
-            finally
-            {            
-               state.getClientAckList().clear();
-               
-               state.setAutoAckInfo(null);
-            }
-         }
-      }
-      else if (ackMode == Session.CLIENT_ACKNOWLEDGE)
-      {
-         // Cancel any oustanding deliveries
-         // 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.
-                  
-         // CLIENT_ACKNOWLEDGE cannot be used with MDBs (i.e. no connection consumer)
-         // so is always safe to cancel on this session                  
-         
-         cancelDeliveries(del, state.getClientAckList());
-         
-         state.getClientAckList().clear();
-      }
-      else if (state.isTransacted() && !state.isXA())
-      {
-         //We need to explicitly cancel any deliveries back to the server
-         //from the resource manager, otherwise delivery count won't be updated
-         
-         ConnectionState connState = (ConnectionState)state.getParent();
-         
-         ResourceManager rm = connState.getResourceManager();
-         
-         List dels = rm.getDeliveriesForSession(state.getSessionID());
-         
-         cancelDeliveries(del, dels);        
-      }
-            
-      
-      return invocation.invokeNext();
-   }      
-   
-   public Object handleClose(Invocation invocation) throws Throwable
-   {      
-      Object res = invocation.invokeNext();
-      
-      SessionState state = getState(invocation);
-
-      ConnectionState connState = (ConnectionState)state.getParent();
-
-      Object xid = state.getCurrentTxId();
-
-      if (xid != null)
-      {
-         //Remove transaction from the resource manager
-         connState.getResourceManager().removeTx(xid);
-      }
-
-      // We must explicitly shutdown the executor
-
-      state.getExecutor().shutdownNow();
-
-      return res;
-   }
-   
-   public Object handlePreDeliver(Invocation invocation) throws Throwable
-   { 
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);
-      
-      int ackMode = state.getAcknowledgeMode();
-      
-      Object[] args = mi.getArguments();
-      DeliveryInfo info = (DeliveryInfo)args[0];
-      
-      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
-      {
-         // We collect acknowledgments in the list
-         
-         if (trace) { log.trace(this + " added to CLIENT_ACKNOWLEDGE list delivery " + info); }
-         
-         // Sanity check
-         if (info.getConnectionConsumerSession() != null)
-         {
-            throw new IllegalStateException(
-               "CLIENT_ACKNOWLEDGE cannot be used with a connection consumer");
-         }
-                  
-         state.getClientAckList().add(info);
-      }
-      else if (ackMode == Session.AUTO_ACKNOWLEDGE)
-      {
-         // We collect the single acknowledgement in the state. 
-                           
-         if (trace) { log.trace(this + " added " + info + " to session state"); }
-         
-         state.setAutoAckInfo(info);         
-      }
-      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
-      {
-         if (trace) { log.trace(this + " added to DUPS_OK_ACKNOWLEDGE list delivery " + info); }
-         
-         state.getClientAckList().add(info);
-         
-         //Also set here - this would be used for recovery in a message listener
-         state.setAutoAckInfo(info);
-      }
-      else
-      {             
-         Object txID = state.getCurrentTxId();
-   
-         if (txID != null)
-         {
-            // the session is non-XA and transacted, or XA and enrolled in a global transaction. An
-            // XA session that has not been enrolled in a global transaction behaves as a
-            // transacted session.
-            
-            ConnectionState connState = (ConnectionState)state.getParent();
-   
-            if (trace) { log.trace("sending acknowlegment transactionally, queueing on resource manager"); }
-   
-            // If the ack is for a delivery that came through via a connection consumer then we use
-            // the connectionConsumer session as the session id, otherwise we use this sessions'
-            // session ID
-            
-            ClientSessionDelegate connectionConsumerDelegate =
-               (ClientSessionDelegate)info.getConnectionConsumerSession();
-            
-            int sessionId = connectionConsumerDelegate != null ?
-               connectionConsumerDelegate.getID() : state.getSessionID();
-            
-            connState.getResourceManager().addAck(txID, sessionId, info);
-         }        
-      }
-      
-      return null;
-   }
-   
-   public Object handlePostDeliver(Invocation invocation) throws Throwable
-   { 
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);
-      
-      int ackMode = state.getAcknowledgeMode();
-      
-      if (ackMode == Session.AUTO_ACKNOWLEDGE)
-      {
-         // We auto acknowledge.
-
-         SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
-
-         // It is possible that session.recover() is called inside a message listener onMessage
-         // method - i.e. between the invocations of preDeliver and postDeliver. In this case we
-         // don't want to acknowledge the last delivered messages - since it will be redelivered.
-         if (!state.isRecoverCalled())
-         {
-            DeliveryInfo delivery = state.getAutoAckInfo();
-            
-            if (delivery == null)
-            {
-               throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
-            }
-                                 
-            if (trace) { log.trace(this + " auto acknowledging delivery " + delivery); }
-              
-
-            // We clear the state in a finally so then we don't get a knock on
-            // exception on the next ack since we haven't cleared the state. See
-            // http://jira.jboss.org/jira/browse/JBMESSAGING-852
-
-            //This is ok since the message is acked after delivery, then the client
-            //could get duplicates anyway
-            
-            try
-            {
-               ackDelivery(sd, delivery);
-            }
-            finally
-            {
-               state.setAutoAckInfo(null);               
-            }
-         }         
-         else
-         {
-            if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
-
-            state.setRecoverCalled(false);
-         }
-      }
-      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
-      {
-         List acks = state.getClientAckList();
-         
-         if (!state.isRecoverCalled())
-         {
-            if (acks.size() >= state.getDupsOKBatchSize())
-            {
-               // We clear the state in a finally
-               // http://jira.jboss.org/jira/browse/JBMESSAGING-852
-   
-               SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
-                                          
-               try
-               {
-                  sd.acknowledgeDeliveries(acks);
-               }
-               finally
-               {                  
-                  acks.clear();
-                  state.setAutoAckInfo(null);
-               }
-            }    
-         }
-         else
-         {
-            if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
-
-            state.setRecoverCalled(false);
-         }
-         state.setAutoAckInfo(null);
-                  
-      }
-
-      return null;
-   }
-   
-   /**
-    * Used for client acknowledge.
-    */
-   public Object handleAcknowledgeAll(Invocation invocation) throws Throwable
-   {    
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();            
-    
-      if (!state.getClientAckList().isEmpty())
-      {                 
-         //CLIENT_ACKNOWLEDGE can't be used with a MDB so it is safe to always acknowledge all
-         //on this session (rather than the connection consumer session)
-         del.acknowledgeDeliveries(state.getClientAckList());
-      
-         state.getClientAckList().clear();
-      }      
-        
-      return null;
-   }
-                       
-   /*
-    * Called when session.recover is called
-    */
-   public Object handleRecover(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("recover called"); }
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-            
-      SessionState state = getState(invocation);
-      
-      if (state.isTransacted())
-      {
-         throw new IllegalStateException("Cannot recover a transacted session");
-      }
-      
-      if (trace) { log.trace("recovering the session"); }
-       
-      //Call redeliver
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
-      
-      int ackMode = state.getAcknowledgeMode();
-      
-      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
-      {
-         List dels = state.getClientAckList();
-         
-         state.setClientAckList(new ArrayList());
-         
-         del.redeliver(dels);
-      }
-      else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
-      {
-         DeliveryInfo info = state.getAutoAckInfo();
-         
-         //Don't recover if it's already to cancel
-         
-         if (info != null)
-         {
-            List redels = new ArrayList();
-            
-            redels.add(info);
-            
-            del.redeliver(redels);
-            
-            state.setAutoAckInfo(null);            
-         }
-      }   
-        
-      state.setRecoverCalled(true);
-      
-      return null;  
-   }
-   
-   /**
-    * Redelivery occurs in two situations:
-    *
-    * 1) When session.recover() is called (JMS1.1 4.4.11)
-    *
-    * "A session's recover method is used to stop a session and restart it with its first
-    * unacknowledged message. In effect, the session's series of delivered messages is reset to the
-    * point after its last acknowledged message."
-    *
-    * An important note here is that session recovery is LOCAL to the session. Session recovery DOES
-    * NOT result in delivered messages being cancelled back to the channel where they can be
-    * redelivered - since that may result in them being picked up by another session, which would
-    * break the semantics of recovery as described in the spec.
-    *
-    * 2) When session rollback occurs (JMS1.1 4.4.7). On rollback of a session the spec is clear
-    * that session recovery occurs:
-    *
-    * "If a transaction rollback is done, its produced messages are destroyed and its consumed
-    * messages are automatically recovered. For more information on session recovery, see Section
-    * 4.4.11 'Message Acknowledgment.'"
-    *
-    * So on rollback we do session recovery (local redelivery) in the same as if session.recover()
-    * was called.
-    * 
-    * All cancellation at rollback is driven from the client side - we always attempt to redeliver
-    * messages to their original consumers if they are still open, or then cancel them to the server
-    * if they are not. Cancelling them to the server explicitly allows the delivery count to be updated.
-    * 
-    * 
-    */
-   public Object handleRedeliver(Invocation invocation) throws Throwable
-   {            
-      MethodInvocation mi = (MethodInvocation)invocation;
-      SessionState state = getState(invocation);            
-            
-      // We put the messages back in the front of their appropriate consumer buffers
-      
-      List toRedeliver = (List)mi.getArguments()[0];
-       
-      if (trace) { log.trace(this + " handleRedeliver() called: " + toRedeliver); }
-      
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
-      
-      // Need to be redelivered in reverse order.
-      for (int i = toRedeliver.size() - 1; i >= 0; i--)
-      {
-         DeliveryInfo info = (DeliveryInfo)toRedeliver.get(i);
-         MessageProxy proxy = info.getMessageProxy();        
-         
-         MessageCallbackHandler handler = state.getCallbackHandler(info.getConsumerId());
-              
-         if (handler == null)
-         {
-            // This is ok. The original consumer has closed, so we cancel the message
-            
-            //FIXME - this needs to be done atomically for all cancels
-            
-            cancelDelivery(del, info);
-         }
-         else
-         {
-            if (trace) { log.trace("Adding proxy back to front of buffer"); }
-            
-            handler.addToFrontOfBuffer(proxy);
-         }                                    
-      }
-              
-      return null;  
-   }
-   
-   public Object handleCommit(Invocation invocation) throws Throwable
-   {
-      SessionState state = getState(invocation);
-
-      if (!state.isTransacted())
-      {
-         throw new IllegalStateException("Cannot commit a non-transacted session");
-      }
-
-      if (state.isXA())
-      {
-         throw new TransactionInProgressException("Cannot call commit on an XA session");
-      }
-
-      ConnectionState connState = (ConnectionState)state.getParent();
-      ConnectionDelegate conn = (ConnectionDelegate)connState.getDelegate();
-  
-      try
-      {
-         connState.getResourceManager().commitLocal((LocalTx)state.getCurrentTxId(), conn);
-      }
-      finally
-      {
-         //Start new local tx
-         Object xid = connState.getResourceManager().createLocalTx();
-
-         state.setCurrentTxId(xid);
-      }
-      
-      //TODO on commit we don't want to ACK any messages that have exceeded the max delivery count OR
-
-      return null;
-   }
-
-   public Object handleRollback(Invocation invocation) throws Throwable
-   {
-      SessionState state = getState(invocation);
-
-      if (!state.isTransacted())
-      {
-         throw new IllegalStateException("Cannot rollback a non-transacted session");
-      }
-
-      if (state.isXA())
-      {
-         throw new TransactionInProgressException("Cannot call rollback on an XA session");
-      }
-      
-      ConnectionState connState = (ConnectionState)state.getParent();
-      ResourceManager rm = connState.getResourceManager();
-      try
-      {
-         rm.rollbackLocal((LocalTx)state.getCurrentTxId());
-      }
-      finally
-      {
-         // start new local tx
-         Object xid = rm.createLocalTx();
-         state.setCurrentTxId(xid);
-      }
-
-      return null;
-   }
-   
-   public Object handleSend(Invocation invocation) throws Throwable
-   {
-      SessionState state = getState(invocation);
-      Object txID = state.getCurrentTxId();
-
-      if (txID != null)
-      {
-         // the session is non-XA and transacted, or XA and enrolled in a global transaction, so
-         // we add the message to a transaction instead of sending it now. An XA session that has
-         // not been enrolled in a global transaction behaves as a non-transacted session.
-
-         ConnectionState connState = (ConnectionState)state.getParent();
-         MethodInvocation mi = (MethodInvocation)invocation;
-         Message m = (Message)mi.getArguments()[0];
-
-         if (trace) { log.trace("sending message " + m + " transactionally, queueing on resource manager txID=" + txID + " sessionID= " + state.getSessionID()); }
-
-         connState.getResourceManager().addMessage(txID, state.getSessionID(), (JBossMessage)m);
-
-         // ... and we don't invoke any further interceptors in the stack
-         return null;
-      }
-
-      if (trace) { log.trace("sending message NON-transactionally"); }
-
-      return invocation.invokeNext();
-   }
-   
-   public Object handleGetXAResource(Invocation invocation) throws Throwable
-   {
-      return getState(invocation).getXAResource();
-   }
-   
-   public Object handleGetTransacted(Invocation invocation) throws Throwable
-   {
-      return getState(invocation).isTransacted() ? Boolean.TRUE : Boolean.FALSE;
-   }
-   
-   public Object handleGetAcknowledgeMode(Invocation invocation) throws Throwable
-   {
-      return new Integer(getState(invocation).getAcknowledgeMode());
-   }
-   
-   public Object handleCreateMessage(Invocation invocation) throws Throwable
-   {
-      JBossMessage jbm = new JBossMessage(0);
-       
-      return new MessageProxy(jbm);
-   }
-   
-   public Object handleCreateBytesMessage(Invocation invocation) throws Throwable
-   {
-      JBossBytesMessage jbm = new JBossBytesMessage(0);
-         
-      return new BytesMessageProxy(jbm);
-   }
-   
-   public Object handleCreateMapMessage(Invocation invocation) throws Throwable
-   {
-      JBossMapMessage jbm = new JBossMapMessage(0);
-       
-      return new MapMessageProxy(jbm);      
-   }
-   
-   public Object handleCreateObjectMessage(Invocation invocation) throws Throwable
-   {
-      JBossObjectMessage jbm = new JBossObjectMessage(0);
-       
-      MethodInvocation mi = (MethodInvocation)invocation;
-      
-      if (mi.getArguments() != null)
-      {
-         jbm.setObject((Serializable)mi.getArguments()[0]);
-      }
-      
-      return new ObjectMessageProxy(jbm);
-   }
-   
-   public Object handleCreateStreamMessage(Invocation invocation) throws Throwable
-   {
-      JBossStreamMessage jbm = new JBossStreamMessage(0);
-      
-      return new StreamMessageProxy(jbm);
-   }
-   
-   public Object handleCreateTextMessage(Invocation invocation) throws Throwable
-   {  
-      JBossTextMessage jbm = new JBossTextMessage(0);
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-      
-      if (mi.getArguments() != null)
-      {
-         jbm.setText((String)mi.getArguments()[0]);
-      }
-      
-      return new TextMessageProxy(jbm);
-   }   
-   
-   
-   
-   public Object handleSetMessageListener(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("setMessageListener()"); }
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-      
-      MessageListener listener = (MessageListener)mi.getArguments()[0];
-      
-      if (listener == null)
-      {
-         throw new IllegalStateException("Cannot set a null MessageListener on the session");
-      }
-      
-      getState(invocation).setDistinguishedListener(listener);
-      
-      return null;
-   }
-   
-   public Object handleGetMessageListener(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("getMessageListener()"); }
-      
-      return getState(invocation).getDistinguishedListener();
-   }
-   
-   public Object handleCreateConnectionConsumer(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("createConnectionConsumer()"); }
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-      
-      JBossDestination dest = (JBossDestination)mi.getArguments()[0];
-      String subscriptionName = (String)mi.getArguments()[1];
-      String messageSelector = (String)mi.getArguments()[2];
-      ServerSessionPool sessionPool = (ServerSessionPool)mi.getArguments()[3];
-      int maxMessages = ((Integer)mi.getArguments()[4]).intValue();
-      
-      return new JBossConnectionConsumer((ConnectionDelegate)mi.getTargetObject(), dest,
-                                         subscriptionName, messageSelector, sessionPool,
-                                         maxMessages);
-   }
-   
-   public Object handleAddAsfMessage(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("addAsfMessage()"); }
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-      
-      // Load the session with a message to be processed during a subsequent call to run()
-
-      MessageProxy m = (MessageProxy)mi.getArguments()[0];
-      int theConsumerID = ((Integer)mi.getArguments()[1]).intValue();
-      String queueName = (String)mi.getArguments()[2];
-      int maxDeliveries = ((Integer)mi.getArguments()[3]).intValue();
-      SessionDelegate connectionConsumerDelegate = ((SessionDelegate)mi.getArguments()[4]);
-      
-      if (m == null)
-      {
-         throw new IllegalStateException("Cannot add a null message to the session");
-      }
-
-      AsfMessageHolder holder = new AsfMessageHolder();
-      holder.msg = m;
-      holder.consumerID = theConsumerID;
-      holder.queueName = queueName;
-      holder.maxDeliveries = maxDeliveries;
-      holder.connectionConsumerDelegate = connectionConsumerDelegate;
-      
-      getState(invocation).getASFMessages().add(holder);
-      
-      return null;
-   }
-
-   public Object handleRun(Invocation invocation) throws Throwable
-   {
-      if (trace) { log.trace("run()"); }
-      
-      MethodInvocation mi = (MethodInvocation)invocation;
-            
-      //This is the delegate for the session from the pool
-      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
-      
-      SessionState state = getState(invocation);
-      
-      int ackMode = state.getAcknowledgeMode();
-
-      LinkedList msgs = state.getASFMessages();
-      
-      while (msgs.size() > 0)
-      {
-         AsfMessageHolder holder = (AsfMessageHolder)msgs.removeFirst();
-
-         if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
-         
-         MessageCallbackHandler.callOnMessage(del, state.getDistinguishedListener(), holder.consumerID,
-                                              holder.queueName, false,
-                                              holder.msg, ackMode, holder.maxDeliveries,
-                                              holder.connectionConsumerDelegate);                          
-      }
-      
-      return null;
-   }
-   
-   
-
-   public String toString()
-   {
-      return "SessionAspect[" + Integer.toHexString(hashCode()) + "]";
-   }
-
-   
-
-   // Class YYY overrides -------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Package Private -----------------------------------------------
-
-   // Private -------------------------------------------------------
-   
-   private SessionState getState(Invocation inv)
-   {
-      return (SessionState)((DelegateSupport)inv.getTargetObject()).getState();
-   }
-   
-   private void ackDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
-   {
-      SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
-      
-      //If the delivery was obtained via a connection consumer we need to ack via that
-      //otherwise we just use this session
-      
-      SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
-      
-      sessionToUse.acknowledgeDelivery(delivery);      
-   }
-   
-   private void cancelDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
-   {
-      SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
-      
-      //If the delivery was obtained via a connection consumer we need to cancel via that
-      //otherwise we just use this session
-      
-      SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
-      
-      sessionToUse.cancelDelivery(new DefaultCancel(delivery.getDeliveryID(),
-                                  delivery.getMessageProxy().getDeliveryCount(), false, false));      
-   }
-   
-   private void cancelDeliveries(SessionDelegate del, List deliveryInfos) throws Exception
-   {
-      List cancels = new ArrayList();
-      
-      for (Iterator i = deliveryInfos.iterator(); i.hasNext(); )
-      {
-         DeliveryInfo ack = (DeliveryInfo)i.next();            
-         
-         DefaultCancel cancel = new DefaultCancel(ack.getMessageProxy().getDeliveryId(),
-                                                  ack.getMessageProxy().getDeliveryCount(),
-                                                  false, false);
-         
-         cancels.add(cancel);
-      }  
-      
-      if (!cancels.isEmpty())
-      {
-         del.cancelDeliveries(cancels);
-      }
-   }
-
-   // Inner Classes -------------------------------------------------
-   
-   private static class AsfMessageHolder
-   {
-      private MessageProxy msg;
-      private int consumerID;
-      private String queueName;
-      private int maxDeliveries;
-      private SessionDelegate connectionConsumerDelegate;
-   }
-   
-}
-

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java (from rev 2561, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/client/container/SessionAspect.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,880 @@
+/*
+  * 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.container;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.jms.IllegalStateException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.TransactionInProgressException;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.jms.client.JBossConnectionConsumer;
+import org.jboss.jms.client.delegate.ClientSessionDelegate;
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.remoting.MessageCallbackHandler;
+import org.jboss.jms.client.state.ConnectionState;
+import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.ConnectionDelegate;
+import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.message.BytesMessageProxy;
+import org.jboss.jms.message.JBossBytesMessage;
+import org.jboss.jms.message.JBossMapMessage;
+import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.message.JBossObjectMessage;
+import org.jboss.jms.message.JBossStreamMessage;
+import org.jboss.jms.message.JBossTextMessage;
+import org.jboss.jms.message.MapMessageProxy;
+import org.jboss.jms.message.MessageProxy;
+import org.jboss.jms.message.ObjectMessageProxy;
+import org.jboss.jms.message.StreamMessageProxy;
+import org.jboss.jms.message.TextMessageProxy;
+import org.jboss.jms.server.endpoint.DefaultCancel;
+import org.jboss.jms.server.endpoint.DeliveryInfo;
+import org.jboss.jms.tx.LocalTx;
+import org.jboss.jms.tx.ResourceManager;
+import org.jboss.logging.Logger;
+
+/**
+ * This aspect handles JMS session related logic
+ * 
+ * This aspect is PER_VM
+ *
+ * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.com>Ovidiu Feodorov</a>
+ *
+ * $Id$
+ */
+public class SessionAspect
+{
+   // Constants -----------------------------------------------------
+   
+   private static final Logger log = Logger.getLogger(SessionAspect.class);
+   
+   // Attributes ----------------------------------------------------
+   
+   private boolean trace = log.isTraceEnabled();
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+   
+   // Public --------------------------------------------------------
+   
+   public Object handleClosing(Invocation invocation) throws Throwable
+   {
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
+            
+      if (trace) { log.trace("handleClosing()"); }
+
+      //Sanity check
+      if (state.isXA())
+      {
+         if (trace) { log.trace("Session is XA"); }
+         
+         ConnectionState connState = (ConnectionState)state.getParent();
+         
+         ResourceManager rm = connState.getResourceManager();
+         
+         // An XASession should never be closed if there is prepared ack work that has not yet been
+         // committed or rolled back. Imagine if messages had been consumed in the session, and
+         // prepared but not committed. Then the connection was explicitly closed causing the
+         // session to close. Closing the session causes any outstanding delivered but unacked
+         // messages to be cancelled to the server which means they would be available for other
+         // consumers to consume. If another consumer then consumes them, then recover() is called
+         // and the original transaction is committed, then this means the same message has been
+         // delivered twice which breaks the once and only once delivery guarantee.
+         
+         if (rm.checkForAcksInSession(state.getSessionID()))
+         {
+            throw new IllegalStateException(
+               "Attempt to close an XASession when there are still uncommitted acknowledgements!");
+         }        
+      }
+            
+      int ackMode = state.getAcknowledgeMode();
+  
+      //We need to either ack (for auto_ack) or cancel (for client_ack)
+      //any deliveries - this is because the message listener might have closed
+      //before on message had finished executing
+      
+      if (ackMode == Session.AUTO_ACKNOWLEDGE)
+      {
+         //Acknowledge or cancel any outstanding auto ack
+         
+         DeliveryInfo remainingAutoAck = state.getAutoAckInfo();
+         
+         if (remainingAutoAck != null)
+         {
+            if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
+            
+            try
+            {
+               ackDelivery(del, remainingAutoAck);
+               
+               if (trace) { log.trace(this + " acked it"); }               
+            }
+            finally
+            {                        
+               state.setAutoAckInfo(null);
+            }
+         }
+      }
+      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+      {
+         //Ack any remaining deliveries
+                          
+         if (!state.getClientAckList().isEmpty())
+         {               
+            try
+            {
+               del.acknowledgeDeliveries(state.getClientAckList());
+            }
+            finally
+            {            
+               state.getClientAckList().clear();
+               
+               state.setAutoAckInfo(null);
+            }
+         }
+      }
+      else if (ackMode == Session.CLIENT_ACKNOWLEDGE)
+      {
+         // Cancel any oustanding deliveries
+         // 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.
+                  
+         // CLIENT_ACKNOWLEDGE cannot be used with MDBs (i.e. no connection consumer)
+         // so is always safe to cancel on this session                  
+         
+         cancelDeliveries(del, state.getClientAckList());
+         
+         state.getClientAckList().clear();
+      }
+      else if (state.isTransacted() && !state.isXA())
+      {
+         //We need to explicitly cancel any deliveries back to the server
+         //from the resource manager, otherwise delivery count won't be updated
+         
+         ConnectionState connState = (ConnectionState)state.getParent();
+         
+         ResourceManager rm = connState.getResourceManager();
+         
+         List dels = rm.getDeliveriesForSession(state.getSessionID());
+         
+         cancelDeliveries(del, dels);        
+      }
+            
+      
+      return invocation.invokeNext();
+   }      
+   
+   public Object handleClose(Invocation invocation) throws Throwable
+   {      
+      Object res = invocation.invokeNext();
+      
+      SessionState state = getState(invocation);
+
+      ConnectionState connState = (ConnectionState)state.getParent();
+
+      Object xid = state.getCurrentTxId();
+
+      if (xid != null)
+      {
+         //Remove transaction from the resource manager
+         connState.getResourceManager().removeTx(xid);
+      }
+
+      // We must explicitly shutdown the executor
+
+      state.getExecutor().shutdownNow();
+
+      return res;
+   }
+   
+   public Object handlePreDeliver(Invocation invocation) throws Throwable
+   { 
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      
+      int ackMode = state.getAcknowledgeMode();
+      
+      Object[] args = mi.getArguments();
+      DeliveryInfo info = (DeliveryInfo)args[0];
+      
+      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
+      {
+         // We collect acknowledgments in the list
+         
+         if (trace) { log.trace(this + " added to CLIENT_ACKNOWLEDGE list delivery " + info); }
+         
+         // Sanity check
+         if (info.getConnectionConsumerSession() != null)
+         {
+            throw new IllegalStateException(
+               "CLIENT_ACKNOWLEDGE cannot be used with a connection consumer");
+         }
+                  
+         state.getClientAckList().add(info);
+      }
+      else if (ackMode == Session.AUTO_ACKNOWLEDGE)
+      {
+         // We collect the single acknowledgement in the state. 
+                           
+         if (trace) { log.trace(this + " added " + info + " to session state"); }
+         
+         state.setAutoAckInfo(info);         
+      }
+      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+      {
+         if (trace) { log.trace(this + " added to DUPS_OK_ACKNOWLEDGE list delivery " + info); }
+         
+         state.getClientAckList().add(info);
+         
+         //Also set here - this would be used for recovery in a message listener
+         state.setAutoAckInfo(info);
+      }
+      else
+      {             
+         Object txID = state.getCurrentTxId();
+   
+         if (txID != null)
+         {
+            // the session is non-XA and transacted, or XA and enrolled in a global transaction. An
+            // XA session that has not been enrolled in a global transaction behaves as a
+            // transacted session.
+            
+            ConnectionState connState = (ConnectionState)state.getParent();
+   
+            if (trace) { log.trace("sending acknowlegment transactionally, queueing on resource manager"); }
+   
+            // If the ack is for a delivery that came through via a connection consumer then we use
+            // the connectionConsumer session as the session id, otherwise we use this sessions'
+            // session ID
+            
+            ClientSessionDelegate connectionConsumerDelegate =
+               (ClientSessionDelegate)info.getConnectionConsumerSession();
+            
+            int sessionId = connectionConsumerDelegate != null ?
+               connectionConsumerDelegate.getID() : state.getSessionID();
+            
+            connState.getResourceManager().addAck(txID, sessionId, info);
+         }        
+      }
+      
+      return null;
+   }
+   
+   public Object handlePostDeliver(Invocation invocation) throws Throwable
+   { 
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      
+      int ackMode = state.getAcknowledgeMode();
+      
+      if (ackMode == Session.AUTO_ACKNOWLEDGE)
+      {
+         // We auto acknowledge.
+
+         SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
+
+         // It is possible that session.recover() is called inside a message listener onMessage
+         // method - i.e. between the invocations of preDeliver and postDeliver. In this case we
+         // don't want to acknowledge the last delivered messages - since it will be redelivered.
+         if (!state.isRecoverCalled())
+         {
+            DeliveryInfo delivery = state.getAutoAckInfo();
+            
+            if (delivery == null)
+            {
+               throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
+            }
+                                 
+            if (trace) { log.trace(this + " auto acknowledging delivery " + delivery); }
+              
+
+            // We clear the state in a finally so then we don't get a knock on
+            // exception on the next ack since we haven't cleared the state. See
+            // http://jira.jboss.org/jira/browse/JBMESSAGING-852
+
+            //This is ok since the message is acked after delivery, then the client
+            //could get duplicates anyway
+            
+            try
+            {
+               ackDelivery(sd, delivery);
+            }
+            finally
+            {
+               state.setAutoAckInfo(null);               
+            }
+         }         
+         else
+         {
+            if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
+
+            state.setRecoverCalled(false);
+         }
+      }
+      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+      {
+         List acks = state.getClientAckList();
+         
+         if (!state.isRecoverCalled())
+         {
+            if (acks.size() >= state.getDupsOKBatchSize())
+            {
+               // We clear the state in a finally
+               // http://jira.jboss.org/jira/browse/JBMESSAGING-852
+   
+               SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
+                                          
+               try
+               {
+                  sd.acknowledgeDeliveries(acks);
+               }
+               finally
+               {                  
+                  acks.clear();
+                  state.setAutoAckInfo(null);
+               }
+            }    
+         }
+         else
+         {
+            if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
+
+            state.setRecoverCalled(false);
+         }
+         state.setAutoAckInfo(null);
+                  
+      }
+
+      return null;
+   }
+   
+   /**
+    * Used for client acknowledge.
+    */
+   public Object handleAcknowledgeAll(Invocation invocation) throws Throwable
+   {    
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();            
+    
+      if (!state.getClientAckList().isEmpty())
+      {                 
+         //CLIENT_ACKNOWLEDGE can't be used with a MDB so it is safe to always acknowledge all
+         //on this session (rather than the connection consumer session)
+         del.acknowledgeDeliveries(state.getClientAckList());
+      
+         state.getClientAckList().clear();
+      }      
+        
+      return null;
+   }
+                       
+   /*
+    * Called when session.recover is called
+    */
+   public Object handleRecover(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("recover called"); }
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+            
+      SessionState state = getState(invocation);
+      
+      if (state.isTransacted())
+      {
+         throw new IllegalStateException("Cannot recover a transacted session");
+      }
+      
+      if (trace) { log.trace("recovering the session"); }
+       
+      //Call redeliver
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
+      
+      int ackMode = state.getAcknowledgeMode();
+      
+      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
+      {
+         List dels = state.getClientAckList();
+         
+         state.setClientAckList(new ArrayList());
+         
+         del.redeliver(dels);
+      }
+      else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+      {
+         DeliveryInfo info = state.getAutoAckInfo();
+         
+         //Don't recover if it's already to cancel
+         
+         if (info != null)
+         {
+            List redels = new ArrayList();
+            
+            redels.add(info);
+            
+            del.redeliver(redels);
+            
+            state.setAutoAckInfo(null);            
+         }
+      }   
+        
+      state.setRecoverCalled(true);
+      
+      return null;  
+   }
+   
+   /**
+    * Redelivery occurs in two situations:
+    *
+    * 1) When session.recover() is called (JMS1.1 4.4.11)
+    *
+    * "A session's recover method is used to stop a session and restart it with its first
+    * unacknowledged message. In effect, the session's series of delivered messages is reset to the
+    * point after its last acknowledged message."
+    *
+    * An important note here is that session recovery is LOCAL to the session. Session recovery DOES
+    * NOT result in delivered messages being cancelled back to the channel where they can be
+    * redelivered - since that may result in them being picked up by another session, which would
+    * break the semantics of recovery as described in the spec.
+    *
+    * 2) When session rollback occurs (JMS1.1 4.4.7). On rollback of a session the spec is clear
+    * that session recovery occurs:
+    *
+    * "If a transaction rollback is done, its produced messages are destroyed and its consumed
+    * messages are automatically recovered. For more information on session recovery, see Section
+    * 4.4.11 'Message Acknowledgment.'"
+    *
+    * So on rollback we do session recovery (local redelivery) in the same as if session.recover()
+    * was called.
+    * 
+    * All cancellation at rollback is driven from the client side - we always attempt to redeliver
+    * messages to their original consumers if they are still open, or then cancel them to the server
+    * if they are not. Cancelling them to the server explicitly allows the delivery count to be updated.
+    * 
+    * 
+    */
+   public Object handleRedeliver(Invocation invocation) throws Throwable
+   {            
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);            
+            
+      // We put the messages back in the front of their appropriate consumer buffers
+      
+      List toRedeliver = (List)mi.getArguments()[0];
+       
+      if (trace) { log.trace(this + " handleRedeliver() called: " + toRedeliver); }
+      
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
+      
+      // Need to be redelivered in reverse order.
+      for (int i = toRedeliver.size() - 1; i >= 0; i--)
+      {
+         DeliveryInfo info = (DeliveryInfo)toRedeliver.get(i);
+         MessageProxy proxy = info.getMessageProxy();        
+         
+         MessageCallbackHandler handler = state.getCallbackHandler(info.getConsumerId());
+              
+         if (handler == null)
+         {
+            // This is ok. The original consumer has closed, so we cancel the message
+            
+            //FIXME - this needs to be done atomically for all cancels
+            
+            cancelDelivery(del, info);
+         }
+         else
+         {
+            if (trace) { log.trace("Adding proxy back to front of buffer"); }
+            
+            handler.addToFrontOfBuffer(proxy);
+         }                                    
+      }
+              
+      return null;  
+   }
+   
+   public Object handleCommit(Invocation invocation) throws Throwable
+   {
+      SessionState state = getState(invocation);
+
+      if (!state.isTransacted())
+      {
+         throw new IllegalStateException("Cannot commit a non-transacted session");
+      }
+
+      if (state.isXA())
+      {
+         throw new TransactionInProgressException("Cannot call commit on an XA session");
+      }
+
+      ConnectionState connState = (ConnectionState)state.getParent();
+      ConnectionDelegate conn = (ConnectionDelegate)connState.getDelegate();
+  
+      try
+      {
+         connState.getResourceManager().commitLocal((LocalTx)state.getCurrentTxId(), conn);
+      }
+      finally
+      {
+         //Start new local tx
+         Object xid = connState.getResourceManager().createLocalTx();
+
+         state.setCurrentTxId(xid);
+      }
+      
+      //TODO on commit we don't want to ACK any messages that have exceeded the max delivery count OR
+
+      return null;
+   }
+
+   public Object handleRollback(Invocation invocation) throws Throwable
+   {
+      SessionState state = getState(invocation);
+
+      if (!state.isTransacted())
+      {
+         throw new IllegalStateException("Cannot rollback a non-transacted session");
+      }
+
+      if (state.isXA())
+      {
+         throw new TransactionInProgressException("Cannot call rollback on an XA session");
+      }
+      
+      ConnectionState connState = (ConnectionState)state.getParent();
+      ResourceManager rm = connState.getResourceManager();
+      try
+      {
+         rm.rollbackLocal((LocalTx)state.getCurrentTxId());
+      }
+      finally
+      {
+         // start new local tx
+         Object xid = rm.createLocalTx();
+         state.setCurrentTxId(xid);
+      }
+
+      return null;
+   }
+   
+   public Object handleSend(Invocation invocation) throws Throwable
+   {
+      SessionState state = getState(invocation);
+      Object txID = state.getCurrentTxId();
+
+      if (txID != null)
+      {
+         // the session is non-XA and transacted, or XA and enrolled in a global transaction, so
+         // we add the message to a transaction instead of sending it now. An XA session that has
+         // not been enrolled in a global transaction behaves as a non-transacted session.
+
+         ConnectionState connState = (ConnectionState)state.getParent();
+         MethodInvocation mi = (MethodInvocation)invocation;
+         Message m = (Message)mi.getArguments()[0];
+
+         if (trace) { log.trace("sending message " + m + " transactionally, queueing on resource manager txID=" + txID + " sessionID= " + state.getSessionID()); }
+
+         connState.getResourceManager().addMessage(txID, state.getSessionID(), (JBossMessage)m);
+
+         // ... and we don't invoke any further interceptors in the stack
+         return null;
+      }
+
+      if (trace) { log.trace("sending message NON-transactionally"); }
+
+      return invocation.invokeNext();
+   }
+   
+   public Object handleGetXAResource(Invocation invocation) throws Throwable
+   {
+      return getState(invocation).getXAResource();
+   }
+   
+   public Object handleGetTransacted(Invocation invocation) throws Throwable
+   {
+      return getState(invocation).isTransacted() ? Boolean.TRUE : Boolean.FALSE;
+   }
+   
+   public Object handleGetAcknowledgeMode(Invocation invocation) throws Throwable
+   {
+      return new Integer(getState(invocation).getAcknowledgeMode());
+   }
+   
+   public Object handleCreateMessage(Invocation invocation) throws Throwable
+   {
+      JBossMessage jbm = new JBossMessage(0);
+       
+      return new MessageProxy(jbm);
+   }
+   
+   public Object handleCreateBytesMessage(Invocation invocation) throws Throwable
+   {
+      JBossBytesMessage jbm = new JBossBytesMessage(0);
+         
+      return new BytesMessageProxy(jbm);
+   }
+   
+   public Object handleCreateMapMessage(Invocation invocation) throws Throwable
+   {
+      JBossMapMessage jbm = new JBossMapMessage(0);
+       
+      return new MapMessageProxy(jbm);      
+   }
+   
+   public Object handleCreateObjectMessage(Invocation invocation) throws Throwable
+   {
+      JBossObjectMessage jbm = new JBossObjectMessage(0);
+       
+      MethodInvocation mi = (MethodInvocation)invocation;
+      
+      if (mi.getArguments() != null && mi.getArguments().length > 0)
+      {
+         jbm.setObject((Serializable)mi.getArguments()[0]);
+      }
+      
+      return new ObjectMessageProxy(jbm);
+   }
+   
+   public Object handleCreateStreamMessage(Invocation invocation) throws Throwable
+   {
+      JBossStreamMessage jbm = new JBossStreamMessage(0);
+      
+      return new StreamMessageProxy(jbm);
+   }
+   
+   public Object handleCreateTextMessage(Invocation invocation) throws Throwable
+   {  
+      JBossTextMessage jbm = new JBossTextMessage(0);
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+
+      if (mi.getArguments() != null && mi.getArguments().length > 0)
+      {
+         jbm.setText((String)mi.getArguments()[0]);
+      }
+      
+      return new TextMessageProxy(jbm);
+   }   
+   
+   
+   
+   public Object handleSetMessageListener(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("setMessageListener()"); }
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+      
+      MessageListener listener = (MessageListener)mi.getArguments()[0];
+      
+      if (listener == null)
+      {
+         throw new IllegalStateException("Cannot set a null MessageListener on the session");
+      }
+      
+      getState(invocation).setDistinguishedListener(listener);
+      
+      return null;
+   }
+   
+   public Object handleGetMessageListener(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("getMessageListener()"); }
+      
+      return getState(invocation).getDistinguishedListener();
+   }
+   
+   public Object handleCreateConnectionConsumer(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("createConnectionConsumer()"); }
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+      
+      JBossDestination dest = (JBossDestination)mi.getArguments()[0];
+      String subscriptionName = (String)mi.getArguments()[1];
+      String messageSelector = (String)mi.getArguments()[2];
+      ServerSessionPool sessionPool = (ServerSessionPool)mi.getArguments()[3];
+      int maxMessages = ((Integer)mi.getArguments()[4]).intValue();
+      
+      return new JBossConnectionConsumer((ConnectionDelegate)mi.getTargetObject(), dest,
+                                         subscriptionName, messageSelector, sessionPool,
+                                         maxMessages);
+   }
+   
+   public Object handleAddAsfMessage(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("addAsfMessage()"); }
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+      
+      // Load the session with a message to be processed during a subsequent call to run()
+
+      MessageProxy m = (MessageProxy)mi.getArguments()[0];
+      int theConsumerID = ((Integer)mi.getArguments()[1]).intValue();
+      String queueName = (String)mi.getArguments()[2];
+      int maxDeliveries = ((Integer)mi.getArguments()[3]).intValue();
+      SessionDelegate connectionConsumerDelegate = ((SessionDelegate)mi.getArguments()[4]);
+      
+      if (m == null)
+      {
+         throw new IllegalStateException("Cannot add a null message to the session");
+      }
+
+      AsfMessageHolder holder = new AsfMessageHolder();
+      holder.msg = m;
+      holder.consumerID = theConsumerID;
+      holder.queueName = queueName;
+      holder.maxDeliveries = maxDeliveries;
+      holder.connectionConsumerDelegate = connectionConsumerDelegate;
+      
+      getState(invocation).getASFMessages().add(holder);
+      
+      return null;
+   }
+
+   public Object handleRun(Invocation invocation) throws Throwable
+   {
+      if (trace) { log.trace("run()"); }
+      
+      MethodInvocation mi = (MethodInvocation)invocation;
+            
+      //This is the delegate for the session from the pool
+      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
+      
+      SessionState state = getState(invocation);
+      
+      int ackMode = state.getAcknowledgeMode();
+
+      LinkedList msgs = state.getASFMessages();
+      
+      while (msgs.size() > 0)
+      {
+         AsfMessageHolder holder = (AsfMessageHolder)msgs.removeFirst();
+
+         if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
+         
+         MessageCallbackHandler.callOnMessage(del, state.getDistinguishedListener(), holder.consumerID,
+                                              holder.queueName, false,
+                                              holder.msg, ackMode, holder.maxDeliveries,
+                                              holder.connectionConsumerDelegate);                          
+      }
+      
+      return null;
+   }
+   
+   
+
+   public String toString()
+   {
+      return "SessionAspect[" + Integer.toHexString(hashCode()) + "]";
+   }
+
+   
+
+   // Class YYY overrides -------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Package Private -----------------------------------------------
+
+   // Private -------------------------------------------------------
+   
+   private SessionState getState(Invocation inv)
+   {
+      return (SessionState)((DelegateSupport)inv.getTargetObject()).getState();
+   }
+   
+   private void ackDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
+   {
+      SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
+      
+      //If the delivery was obtained via a connection consumer we need to ack via that
+      //otherwise we just use this session
+      
+      SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
+      
+      sessionToUse.acknowledgeDelivery(delivery);      
+   }
+   
+   private void cancelDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
+   {
+      SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
+      
+      //If the delivery was obtained via a connection consumer we need to cancel via that
+      //otherwise we just use this session
+      
+      SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
+      
+      sessionToUse.cancelDelivery(new DefaultCancel(delivery.getDeliveryID(),
+                                  delivery.getMessageProxy().getDeliveryCount(), false, false));      
+   }
+   
+   private void cancelDeliveries(SessionDelegate del, List deliveryInfos) throws Exception
+   {
+      List cancels = new ArrayList();
+      
+      for (Iterator i = deliveryInfos.iterator(); i.hasNext(); )
+      {
+         DeliveryInfo ack = (DeliveryInfo)i.next();            
+         
+         DefaultCancel cancel = new DefaultCancel(ack.getMessageProxy().getDeliveryId(),
+                                                  ack.getMessageProxy().getDeliveryCount(),
+                                                  false, false);
+         
+         cancels.add(cancel);
+      }  
+      
+      if (!cancels.isEmpty())
+      {
+         del.cancelDeliveries(cancels);
+      }
+   }
+
+   // Inner Classes -------------------------------------------------
+   
+   private static class AsfMessageHolder
+   {
+      private MessageProxy msg;
+      private int consumerID;
+      private String queueName;
+      private int maxDeliveries;
+      private SessionDelegate connectionConsumerDelegate;
+   }
+   
+}
+

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/ServerPeer.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,1601 +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;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.jms.InvalidClientIDException;
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.transaction.xa.Xid;
-
-import org.jboss.aop.AspectXmlLoader;
-import org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper;
-import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
-import org.jboss.jms.server.connectormanager.SimpleConnectorManager;
-import org.jboss.jms.server.destination.ManagedQueue;
-import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
-import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
-import org.jboss.jms.server.messagecounter.MessageCounter;
-import org.jboss.jms.server.messagecounter.MessageCounterManager;
-import org.jboss.jms.server.plugin.contract.JMSUserManager;
-import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
-import org.jboss.jms.server.remoting.JMSWireFormat;
-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.message.SimpleMessageStore;
-import org.jboss.messaging.core.plugin.IDManager;
-import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
-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.messaging.core.plugin.contract.ReplicationListener;
-import org.jboss.messaging.core.plugin.contract.Replicator;
-import org.jboss.messaging.core.plugin.postoffice.Binding;
-import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
-import org.jboss.messaging.core.plugin.postoffice.cluster.FailoverStatus;
-import org.jboss.messaging.core.tx.TransactionRepository;
-import org.jboss.messaging.util.Util;
-import org.jboss.mx.loading.UnifiedClassLoader3;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.system.ServiceCreator;
-import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.util.JBossStringBuilder;
-import org.w3c.dom.Element;
-
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
-
-/**
- * A JMS server peer.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
- * 
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ServerPeer extends ServiceMBeanSupport implements ServerPeerMBean
-{
-   // Constants ------------------------------------------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(ServerPeer.class);
-
-   // The "subsystem" label this ServerPeer uses to register its ServerInvocationHandler with the
-   // Remoting connector
-   public static final String REMOTING_JMS_SUBSYSTEM = "JMS";
-
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   private int serverPeerID;
-   private byte[] clientAOPStack;
-   private Version version;
-
-   private String defaultQueueJNDIContext;
-   private String defaultTopicJNDIContext;
-
-   private boolean started;
-
-   private int objectIDSequence = 1;
-
-   // The default maximum number of delivery attempts before sending to DLQ - can be overridden on
-   // the destination
-   private int defaultMaxDeliveryAttempts = 10;
-
-   private Object failoverStatusLock;
-   
-   // Default is 1 minute
-   private long failoverStartTimeout = 60 * 1000;
-   
-   // Default is 5 minutes
-   private long failoverCompleteTimeout = 5 * 60 * 1000;
-   
-   private Map sessions;
-   
-   private long defaultRedeliveryDelay;
-   
-   private long queueStatsSamplePeriod = 10000;
-   
-   private int defaultMessageCounterHistoryDayLimit;
-      
-   // wired components
-
-   private DestinationJNDIMapper destinationJNDIMapper;
-   private SecurityMetadataStore securityStore;
-   private ConnectionFactoryJNDIMapper connFactoryJNDIMapper;
-   private TransactionRepository txRepository;
-   private ConnectionManager connectionManager;
-   private ConnectorManager connectorManager;
-   private IDManager messageIDManager;
-   private IDManager channelIDManager;
-   private IDManager transactionIDManager;
-   private MemoryManager memoryManager;  
-   private MessageStore messageStore;
-   private MessageCounterManager messageCounterManager;
-
-   // plugins
-
-   protected ObjectName persistenceManagerObjectName;
-   protected PersistenceManager persistenceManager;
-
-   protected ObjectName postOfficeObjectName;
-   protected PostOffice postOffice;
-
-   protected ObjectName jmsUserManagerObjectName;
-   protected JMSUserManager jmsUserManager;
-   
-   protected ObjectName defaultDLQObjectName;
-   protected Queue defaultDLQ;
-   
-   protected ObjectName defaultExpiryQueueObjectName;
-   protected Queue defaultExpiryQueue;
-
-   //Other stuff
-
-   private JMSServerInvocationHandler handler;
-
-   // Constructors ---------------------------------------------------------------------------------
-
-   public ServerPeer(int serverPeerID,
-                     String defaultQueueJNDIContext,
-                     String defaultTopicJNDIContext) throws Exception
-   {
-      if (serverPeerID < 0)
-      {
-         throw new IllegalArgumentException("ID cannot be negative");
-      }
-      
-      log.info(this + " creating server peer with ID " + serverPeerID);
-
-      this.serverPeerID = serverPeerID;
-      this.defaultQueueJNDIContext = defaultQueueJNDIContext;
-      this.defaultTopicJNDIContext = defaultTopicJNDIContext;
-
-      // Some wired components need to be started here
-      securityStore = new SecurityMetadataStore();
-
-      version = Version.instance();
-      
-      failoverStatusLock = new Object();
-      
-      sessions = new ConcurrentReaderHashMap();
-
-      started = false;
-   }      
-
-   // ServiceMBeanSupport overrides ----------------------------------------------------------------
-
-   public synchronized void startService() throws Exception
-   {
-      try
-      {
-         log.debug("starting ServerPeer");
-
-         if (started)
-         {
-            return;
-         }
-
-         log.debug(this + " starting");
-
-         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);
-         transactionIDManager = new IDManager("TRANSACTION_ID", 1024, persistenceManager);
-         destinationJNDIMapper = new DestinationJNDIMapper(this);
-         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
-         connectionManager = new SimpleConnectionManager();
-         connectorManager = new SimpleConnectorManager();
-         memoryManager = new SimpleMemoryManager();
-         messageStore = new SimpleMessageStore();
-         txRepository =
-            new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
-         messageCounterManager = new MessageCounterManager(queueStatsSamplePeriod);
-
-         // Start the wired components
-
-         messageIDManager.start();
-         channelIDManager.start();
-         transactionIDManager.start();
-         destinationJNDIMapper.start();
-         connFactoryJNDIMapper.start();
-         connectionManager.start();
-         connectorManager.start();
-         memoryManager.start();
-         messageStore.start();
-         securityStore.start();
-         txRepository.start();
-         
-         // Note we do not start the message counter manager by default. This must be done
-         // explicitly by the user by calling enableMessageCounters(). This is because message
-         // counter history takes up growing memory to store the stats and could theoretically
-         // eventually cause the server to run out of RAM
-         
-         txRepository.loadPreparedTransactions();
-         
-         initializeRemoting(mbeanServer);
-
-         started = true;
-
-         log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
-            getServerPeerID()+ "] started");
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
-      }
-   }
-
-   public synchronized void stopService() throws Exception
-   {
-      try
-      {
-         if (!started)
-         {
-            return;
-         }
-
-         log.debug(this + " stopping");
-
-         started = false;
-
-         // Stop the wired components
-
-         messageIDManager.stop();
-         messageIDManager = null;
-         channelIDManager.stop();
-         channelIDManager = null;
-         transactionIDManager.stop();
-         transactionIDManager = null;
-         destinationJNDIMapper.stop();
-         destinationJNDIMapper = null;
-         connFactoryJNDIMapper.stop();
-         connFactoryJNDIMapper = null;
-         connectionManager.stop();
-         connectionManager = null;
-         connectorManager.start();
-         connectorManager = null;
-         memoryManager.stop();
-         memoryManager = null;
-         messageStore.stop();
-         messageStore = null;
-         securityStore.stop();
-         securityStore = null;
-         txRepository.stop();
-         txRepository = null;
-         messageCounterManager.stop();
-         messageCounterManager = null;
-
-         unloadServerAOPConfig();
-
-         // TODO unloadClientAOPConfig();
-
-         MessagingTimeoutFactory.instance.reset();
-
-         log.info("JMS " + this + " stopped");
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
-      }
-   }
-
-   // JMX Attributes -------------------------------------------------------------------------------
-
-   // Plugins
-   
-   public synchronized ObjectName getPersistenceManager()
-   {
-      return persistenceManagerObjectName;
-   }
-
-   public synchronized void setPersistenceManager(ObjectName on)
-   {
-      if (started)
-      {
-         log.warn("Cannot set persistence manager on server peer when server peer is started");
-         return;         
-      }
-      persistenceManagerObjectName = on;
-   }
-
-   public synchronized ObjectName getPostOffice()
-   {
-      return postOfficeObjectName;
-   }
-
-   public synchronized void setPostOffice(ObjectName on)
-   {
-      if (started)
-      {
-         log.warn("Cannot set post office on server peer when server peer is started");
-         return;         
-      }
-      postOfficeObjectName = on;
-   }
-
-   public synchronized ObjectName getJmsUserManager()
-   {
-      return jmsUserManagerObjectName;
-   }
-
-   public synchronized void setJMSUserManager(ObjectName on)
-   {
-      if (started)
-      {
-         log.warn("Cannot set jms user manager on server peer when server peer is started");
-         return;         
-      }
-      jmsUserManagerObjectName = on;
-   }
-   
-   public synchronized ObjectName getDefaultDLQ()
-   {
-      return defaultDLQObjectName;
-   }
-
-   public synchronized void setDefaultDLQ(ObjectName on)
-   {
-      defaultDLQObjectName = on;
-   }
-   
-   public synchronized ObjectName getDefaultExpiryQueue()
-   {
-      return defaultExpiryQueueObjectName;
-   }
-
-   public synchronized void setDefaultExpiryQueue(ObjectName on)
-   {
-      this.defaultExpiryQueueObjectName = on;
-   }     
-      
-   // Instance access
-
-   public Object getInstance()
-   {
-      return this;
-   }
-   
-   //read only JMX attributes
-
-   public String getJMSVersion()
-   {
-      return version.getJMSVersion();
-   }
-
-   public int getJMSMajorVersion()
-   {
-      return version.getJMSMajorVersion();
-   }
-
-   public int getJMSMinorVersion()
-   {
-      return version.getJMSMinorVersion();
-   }
-
-   public String getJMSProviderName()
-   {
-      return version.getJMSProviderName();
-   }
-
-   public String getProviderVersion()
-   {
-      return version.getProviderVersion();
-   }
-
-   public int getProviderMajorVersion()
-   {
-      return version.getProviderMajorVersion();
-   }
-
-   public int getProviderMinorVersion()
-   {
-      return version.getProviderMinorVersion();
-   }
-
-   public int getServerPeerID()
-   {
-      return serverPeerID;
-   }
-
-   public String getDefaultQueueJNDIContext()
-   {
-      return defaultQueueJNDIContext;
-   }
-
-   public String getDefaultTopicJNDIContext()
-   {
-      return defaultTopicJNDIContext;
-   }
-   
-   //Read - write attributes
-
-   public synchronized void setSecurityDomain(String securityDomain) throws Exception
-   {
-      try
-      {
-         securityStore.setSecurityDomain(securityDomain);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " setSecurityDomain");
-      }
-   }
-
-   public synchronized String getSecurityDomain()
-   {
-      return securityStore.getSecurityDomain();
-   }
-
-   public synchronized void setDefaultSecurityConfig(Element conf) throws Exception
-   {
-      securityStore.setDefaultSecurityConfig(conf);
-   }
-
-   public synchronized Element getDefaultSecurityConfig()
-   {
-      return securityStore.getDefaultSecurityConfig();
-   }
-        
-   public synchronized long getFailoverStartTimeout()
-   {
-      return this.failoverStartTimeout;
-   }
-   
-   public synchronized void setFailoverStartTimeout(long timeout)
-   {
-      this.failoverStartTimeout = timeout;
-   }
-   
-   public synchronized long getFailoverCompleteTimeout()
-   {
-      return this.failoverCompleteTimeout;
-   }
-   
-   public synchronized void setFailoverCompleteTimeout(long timeout)
-   {
-      this.failoverCompleteTimeout = timeout;
-   }
-   
-   public synchronized int getDefaultMaxDeliveryAttempts()
-   {
-      return defaultMaxDeliveryAttempts;
-   }
-
-   public synchronized void setDefaultMaxDeliveryAttempts(int attempts)
-   {
-      this.defaultMaxDeliveryAttempts = attempts;
-   }
-   
-   public synchronized long getQueueStatsSamplePeriod()
-   {
-      return queueStatsSamplePeriod;
-   }
-
-   public synchronized void setQueueStatsSamplePeriod(long newPeriod)
-   {
-      if (newPeriod < 1000)
-      {
-         throw new IllegalArgumentException("Cannot set QueueStatsSamplePeriod < 1000 ms");
-      }
-      
-      if (messageCounterManager != null && newPeriod != queueStatsSamplePeriod)
-      {
-         messageCounterManager.reschedule(newPeriod);
-      }            
-      
-      this.queueStatsSamplePeriod = newPeriod;
-   }
-   
-   public synchronized long getDefaultRedeliveryDelay()
-   {
-      return defaultRedeliveryDelay;
-   }
-   
-   public synchronized void setDefaultRedeliveryDelay(long delay)
-   {
-      this.defaultRedeliveryDelay = delay;
-   }
-   
-   public synchronized int getDefaultMessageCounterHistoryDayLimit()
-   {
-      return defaultMessageCounterHistoryDayLimit;
-   }
-   
-   public void setDefaultMessageCounterHistoryDayLimit(int limit)
-   {
-      if (limit < -1)
-      {
-         limit = -1;
-      }
-      
-      this.defaultMessageCounterHistoryDayLimit = limit;
-   }
-   
-   public void enableMessageCounters()
-   {      
-      messageCounterManager.start();
-   }
-   
-   public void disableMessageCounters()
-   {
-      messageCounterManager.stop();
-      
-      messageCounterManager.resetAllCounters();
-      
-      messageCounterManager.resetAllCounterHistories();
-   }
-   
-   // JMX Operations -------------------------------------------------------------------------------
-
-   public String deployQueue(String name, String jndiName) throws Exception
-   {
-      try
-      {
-         return deployDestinationDefault(true, name, jndiName);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue");
-      }
-   }
-
-   public String deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
-   {
-      try
-      {
-         return deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue(2)");
-      }
-   }
-
-   public boolean destroyQueue(String name) throws Exception
-   {
-      try
-      {
-         return destroyDestination(true, name);        
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyQueue");
-      }
-   }
-   
-   public boolean undeployQueue(String name) throws Exception
-   {
-      try
-      {
-         return undeployDestination(true, name);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyQueue");
-      }
-   }
-
-   public String deployTopic(String name, String jndiName) throws Exception
-   {
-      try
-      {
-         return deployDestinationDefault(false, name, jndiName);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic");
-      }
-   }
-
-   public String deployTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
-   {
-      try
-      {
-         return deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic(2)");
-      }
-   }
-
-   public boolean destroyTopic(String name) throws Exception
-   {
-      try
-      {
-         return destroyDestination(false, name);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyTopic");
-      }
-   }
-   
-   public boolean undeployTopic(String name) throws Exception
-   {
-      try
-      {
-         return undeployDestination(false, name);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyTopic");
-      }
-   }
-
-   public Set getDestinations() throws Exception
-   {
-      try
-      {
-         return destinationJNDIMapper.getDestinations();
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " getDestinations");
-      }
-   }
-   
-   public List getMessageCounters() throws Exception
-   {
-      Collection counters = messageCounterManager.getMessageCounters();
-      
-      return new ArrayList(counters);
-   }
-
-   public List getMessageStatistics() throws Exception
-   {
-      return MessageCounter.getMessageStatistics(getMessageCounters());
-   }
-
-   public String listMessageCountersAsHTML() throws Exception
-   {
-      List counters = getMessageCounters();
-
-      String ret =
-         "<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">"
-            + "<tr>"
-            + "<th>Type</th>"
-            + "<th>Name</th>"
-            + "<th>Subscription</th>"
-            + "<th>Durable</th>"
-            + "<th>Count</th>"
-            + "<th>CountDelta</th>"
-            + "<th>Depth</th>"
-            + "<th>DepthDelta</th>"
-            + "<th>Last Add</th>"
-            + "</tr>";
-
-      String strNameLast = null;
-      String strTypeLast = null;
-      String strDestLast = null;
-
-      String destData = "";
-      int destCount = 0;
-
-      int countTotal = 0;
-      int countDeltaTotal = 0;
-      int depthTotal = 0;
-      int depthDeltaTotal = 0;
-
-      int i = 0; // define outside of for statement, so variable
-      // still exists after for loop, because it is
-      // needed during output of last module data string
-
-      Iterator iter = counters.iterator();
-      
-      while (iter.hasNext())
-      {
-         MessageCounter counter = (MessageCounter)iter.next();
-         
-         // get counter data
-         StringTokenizer tokens = new StringTokenizer(counter.getCounterAsString(), ",");
-
-         String strType = tokens.nextToken();
-         String strName = tokens.nextToken();
-         String strSub = tokens.nextToken();
-         String strDurable = tokens.nextToken();
-
-         String strDest = strType + "-" + strName;
-
-         String strCount = tokens.nextToken();
-         String strCountDelta = tokens.nextToken();
-         String strDepth = tokens.nextToken();
-         String strDepthDelta = tokens.nextToken();
-         String strDate = tokens.nextToken();
-
-         // update total count / depth values
-         countTotal += Integer.parseInt(strCount);
-         depthTotal += Integer.parseInt(strDepth);
-
-         countDeltaTotal += Integer.parseInt(strCountDelta);
-         depthDeltaTotal += Integer.parseInt(strDepthDelta);
-
-         if (strCountDelta.equalsIgnoreCase("0"))
-            strCountDelta = "-"; // looks better
-
-         if (strDepthDelta.equalsIgnoreCase("0"))
-            strDepthDelta = "-"; // looks better
-
-         // output destination counter data as HTML table row
-         // ( for topics with multiple subscriptions output
-         //   type + name field as rowspans, looks better )
-         if (strDestLast != null && strDestLast.equals(strDest))
-         {
-            // still same destination -> append destination subscription data
-            destData += "<tr bgcolor=\"#" + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0") + "\">";
-            destCount += 1;
-         }
-         else
-         {
-            // start new destination data
-            if (strDestLast != null)
-            {
-               // store last destination data string
-               ret += "<tr bgcolor=\"#"
-                  + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
-                  + "\"><td rowspan=\""
-                  + destCount
-                  + "\">"
-                  + strTypeLast
-                  + "</td><td rowspan=\""
-                  + destCount
-                  + "\">"
-                  + strNameLast
-                  + "</td>"
-                  + destData;
-
-               destData = "";
-            }
-
-            destCount = 1;
-         }
-
-         // counter data row
-         destData += "<td>"
-            + strSub
-            + "</td>"
-            + "<td>"
-            + strDurable
-            + "</td>"
-            + "<td>"
-            + strCount
-            + "</td>"
-            + "<td>"
-            + strCountDelta
-            + "</td>"
-            + "<td>"
-            + strDepth
-            + "</td>"
-            + "<td>"
-            + strDepthDelta
-            + "</td>"
-            + "<td>"
-            + strDate
-            + "</td>";
-
-         // store current destination data for change detection
-         strTypeLast = strType;
-         strNameLast = strName;
-         strDestLast = strDest;
-      }
-
-      if (strDestLast != null)
-      {
-         // store last module data string
-         ret += "<tr bgcolor=\"#"
-            + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
-            + "\"><td rowspan=\""
-            + destCount
-            + "\">"
-            + strTypeLast
-            + "</td><td rowspan=\""
-            + destCount
-            + "\">"
-            + strNameLast
-            + "</td>"
-            + destData;
-      }
-
-      // append summation info
-      ret += "<tr>"
-         + "<td><![CDATA[ ]]></td><td><![CDATA[ ]]></td>"
-         + "<td><![CDATA[ ]]></td><td><![CDATA[ ]]></td><td>"
-         + countTotal
-         + "</td><td>"
-         + (countDeltaTotal == 0 ? "-" : Integer.toString(countDeltaTotal))
-         + "</td><td>"
-         + depthTotal
-         + "</td><td>"
-         + (depthDeltaTotal == 0 ? "-" : Integer.toString(depthDeltaTotal))
-         + "</td><td>Total</td></tr></table>";
-
-      return ret;
-   }
-
-   public void resetAllMessageCounters()
-   {
-      messageCounterManager.resetAllCounters();
-   }
-   
-   public void resetAllMessageCounterHistories()
-   {
-      messageCounterManager.resetAllCounterHistories();
-   }
-   
-   public List retrievePreparedTransactions()
-   {
-      return txRepository.getPreparedTransactions();
-   }
-
-   public String showPreparedTransactionsAsHTML()
-   {
-      List txs = txRepository.getPreparedTransactions();
-      JBossStringBuilder buffer = new JBossStringBuilder();
-      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
-      buffer.append("<tr><th>Xid</th></tr>");
-      for (Iterator i = txs.iterator(); i.hasNext();)
-      {
-         Xid xid = (Xid)i.next();
-         if (xid != null)
-         {
-            buffer.append("<tr><td>");
-            buffer.append(xid);
-            buffer.append("</td></tr>");
-         }
-      }
-      buffer.append("</table>");
-      return buffer.toString();
-   }
-   
-   // Public ---------------------------------------------------------------------------------------
-   
-   public byte[] getClientAOPStack()
-   {
-      return clientAOPStack;
-   }
-   
-   public MessageCounterManager getMessageCounterManager()
-   {
-      return messageCounterManager;
-   }
-   
-   public IDManager getMessageIDManager()
-   {
-      return messageIDManager;
-   }
-
-   public IDManager getChannelIDManager()
-   {
-      return channelIDManager;
-   }
-
-   public ServerInvocationHandler getInvocationHandler()
-   {
-      return handler;
-   }
-   
-   public ServerSessionEndpoint getSession(Integer sessionID)
-   {
-      return (ServerSessionEndpoint)sessions.get(sessionID);
-   }
-   
-   public void addSession(Integer id, ServerSessionEndpoint session)
-   {
-      sessions.put(id, session);      
-   }
-   
-   public void removeSession(Integer id)
-   {
-      if (sessions.remove(id) == null)
-      {
-         throw new IllegalStateException("Cannot find session with id " + id + " to remove");
-      }
-   }
-
-   public synchronized Queue getDefaultDLQInstance() throws Exception
-   {
-      Queue dlq = null;
-      
-      if (defaultDLQObjectName != null)
-      { 
-         ManagedQueue dest = null;
-         
-         try
-         {         
-            dest = (ManagedQueue)getServer().
-               getAttribute(defaultDLQObjectName, "Instance");
-         }
-         catch (InstanceNotFoundException e)
-         {
-            //Ok
-         }
-         
-         if (dest != null)
-         {            
-            PostOffice po = getPostOfficeInstance();
-            
-            Binding binding = po.getBindingForQueueName(dest.getName());
-            
-            if (binding != null && binding.getQueue().isActive())
-            {
-               dlq =  binding.getQueue();
-            }
-         }
-      }
-      
-      return dlq;
-   }
-   
-   public synchronized Queue getDefaultExpiryQueueInstance() throws Exception
-   {
-      Queue expiryQueue = null;
-      
-      if (defaultExpiryQueueObjectName != null)
-      {
-         ManagedQueue dest = null;
-         
-         try
-         {         
-            dest = (ManagedQueue)getServer().
-               getAttribute(defaultExpiryQueueObjectName, "Instance");
-         }
-         catch (InstanceNotFoundException e)
-         {
-            //Ok
-         }
-
-         if (dest != null)
-         {            
-            PostOffice po = getPostOfficeInstance();
-            
-            Binding binding = po.getBindingForQueueName(dest.getName());
-            
-            if (binding != null && binding.getQueue().isActive())
-            {
-               expiryQueue =  binding.getQueue();
-            }
-         }
-      }
-      
-      return expiryQueue;
-   }
-
-   public TransactionRepository getTxRepository()
-   {
-      return txRepository;
-   }
-
-   public synchronized boolean isStarted()
-   {
-      return started;
-   }
-
-   public Version getVersion()
-   {
-      return version;
-   }
-
-   // access to hard-wired server extensions
-
-   public SecurityManager getSecurityManager()
-   {
-      return securityStore;
-   }
-
-   public DestinationManager getDestinationManager()
-   {
-      return destinationJNDIMapper;
-   }
-
-   public ConnectionFactoryManager getConnectionFactoryManager()
-   {
-      return connFactoryJNDIMapper;
-   }
-
-   public ConnectionManager getConnectionManager()
-   {
-      return connectionManager;
-   }
-
-   public ConnectorManager getConnectorManager()
-   {
-      return connectorManager;
-   }
-
-   public MessageStore getMessageStore()
-   {
-      return messageStore;
-   }
-
-   public MemoryManager getMemoryManager()
-   {
-      return memoryManager;
-   }
-
-   // access to plugin references
-
-   public PersistenceManager getPersistenceManagerInstance()
-   {
-      return persistenceManager;
-   }
-
-   public JMSUserManager getJmsUserManagerInstance()
-   {
-      return jmsUserManager;
-   }
-
-   public PostOffice getPostOfficeInstance() throws Exception
-   {
-      // We get the reference lazily to avoid problems with MBean circular dependencies
-      if (postOffice == null)
-      {
-         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.
-
-         if (!postOffice.isLocal())
-         {
-            Replicator rep = (Replicator)postOffice;
-            connFactoryJNDIMapper.injectReplicator(rep);            
-            rep.registerListener(new FailoverListener());
-         }
-         
-         // Also need to inject into txRepository
-         txRepository.injectPostOffice(postOffice);
-      }
-      return postOffice;
-   }
-
-   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++;
-   }
-
-   /*
-    * Wait for failover from the specified node to complete.
-    */
-   public int waitForFailover(int failedNodeID) throws Exception
-   {
-      // This node may be failing over for another node - in which case we must wait for that to be
-      // complete.
-      
-      log.debug(this + " waiting for server-side failover for failed node " + failedNodeID + " to complete");
-      
-      Replicator replicator = getReplicator();
-
-      long startToWait = getFailoverStartTimeout();
-      long completeToWait = getFailoverCompleteTimeout();
-                     
-      // Must lock here
-      synchronized (failoverStatusLock)
-      {         
-         while (true)
-         {         
-            //TODO we shouldn't have a dependency on DefaultClusteredPostOffice - where should we put the constants?
-
-            Map replicants = replicator.get(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY);
-            
-            boolean foundEntry = false;
-                        
-            if (replicants != null)
-            {
-               for(Iterator i = replicants.entrySet().iterator(); i.hasNext(); )
-               {
-                  Map.Entry entry = (Map.Entry)i.next();
-                  Integer nid = (Integer)entry.getKey();
-                  FailoverStatus status = (FailoverStatus)entry.getValue();
-                  
-                  if (status.isFailedOverForNode(failedNodeID))
-                  {
-                     log.debug(this + ": failover is complete on node " + nid);
-                     return nid.intValue();
-                  }
-                  else if (status.isFailingOverForNode(failedNodeID))
-                  {
-                     log.debug(this + ": fail over is in progress on node " + nid);
-                     
-                     // A server has started failing over for the failed node, but not completed.
-                     // If it's not this node then we immediately return so the connection can be
-                     // redirected to another node.
-                     if (nid.intValue() != this.getServerPeerID())
-                     {
-                        return nid.intValue();
-                     }
-                     
-                     // Otherwise we wait for failover to complete
-                     
-                     if (completeToWait <= 0)
-                     {
-                        // Give up now
-                        log.debug(this + " already waited long enough for failover to complete, giving up");
-                        return -1;
-                     }
-                     
-                     // Note - we have to count the time since other unrelated nodes may fail and
-                     // wake up the lock - in this case we don't want to give up too early.
-                     long start = System.currentTimeMillis();
-
-                     try
-                     {
-                        log.debug(this + " blocking on the failover lock, waiting for failover to complete");
-                        failoverStatusLock.wait(completeToWait);
-                        log.debug(this + " releasing the failover lock, checking again whether failover completed ...");
-                     }
-                     catch (InterruptedException ignore)
-                     {                  
-                     }
-                     completeToWait -= System.currentTimeMillis() - start;
-                     foundEntry = true;
-                  }
-               }        
-            }
-            
-            if (!foundEntry)
-            {              
-               // No trace of failover happening so we wait a maximum of FAILOVER_START_TIMEOUT for
-               // some replicated data to arrive. This should arrive fairly quickly since this is
-               // added at the beginning of the failover process. If it doesn't arrive it would
-               // imply that no failover has actually happened on the server or the timeout is too
-               // short. It is possible that no failover has actually happened on the server, if for
-               // example there is a problem with the client side network but the server side
-               // network is ok.
-   
-               if (startToWait <= 0)
-               {
-                  // Don't want to wait again
-                  log.debug(this + " already waited long enough for failover to start, giving up");
-                  return -1;
-               }
-               
-               // Note - we have to count the time since other unrelated nodes may fail and wake
-               // up the lock - in this case we don't want to give up too early.
-               long start = System.currentTimeMillis(); 
-               try
-               {
-                  log.debug(this + " blocking on the failover lock, waiting for failover to start");
-                  failoverStatusLock.wait(startToWait);
-                  log.debug(this + " releasing the failover lock, checking again whether failover started ...");
-               }
-               catch (InterruptedException ignore)
-               {                  
-               }
-               startToWait -= System.currentTimeMillis() - start;              
-            }
-         }        
-      }
-   }
-   
-   public void checkClientID(String clientID) throws Exception
-   {   
-      // verify the clientID is unique
-   
-      // JMS 1.1 Specifications, Section 4.3.2:
-      // "By definition, the client state identified by a client identifier can be 'in use' by
-      // only one client at a time. A JMS provider must prevent concurrently executing clients
-      // from using it."
-      
-      if (clientID != null)
-      {            
-         List conns = connectionManager.getActiveConnections();
-      
-         for(Iterator i = conns.iterator(); i.hasNext(); )
-         {
-            ServerConnectionEndpoint sce = (ServerConnectionEndpoint)i.next();
-            if (clientID != null && clientID.equals(sce.getClientID()))
-            {
-               throw new InvalidClientIDException(
-                  "Client ID '" + clientID + "' already used by " + sce);
-            }
-         }
-      }
-   }
-   
-   public String toString()
-   {
-      return "ServerPeer[" + getServerPeerID() + "]";
-   }
-
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
-   // Private --------------------------------------------------------------------------------------
-  
-   private void initializeRemoting(MBeanServer mbeanServer) throws Exception
-   {
-      JMSWireFormat wf = new JMSWireFormat();
-
-      MarshalFactory.addMarshaller("jms", wf, wf);
-
-      handler = new JMSServerInvocationHandler();
-   }
-
-   private void loadServerAOPConfig() throws Exception
-   {
-      URL url = this.getClass().getClassLoader().getResource("aop-messaging-server.xml");
-      AspectXmlLoader.deployXML(url);
-   }
-
-   private void unloadServerAOPConfig() throws Exception
-   {
-      URL url = this.getClass().getClassLoader().getResource("aop-messaging-server.xml");
-      AspectXmlLoader.undeployXML(url);
-   }
-
-   private void loadClientAOPConfig() throws Exception
-   {
-      // Note the file is called aop-messaging-client.xml NOT messaging-client-aop.xml. This is
-      // because the JBoss will automatically deploy any files ending with aop.xml; we do not want
-      // this to happen for the client config
-
-      URL url = this.getClass().getClassLoader().getResource("aop-messaging-client.xml");
-      InputStream is = null;
-      ByteArrayOutputStream os = new ByteArrayOutputStream();
-      try
-      {
-         is = url.openStream();
-         int b;
-         while ((b = is.read()) != -1)
-         {
-            os.write(b);
-         }
-         os.flush();
-         clientAOPStack = os.toByteArray();
-      }
-      finally
-      {
-         if (is != null)
-         {
-            is.close();
-         }
-         if (os != null)
-         {
-            os.close();
-         }
-      }
-   }
-
-   private String deployDestinationDefault(boolean isQueue, String name, String jndiName)
-      throws Exception
-   {
-      //
-      // TODO - THIS IS A TEMPORARY IMPLEMENTATION; WILL BE REPLACED WITH INTEGRATION-CONSISTENT ONE
-      // TODO - if I find a way not using UnifiedClassLoader3 directly, then get rid of
-      //        <path refid="jboss.jmx.classpath"/> from jms/build.xml dependentmodule.classpath
-      //
-
-      //TODO - Yes this is super-ugly - there must be an easier way of doing it
-      //also in LocalTestServer is doing the same thing in a slightly different way
-      //this should be combined
-
-      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);
-
-      String destinationMBeanConfig =
-         "<mbean code=\"" + className + "\" " +
-         "       name=\"" + ons + "\" " +
-         "       xmbean-dd=\"xmdesc/" + destType + "-xmbean.xml\">\n" +
-         "    <constructor>" +
-         "        <arg type=\"boolean\" value=\"true\"/>" +
-         "    </constructor>" +
-         "</mbean>";
-
-      return deployDestinationInternal(destinationMBeanConfig, on, jndiName, false, -1, -1, -1);
-   }
-   
-   private String deployDestination(boolean isQueue, String name, String jndiName, int fullSize,
-            int pageSize, int downCacheSize) throws Exception
-   {
-      //    
-      //    TODO - THIS IS A TEMPORARY IMPLEMENTATION; WILL BE REPLACED WITH INTEGRATION-CONSISTENT ONE
-      //    TODO - if I find a way not using UnifiedClassLoader3 directly, then get rid of
-      //    <path refid="jboss.jmx.classpath"/> from jms/build.xml dependentmodule.classpath
-      //    
-      
-      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);
-      
-      String destinationMBeanConfig =
-         "<mbean code=\"" + className + "\" " +
-         "       name=\"" + ons + "\" " +
-         "       xmbean-dd=\"xmdesc/" + destType + "-xmbean.xml\">\n" +
-         "    <constructor>" +
-         "        <arg type=\"boolean\" value=\"true\"/>" +
-         "    </constructor>" +
-         "    <attribute name=\"FullSize\">" + fullSize + "</attribute>" +
-         "    <attribute name=\"PageSize\">" + pageSize + "</attribute>" +
-         "    <attribute name=\"DownCacheSize\">" + downCacheSize + "</attribute>" +
-         "</mbean>";
-      
-      return deployDestinationInternal(destinationMBeanConfig, on, jndiName, true, fullSize,
-               pageSize, downCacheSize);
-   }
-
-   private String deployDestinationInternal(String destinationMBeanConfig, ObjectName on,
-                                            String jndiName, boolean params, int fullSize,
-                                            int pageSize, int downCacheSize) throws Exception
-   {
-      MBeanServer mbeanServer = getServer();
-
-      Element element = Util.stringToElement(destinationMBeanConfig);
-
-      ServiceCreator sc = new ServiceCreator(mbeanServer);
-
-      ClassLoader cl = this.getClass().getClassLoader();
-      ObjectName loaderObjectName = null;
-      if (cl instanceof UnifiedClassLoader3)
-      {
-         loaderObjectName = ((UnifiedClassLoader3)cl).getObjectName();
-      }
-
-      sc.install(on, loaderObjectName, element);
-
-      // inject dependencies
-      mbeanServer.setAttribute(on, new Attribute("ServerPeer", getServiceName()));
-      mbeanServer.setAttribute(on, new Attribute("JNDIName", jndiName));
-      if (params)
-      {
-         mbeanServer.setAttribute(on, new Attribute("FullSize", new Integer(fullSize)));
-         mbeanServer.setAttribute(on, new Attribute("PageSize", new Integer(pageSize)));
-         mbeanServer.setAttribute(on, new Attribute("DownCacheSize", new Integer(downCacheSize)));
-      }
-      mbeanServer.invoke(on, "create", new Object[0], new String[0]);
-      mbeanServer.invoke(on, "start", new Object[0], new String[0]);
-
-      return (String)mbeanServer.getAttribute(on, "JNDIName");
-
-      //
-      // end of TODO
-      //
-   }
-
-   
-
-   /*
-    * Undeploy the MBean but don't delete the underlying data
-    */
-   private boolean undeployDestination(boolean isQueue, String name) throws Exception
-   {
-      String destType = isQueue ? "Queue" : "Topic";
-      String ons ="jboss.messaging.destination:service=" + destType + ",name=" + name;
-      ObjectName on = new ObjectName(ons);
-
-      MBeanServer mbeanServer = getServer();
-
-      // we can only undeploy destinations that exist AND that have been created programatically
-      if (!mbeanServer.isRegistered(on))
-      {
-         return false;
-      }
-      Boolean b = (Boolean)mbeanServer.getAttribute(on, "CreatedProgrammatically");
-      if (!b.booleanValue())
-      {
-         log.warn("Cannot undeploy a destination that has not been created programatically");
-         return false;
-      }
-      mbeanServer.invoke(on, "stop", new Object[0], new String[0]);
-      mbeanServer.invoke(on, "destroy", new Object[0], new String[0]);
-      mbeanServer.unregisterMBean(on);
-      return true;
-   }
-   
-   /*
-    * Undeploy the MBean and delete the underlying data
-    */
-   private boolean destroyDestination(boolean isQueue, String name) throws Exception
-   {
-      String destType = isQueue ? "Queue" : "Topic";
-      String ons ="jboss.messaging.destination:service=" + destType + ",name=" + name;
-      ObjectName on = new ObjectName(ons);
-
-      MBeanServer mbeanServer = getServer();
-
-      // we can only destroy destinations that exist AND that have been created programatically
-      if (!mbeanServer.isRegistered(on))
-      {
-         return false;
-      }
-                  
-      //First deactivate
-      
-      if (isQueue)
-      {
-         Binding binding = postOffice.getBindingForQueueName(name);
-         
-         if (binding != null)
-         {
-            binding.getQueue().deactivate();
-         }
-      }
-      else
-      {
-         JMSCondition topicCond = new JMSCondition(false, name);    
-         
-         Collection bindings = postOffice.getBindingsForCondition(topicCond);
-         
-         Iterator iter = bindings.iterator();
-         while (iter.hasNext())            
-         {
-            Binding binding = (Binding)iter.next();
-            
-            binding.getQueue().deactivate();
-         }
-      }
-            
-      //Delete any message data
-      
-      mbeanServer.invoke(on, "removeAllMessages", null, null);
-      
-      //undeploy the mbean
-      if (!undeployDestination(isQueue, name))
-      {
-         return false;
-      }
-            
-      //Unbind from the post office
-      
-      if (isQueue)
-      {
-         Binding binding = postOffice.getBindingForQueueName(name);
-         
-         if (binding != null)
-         {
-            try
-            {
-               Queue queue = binding.getQueue();
-               if (!queue.isClustered())
-               {
-                  postOffice.unbindQueue(queue.getName());
-               }
-               else
-               {
-                  ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
-               }
-            }
-            catch (Throwable t)
-            {
-               throw new Exception("Failed to unbind queue", t);
-            }
-         }
-      }
-      else
-      {
-         JMSCondition topicCond = new JMSCondition(false, name);    
-         
-         Collection bindings = postOffice.getBindingsForCondition(topicCond);
-         
-         Iterator iter = bindings.iterator();
-         while (iter.hasNext())            
-         {
-            Binding binding = (Binding)iter.next();
-            
-            try
-            {
-               postOffice.unbindQueue(binding.getQueue().getName());
-            }
-            catch (Throwable t)
-            {
-               throw new Exception("Failed to unbind queue", t);
-            }
-         }
-      }
-      return true;
-   }
-   
-
-   // Inner classes --------------------------------------------------------------------------------
-   
-   private class FailoverListener implements ReplicationListener
-   {
-      public void onReplicationChange(Serializable key, Map updatedReplicantMap,
-                                      boolean added, int originatingNodeId)
-      {
-         if (key.equals(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY))
-         {
-            if (updatedReplicantMap != null && originatingNodeId == serverPeerID)
-            {
-               FailoverStatus status =
-                  (FailoverStatus)updatedReplicantMap.get(new Integer(serverPeerID));
-               
-               if (status != null && status.isFailedOver())
-               {                     
-                  // We prompt txRepository to load any prepared txs - so we can take over
-                  // responsibility for in doubt transactions from other nodes
-                  try
-                  {
-                     txRepository.loadPreparedTransactions();
-                  }
-                  catch (Exception e)
-                  {
-                     log.error("Failed to load prepared transactions", e);
-                  }
-               }
-            }
-            
-            synchronized (failoverStatusLock)
-            {
-               log.debug(ServerPeer.this +
-                  ".FailoverListener got failover event, notifying those waiting on lock");
-               
-               failoverStatusLock.notifyAll();
-            }
-         }         
-      }      
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java (from rev 2548, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/ServerPeer.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/ServerPeer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,1601 @@
+/*
+  * 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;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.jms.InvalidClientIDException;
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.transaction.xa.Xid;
+
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper;
+import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
+import org.jboss.jms.server.connectormanager.SimpleConnectorManager;
+import org.jboss.jms.server.destination.ManagedQueue;
+import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
+import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
+import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.messagecounter.MessageCounterManager;
+import org.jboss.jms.server.plugin.contract.JMSUserManager;
+import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
+import org.jboss.jms.server.remoting.JMSWireFormat;
+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.message.SimpleMessageStore;
+import org.jboss.messaging.core.plugin.IDManager;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
+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.messaging.core.plugin.contract.ReplicationListener;
+import org.jboss.messaging.core.plugin.contract.Replicator;
+import org.jboss.messaging.core.plugin.postoffice.Binding;
+import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
+import org.jboss.messaging.core.plugin.postoffice.cluster.FailoverStatus;
+import org.jboss.messaging.core.tx.TransactionRepository;
+import org.jboss.messaging.util.Util;
+import org.jboss.mx.loading.UnifiedClassLoader3;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.system.ServiceCreator;
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.util.JBossStringBuilder;
+import org.w3c.dom.Element;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
+/**
+ * A JMS server peer.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ServerPeer extends ServiceMBeanSupport implements ServerPeerMBean
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(ServerPeer.class);
+
+   // The "subsystem" label this ServerPeer uses to register its ServerInvocationHandler with the
+   // Remoting connector
+   public static final String REMOTING_JMS_SUBSYSTEM = "JMS";
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private int serverPeerID;
+   private byte[] clientAOPStack;
+   private Version version;
+
+   private String defaultQueueJNDIContext;
+   private String defaultTopicJNDIContext;
+
+   private boolean started;
+
+   private int objectIDSequence = 1;
+
+   // The default maximum number of delivery attempts before sending to DLQ - can be overridden on
+   // the destination
+   private int defaultMaxDeliveryAttempts = 10;
+
+   private Object failoverStatusLock;
+   
+   // Default is 1 minute
+   private long failoverStartTimeout = 60 * 1000;
+   
+   // Default is 5 minutes
+   private long failoverCompleteTimeout = 5 * 60 * 1000;
+   
+   private Map sessions;
+   
+   private long defaultRedeliveryDelay;
+   
+   private long queueStatsSamplePeriod = 10000;
+   
+   private int defaultMessageCounterHistoryDayLimit;
+      
+   // wired components
+
+   private DestinationJNDIMapper destinationJNDIMapper;
+   private SecurityMetadataStore securityStore;
+   private ConnectionFactoryJNDIMapper connFactoryJNDIMapper;
+   private TransactionRepository txRepository;
+   private ConnectionManager connectionManager;
+   private ConnectorManager connectorManager;
+   private IDManager messageIDManager;
+   private IDManager channelIDManager;
+   private IDManager transactionIDManager;
+   private MemoryManager memoryManager;  
+   private MessageStore messageStore;
+   private MessageCounterManager messageCounterManager;
+
+   // plugins
+
+   protected ObjectName persistenceManagerObjectName;
+   protected PersistenceManager persistenceManager;
+
+   protected ObjectName postOfficeObjectName;
+   protected PostOffice postOffice;
+
+   protected ObjectName jmsUserManagerObjectName;
+   protected JMSUserManager jmsUserManager;
+   
+   protected ObjectName defaultDLQObjectName;
+   protected Queue defaultDLQ;
+   
+   protected ObjectName defaultExpiryQueueObjectName;
+   protected Queue defaultExpiryQueue;
+
+   //Other stuff
+
+   private JMSServerInvocationHandler handler;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ServerPeer(int serverPeerID,
+                     String defaultQueueJNDIContext,
+                     String defaultTopicJNDIContext) throws Exception
+   {
+      if (serverPeerID < 0)
+      {
+         throw new IllegalArgumentException("ID cannot be negative");
+      }
+      
+      log.info(this + " creating server peer with ID " + serverPeerID);
+
+      this.serverPeerID = serverPeerID;
+      this.defaultQueueJNDIContext = defaultQueueJNDIContext;
+      this.defaultTopicJNDIContext = defaultTopicJNDIContext;
+
+      // Some wired components need to be started here
+      securityStore = new SecurityMetadataStore();
+
+      version = Version.instance();
+      
+      failoverStatusLock = new Object();
+      
+      sessions = new ConcurrentReaderHashMap();
+
+      started = false;
+   }      
+
+   // ServiceMBeanSupport overrides ----------------------------------------------------------------
+
+   public synchronized void startService() throws Exception
+   {
+      try
+      {
+         log.debug("starting ServerPeer");
+
+         if (started)
+         {
+            return;
+         }
+
+         log.debug(this + " starting");
+
+         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);
+         transactionIDManager = new IDManager("TRANSACTION_ID", 1024, persistenceManager);
+         destinationJNDIMapper = new DestinationJNDIMapper(this);
+         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
+         connectionManager = new SimpleConnectionManager();
+         connectorManager = new SimpleConnectorManager();
+         memoryManager = new SimpleMemoryManager();
+         messageStore = new SimpleMessageStore();
+         txRepository =
+            new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
+         messageCounterManager = new MessageCounterManager(queueStatsSamplePeriod);
+
+         // Start the wired components
+
+         messageIDManager.start();
+         channelIDManager.start();
+         transactionIDManager.start();
+         destinationJNDIMapper.start();
+         connFactoryJNDIMapper.start();
+         connectionManager.start();
+         connectorManager.start();
+         memoryManager.start();
+         messageStore.start();
+         securityStore.start();
+         txRepository.start();
+         
+         // Note we do not start the message counter manager by default. This must be done
+         // explicitly by the user by calling enableMessageCounters(). This is because message
+         // counter history takes up growing memory to store the stats and could theoretically
+         // eventually cause the server to run out of RAM
+         
+         txRepository.loadPreparedTransactions();
+         
+         initializeRemoting(mbeanServer);
+
+         started = true;
+
+         log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
+            getServerPeerID()+ "] started");
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
+      }
+   }
+
+   public synchronized void stopService() throws Exception
+   {
+      try
+      {
+         if (!started)
+         {
+            return;
+         }
+
+         log.debug(this + " stopping");
+
+         started = false;
+
+         // Stop the wired components
+
+         messageIDManager.stop();
+         messageIDManager = null;
+         channelIDManager.stop();
+         channelIDManager = null;
+         transactionIDManager.stop();
+         transactionIDManager = null;
+         destinationJNDIMapper.stop();
+         destinationJNDIMapper = null;
+         connFactoryJNDIMapper.stop();
+         connFactoryJNDIMapper = null;
+         connectionManager.stop();
+         connectionManager = null;
+         connectorManager.start();
+         connectorManager = null;
+         memoryManager.stop();
+         memoryManager = null;
+         messageStore.stop();
+         messageStore = null;
+         securityStore.stop();
+         securityStore = null;
+         txRepository.stop();
+         txRepository = null;
+         messageCounterManager.stop();
+         messageCounterManager = null;
+
+         unloadServerAOPConfig();
+
+         // TODO unloadClientAOPConfig();
+
+         MessagingTimeoutFactory.instance.reset();
+
+         log.info("JMS " + this + " stopped");
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
+      }
+   }
+
+   // JMX Attributes -------------------------------------------------------------------------------
+
+   // Plugins
+   
+   public synchronized ObjectName getPersistenceManager()
+   {
+      return persistenceManagerObjectName;
+   }
+
+   public synchronized void setPersistenceManager(ObjectName on)
+   {
+      if (started)
+      {
+         log.warn("Cannot set persistence manager on server peer when server peer is started");
+         return;         
+      }
+      persistenceManagerObjectName = on;
+   }
+
+   public synchronized ObjectName getPostOffice()
+   {
+      return postOfficeObjectName;
+   }
+
+   public synchronized void setPostOffice(ObjectName on)
+   {
+      if (started)
+      {
+         log.warn("Cannot set post office on server peer when server peer is started");
+         return;         
+      }
+      postOfficeObjectName = on;
+   }
+
+   public synchronized ObjectName getJmsUserManager()
+   {
+      return jmsUserManagerObjectName;
+   }
+
+   public synchronized void setJMSUserManager(ObjectName on)
+   {
+      if (started)
+      {
+         log.warn("Cannot set jms user manager on server peer when server peer is started");
+         return;         
+      }
+      jmsUserManagerObjectName = on;
+   }
+   
+   public synchronized ObjectName getDefaultDLQ()
+   {
+      return defaultDLQObjectName;
+   }
+
+   public synchronized void setDefaultDLQ(ObjectName on)
+   {
+      defaultDLQObjectName = on;
+   }
+   
+   public synchronized ObjectName getDefaultExpiryQueue()
+   {
+      return defaultExpiryQueueObjectName;
+   }
+
+   public synchronized void setDefaultExpiryQueue(ObjectName on)
+   {
+      this.defaultExpiryQueueObjectName = on;
+   }     
+      
+   // Instance access
+
+   public Object getInstance()
+   {
+      return this;
+   }
+   
+   //read only JMX attributes
+
+   public String getJMSVersion()
+   {
+      return version.getJMSVersion();
+   }
+
+   public int getJMSMajorVersion()
+   {
+      return version.getJMSMajorVersion();
+   }
+
+   public int getJMSMinorVersion()
+   {
+      return version.getJMSMinorVersion();
+   }
+
+   public String getJMSProviderName()
+   {
+      return version.getJMSProviderName();
+   }
+
+   public String getProviderVersion()
+   {
+      return version.getProviderVersion();
+   }
+
+   public int getProviderMajorVersion()
+   {
+      return version.getProviderMajorVersion();
+   }
+
+   public int getProviderMinorVersion()
+   {
+      return version.getProviderMinorVersion();
+   }
+
+   public int getServerPeerID()
+   {
+      return serverPeerID;
+   }
+
+   public String getDefaultQueueJNDIContext()
+   {
+      return defaultQueueJNDIContext;
+   }
+
+   public String getDefaultTopicJNDIContext()
+   {
+      return defaultTopicJNDIContext;
+   }
+   
+   //Read - write attributes
+
+   public synchronized void setSecurityDomain(String securityDomain) throws Exception
+   {
+      try
+      {
+         securityStore.setSecurityDomain(securityDomain);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " setSecurityDomain");
+      }
+   }
+
+   public synchronized String getSecurityDomain()
+   {
+      return securityStore.getSecurityDomain();
+   }
+
+   public synchronized void setDefaultSecurityConfig(Element conf) throws Exception
+   {
+      securityStore.setDefaultSecurityConfig(conf);
+   }
+
+   public synchronized Element getDefaultSecurityConfig()
+   {
+      return securityStore.getDefaultSecurityConfig();
+   }
+        
+   public synchronized long getFailoverStartTimeout()
+   {
+      return this.failoverStartTimeout;
+   }
+   
+   public synchronized void setFailoverStartTimeout(long timeout)
+   {
+      this.failoverStartTimeout = timeout;
+   }
+   
+   public synchronized long getFailoverCompleteTimeout()
+   {
+      return this.failoverCompleteTimeout;
+   }
+   
+   public synchronized void setFailoverCompleteTimeout(long timeout)
+   {
+      this.failoverCompleteTimeout = timeout;
+   }
+   
+   public synchronized int getDefaultMaxDeliveryAttempts()
+   {
+      return defaultMaxDeliveryAttempts;
+   }
+
+   public synchronized void setDefaultMaxDeliveryAttempts(int attempts)
+   {
+      this.defaultMaxDeliveryAttempts = attempts;
+   }
+   
+   public synchronized long getQueueStatsSamplePeriod()
+   {
+      return queueStatsSamplePeriod;
+   }
+
+   public synchronized void setQueueStatsSamplePeriod(long newPeriod)
+   {
+      if (newPeriod < 1000)
+      {
+         throw new IllegalArgumentException("Cannot set QueueStatsSamplePeriod < 1000 ms");
+      }
+      
+      if (messageCounterManager != null && newPeriod != queueStatsSamplePeriod)
+      {
+         messageCounterManager.reschedule(newPeriod);
+      }            
+      
+      this.queueStatsSamplePeriod = newPeriod;
+   }
+   
+   public synchronized long getDefaultRedeliveryDelay()
+   {
+      return defaultRedeliveryDelay;
+   }
+   
+   public synchronized void setDefaultRedeliveryDelay(long delay)
+   {
+      this.defaultRedeliveryDelay = delay;
+   }
+   
+   public synchronized int getDefaultMessageCounterHistoryDayLimit()
+   {
+      return defaultMessageCounterHistoryDayLimit;
+   }
+   
+   public void setDefaultMessageCounterHistoryDayLimit(int limit)
+   {
+      if (limit < -1)
+      {
+         limit = -1;
+      }
+      
+      this.defaultMessageCounterHistoryDayLimit = limit;
+   }
+   
+   public void enableMessageCounters()
+   {      
+      messageCounterManager.start();
+   }
+   
+   public void disableMessageCounters()
+   {
+      messageCounterManager.stop();
+      
+      messageCounterManager.resetAllCounters();
+      
+      messageCounterManager.resetAllCounterHistories();
+   }
+   
+   // JMX Operations -------------------------------------------------------------------------------
+
+   public String deployQueue(String name, String jndiName) throws Exception
+   {
+      try
+      {
+         return deployDestinationDefault(true, name, jndiName);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue");
+      }
+   }
+
+   public String deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
+   {
+      try
+      {
+         return deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue(2)");
+      }
+   }
+
+   public boolean destroyQueue(String name) throws Exception
+   {
+      try
+      {
+         return destroyDestination(true, name);        
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyQueue");
+      }
+   }
+   
+   public boolean undeployQueue(String name) throws Exception
+   {
+      try
+      {
+         return undeployDestination(true, name);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyQueue");
+      }
+   }
+
+   public String deployTopic(String name, String jndiName) throws Exception
+   {
+      try
+      {
+         return deployDestinationDefault(false, name, jndiName);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic");
+      }
+   }
+
+   public String deployTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
+   {
+      try
+      {
+         return deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic(2)");
+      }
+   }
+
+   public boolean destroyTopic(String name) throws Exception
+   {
+      try
+      {
+         return destroyDestination(false, name);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyTopic");
+      }
+   }
+   
+   public boolean undeployTopic(String name) throws Exception
+   {
+      try
+      {
+         return undeployDestination(false, name);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " destroyTopic");
+      }
+   }
+
+   public Set getDestinations() throws Exception
+   {
+      try
+      {
+         return destinationJNDIMapper.getDestinations();
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " getDestinations");
+      }
+   }
+   
+   public List getMessageCounters() throws Exception
+   {
+      Collection counters = messageCounterManager.getMessageCounters();
+      
+      return new ArrayList(counters);
+   }
+
+   public List getMessageStatistics() throws Exception
+   {
+      return MessageCounter.getMessageStatistics(getMessageCounters());
+   }
+
+   public String listMessageCountersAsHTML() throws Exception
+   {
+      List counters = getMessageCounters();
+
+      String ret =
+         "<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">"
+            + "<tr>"
+            + "<th>Type</th>"
+            + "<th>Name</th>"
+            + "<th>Subscription</th>"
+            + "<th>Durable</th>"
+            + "<th>Count</th>"
+            + "<th>CountDelta</th>"
+            + "<th>Depth</th>"
+            + "<th>DepthDelta</th>"
+            + "<th>Last Add</th>"
+            + "</tr>";
+
+      String strNameLast = null;
+      String strTypeLast = null;
+      String strDestLast = null;
+
+      String destData = "";
+      int destCount = 0;
+
+      int countTotal = 0;
+      int countDeltaTotal = 0;
+      int depthTotal = 0;
+      int depthDeltaTotal = 0;
+
+      int i = 0; // define outside of for statement, so variable
+      // still exists after for loop, because it is
+      // needed during output of last module data string
+
+      Iterator iter = counters.iterator();
+      
+      while (iter.hasNext())
+      {
+         MessageCounter counter = (MessageCounter)iter.next();
+         
+         // get counter data
+         StringTokenizer tokens = new StringTokenizer(counter.getCounterAsString(), ",");
+
+         String strType = tokens.nextToken();
+         String strName = tokens.nextToken();
+         String strSub = tokens.nextToken();
+         String strDurable = tokens.nextToken();
+
+         String strDest = strType + "-" + strName;
+
+         String strCount = tokens.nextToken();
+         String strCountDelta = tokens.nextToken();
+         String strDepth = tokens.nextToken();
+         String strDepthDelta = tokens.nextToken();
+         String strDate = tokens.nextToken();
+
+         // update total count / depth values
+         countTotal += Integer.parseInt(strCount);
+         depthTotal += Integer.parseInt(strDepth);
+
+         countDeltaTotal += Integer.parseInt(strCountDelta);
+         depthDeltaTotal += Integer.parseInt(strDepthDelta);
+
+         if (strCountDelta.equalsIgnoreCase("0"))
+            strCountDelta = "-"; // looks better
+
+         if (strDepthDelta.equalsIgnoreCase("0"))
+            strDepthDelta = "-"; // looks better
+
+         // output destination counter data as HTML table row
+         // ( for topics with multiple subscriptions output
+         //   type + name field as rowspans, looks better )
+         if (strDestLast != null && strDestLast.equals(strDest))
+         {
+            // still same destination -> append destination subscription data
+            destData += "<tr bgcolor=\"#" + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0") + "\">";
+            destCount += 1;
+         }
+         else
+         {
+            // start new destination data
+            if (strDestLast != null)
+            {
+               // store last destination data string
+               ret += "<tr bgcolor=\"#"
+                  + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
+                  + "\"><td rowspan=\""
+                  + destCount
+                  + "\">"
+                  + strTypeLast
+                  + "</td><td rowspan=\""
+                  + destCount
+                  + "\">"
+                  + strNameLast
+                  + "</td>"
+                  + destData;
+
+               destData = "";
+            }
+
+            destCount = 1;
+         }
+
+         // counter data row
+         destData += "<td>"
+            + strSub
+            + "</td>"
+            + "<td>"
+            + strDurable
+            + "</td>"
+            + "<td>"
+            + strCount
+            + "</td>"
+            + "<td>"
+            + strCountDelta
+            + "</td>"
+            + "<td>"
+            + strDepth
+            + "</td>"
+            + "<td>"
+            + strDepthDelta
+            + "</td>"
+            + "<td>"
+            + strDate
+            + "</td>";
+
+         // store current destination data for change detection
+         strTypeLast = strType;
+         strNameLast = strName;
+         strDestLast = strDest;
+      }
+
+      if (strDestLast != null)
+      {
+         // store last module data string
+         ret += "<tr bgcolor=\"#"
+            + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
+            + "\"><td rowspan=\""
+            + destCount
+            + "\">"
+            + strTypeLast
+            + "</td><td rowspan=\""
+            + destCount
+            + "\">"
+            + strNameLast
+            + "</td>"
+            + destData;
+      }
+
+      // append summation info
+      ret += "<tr>"
+         + "<td><![CDATA[ ]]></td><td><![CDATA[ ]]></td>"
+         + "<td><![CDATA[ ]]></td><td><![CDATA[ ]]></td><td>"
+         + countTotal
+         + "</td><td>"
+         + (countDeltaTotal == 0 ? "-" : Integer.toString(countDeltaTotal))
+         + "</td><td>"
+         + depthTotal
+         + "</td><td>"
+         + (depthDeltaTotal == 0 ? "-" : Integer.toString(depthDeltaTotal))
+         + "</td><td>Total</td></tr></table>";
+
+      return ret;
+   }
+
+   public void resetAllMessageCounters()
+   {
+      messageCounterManager.resetAllCounters();
+   }
+   
+   public void resetAllMessageCounterHistories()
+   {
+      messageCounterManager.resetAllCounterHistories();
+   }
+   
+   public List retrievePreparedTransactions()
+   {
+      return txRepository.getPreparedTransactions();
+   }
+
+   public String showPreparedTransactionsAsHTML()
+   {
+      List txs = txRepository.getPreparedTransactions();
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
+      buffer.append("<tr><th>Xid</th></tr>");
+      for (Iterator i = txs.iterator(); i.hasNext();)
+      {
+         Xid xid = (Xid)i.next();
+         if (xid != null)
+         {
+            buffer.append("<tr><td>");
+            buffer.append(xid);
+            buffer.append("</td></tr>");
+         }
+      }
+      buffer.append("</table>");
+      return buffer.toString();
+   }
+   
+   // Public ---------------------------------------------------------------------------------------
+   
+   public byte[] getClientAOPStack()
+   {
+      return clientAOPStack;
+   }
+   
+   public MessageCounterManager getMessageCounterManager()
+   {
+      return messageCounterManager;
+   }
+   
+   public IDManager getMessageIDManager()
+   {
+      return messageIDManager;
+   }
+
+   public IDManager getChannelIDManager()
+   {
+      return channelIDManager;
+   }
+
+   public ServerInvocationHandler getInvocationHandler()
+   {
+      return handler;
+   }
+   
+   public ServerSessionEndpoint getSession(Integer sessionID)
+   {
+      return (ServerSessionEndpoint)sessions.get(sessionID);
+   }
+   
+   public void addSession(Integer id, ServerSessionEndpoint session)
+   {
+      sessions.put(id, session);      
+   }
+   
+   public void removeSession(Integer id)
+   {
+      if (sessions.remove(id) == null)
+      {
+         throw new IllegalStateException("Cannot find session with id " + id + " to remove");
+      }
+   }
+
+   public synchronized Queue getDefaultDLQInstance() throws Exception
+   {
+      Queue dlq = null;
+      
+      if (defaultDLQObjectName != null)
+      { 
+         ManagedQueue dest = null;
+         
+         try
+         {         
+            dest = (ManagedQueue)getServer().
+               getAttribute(defaultDLQObjectName, "Instance");
+         }
+         catch (InstanceNotFoundException e)
+         {
+            //Ok
+         }
+         
+         if (dest != null)
+         {            
+            PostOffice po = getPostOfficeInstance();
+            
+            Binding binding = po.getBindingForQueueName(dest.getName());
+            
+            if (binding != null && binding.getQueue().isActive())
+            {
+               dlq =  binding.getQueue();
+            }
+         }
+      }
+      
+      return dlq;
+   }
+   
+   public synchronized Queue getDefaultExpiryQueueInstance() throws Exception
+   {
+      Queue expiryQueue = null;
+      
+      if (defaultExpiryQueueObjectName != null)
+      {
+         ManagedQueue dest = null;
+         
+         try
+         {         
+            dest = (ManagedQueue)getServer().
+               getAttribute(defaultExpiryQueueObjectName, "Instance");
+         }
+         catch (InstanceNotFoundException e)
+         {
+            //Ok
+         }
+
+         if (dest != null)
+         {            
+            PostOffice po = getPostOfficeInstance();
+            
+            Binding binding = po.getBindingForQueueName(dest.getName());
+            
+            if (binding != null && binding.getQueue().isActive())
+            {
+               expiryQueue =  binding.getQueue();
+            }
+         }
+      }
+      
+      return expiryQueue;
+   }
+
+   public TransactionRepository getTxRepository()
+   {
+      return txRepository;
+   }
+
+   public synchronized boolean isStarted()
+   {
+      return started;
+   }
+
+   public Version getVersion()
+   {
+      return version;
+   }
+
+   // access to hard-wired server extensions
+
+   public SecurityManager getSecurityManager()
+   {
+      return securityStore;
+   }
+
+   public DestinationManager getDestinationManager()
+   {
+      return destinationJNDIMapper;
+   }
+
+   public ConnectionFactoryManager getConnectionFactoryManager()
+   {
+      return connFactoryJNDIMapper;
+   }
+
+   public ConnectionManager getConnectionManager()
+   {
+      return connectionManager;
+   }
+
+   public ConnectorManager getConnectorManager()
+   {
+      return connectorManager;
+   }
+
+   public MessageStore getMessageStore()
+   {
+      return messageStore;
+   }
+
+   public MemoryManager getMemoryManager()
+   {
+      return memoryManager;
+   }
+
+   // access to plugin references
+
+   public PersistenceManager getPersistenceManagerInstance()
+   {
+      return persistenceManager;
+   }
+
+   public JMSUserManager getJmsUserManagerInstance()
+   {
+      return jmsUserManager;
+   }
+
+   public PostOffice getPostOfficeInstance() throws Exception
+   {
+      // We get the reference lazily to avoid problems with MBean circular dependencies
+      if (postOffice == null)
+      {
+         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.
+
+         if (!postOffice.isLocal())
+         {
+            Replicator rep = (Replicator)postOffice;
+            connFactoryJNDIMapper.injectReplicator(rep);            
+            rep.registerListener(new FailoverListener());
+         }
+         
+         // Also need to inject into txRepository
+         txRepository.injectPostOffice(postOffice);
+      }
+      return postOffice;
+   }
+
+   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++;
+   }
+
+   /*
+    * Wait for failover from the specified node to complete.
+    */
+   public int waitForFailover(int failedNodeID) throws Exception
+   {
+      // This node may be failing over for another node - in which case we must wait for that to be
+      // complete.
+      
+      log.debug(this + " waiting for server-side failover for failed node " + failedNodeID + " to complete");
+      
+      Replicator replicator = getReplicator();
+
+      long startToWait = getFailoverStartTimeout();
+      long completeToWait = getFailoverCompleteTimeout();
+                     
+      // Must lock here
+      synchronized (failoverStatusLock)
+      {         
+         while (true)
+         {         
+            //TODO we shouldn't have a dependency on DefaultClusteredPostOffice - where should we put the constants?
+
+            Map replicants = replicator.get(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY);
+            
+            boolean foundEntry = false;
+                        
+            if (replicants != null)
+            {
+               for(Iterator i = replicants.entrySet().iterator(); i.hasNext(); )
+               {
+                  Map.Entry entry = (Map.Entry)i.next();
+                  Integer nid = (Integer)entry.getKey();
+                  FailoverStatus status = (FailoverStatus)entry.getValue();
+                  
+                  if (status.isFailedOverForNode(failedNodeID))
+                  {
+                     log.debug(this + ": failover is complete on node " + nid);
+                     return nid.intValue();
+                  }
+                  else if (status.isFailingOverForNode(failedNodeID))
+                  {
+                     log.debug(this + ": fail over is in progress on node " + nid);
+                     
+                     // A server has started failing over for the failed node, but not completed.
+                     // If it's not this node then we immediately return so the connection can be
+                     // redirected to another node.
+                     if (nid.intValue() != this.getServerPeerID())
+                     {
+                        return nid.intValue();
+                     }
+                     
+                     // Otherwise we wait for failover to complete
+                     
+                     if (completeToWait <= 0)
+                     {
+                        // Give up now
+                        log.debug(this + " already waited long enough for failover to complete, giving up");
+                        return -1;
+                     }
+                     
+                     // Note - we have to count the time since other unrelated nodes may fail and
+                     // wake up the lock - in this case we don't want to give up too early.
+                     long start = System.currentTimeMillis();
+
+                     try
+                     {
+                        log.debug(this + " blocking on the failover lock, waiting for failover to complete");
+                        failoverStatusLock.wait(completeToWait);
+                        log.debug(this + " releasing the failover lock, checking again whether failover completed ...");
+                     }
+                     catch (InterruptedException ignore)
+                     {                  
+                     }
+                     completeToWait -= System.currentTimeMillis() - start;
+                     foundEntry = true;
+                  }
+               }        
+            }
+            
+            if (!foundEntry)
+            {              
+               // No trace of failover happening so we wait a maximum of FAILOVER_START_TIMEOUT for
+               // some replicated data to arrive. This should arrive fairly quickly since this is
+               // added at the beginning of the failover process. If it doesn't arrive it would
+               // imply that no failover has actually happened on the server or the timeout is too
+               // short. It is possible that no failover has actually happened on the server, if for
+               // example there is a problem with the client side network but the server side
+               // network is ok.
+   
+               if (startToWait <= 0)
+               {
+                  // Don't want to wait again
+                  log.debug(this + " already waited long enough for failover to start, giving up");
+                  return -1;
+               }
+               
+               // Note - we have to count the time since other unrelated nodes may fail and wake
+               // up the lock - in this case we don't want to give up too early.
+               long start = System.currentTimeMillis(); 
+               try
+               {
+                  log.debug(this + " blocking on the failover lock, waiting for failover to start");
+                  failoverStatusLock.wait(startToWait);
+                  log.debug(this + " releasing the failover lock, checking again whether failover started ...");
+               }
+               catch (InterruptedException ignore)
+               {                  
+               }
+               startToWait -= System.currentTimeMillis() - start;              
+            }
+         }        
+      }
+   }
+   
+   public void checkClientID(String clientID) throws Exception
+   {   
+      // verify the clientID is unique
+   
+      // JMS 1.1 Specifications, Section 4.3.2:
+      // "By definition, the client state identified by a client identifier can be 'in use' by
+      // only one client at a time. A JMS provider must prevent concurrently executing clients
+      // from using it."
+      
+      if (clientID != null)
+      {            
+         List conns = connectionManager.getActiveConnections();
+      
+         for(Iterator i = conns.iterator(); i.hasNext(); )
+         {
+            ServerConnectionEndpoint sce = (ServerConnectionEndpoint)i.next();
+            if (clientID != null && clientID.equals(sce.getClientID()))
+            {
+               throw new InvalidClientIDException(
+                  "Client ID '" + clientID + "' already used by " + sce);
+            }
+         }
+      }
+   }
+   
+   public String toString()
+   {
+      return "ServerPeer[" + getServerPeerID() + "]";
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+  
+   private void initializeRemoting(MBeanServer mbeanServer) throws Exception
+   {
+      JMSWireFormat wf = new JMSWireFormat();
+
+      MarshalFactory.addMarshaller("jms", wf, wf);
+
+      handler = new JMSServerInvocationHandler();
+   }
+
+   private void loadServerAOPConfig() throws Exception
+   {
+      URL url = this.getClass().getClassLoader().getResource("aop-messaging-server.xml");
+      AspectXmlLoader.deployXML(url, this.getClass().getClassLoader());
+   }
+
+   private void unloadServerAOPConfig() throws Exception
+   {
+      URL url = this.getClass().getClassLoader().getResource("aop-messaging-server.xml");
+      AspectXmlLoader.undeployXML(url);
+   }
+
+   private void loadClientAOPConfig() throws Exception
+   {
+      // Note the file is called aop-messaging-client.xml NOT messaging-client-aop.xml. This is
+      // because the JBoss will automatically deploy any files ending with aop.xml; we do not want
+      // this to happen for the client config
+
+      URL url = this.getClass().getClassLoader().getResource("aop-messaging-client.xml");
+      InputStream is = null;
+      ByteArrayOutputStream os = new ByteArrayOutputStream();
+      try
+      {
+         is = url.openStream();
+         int b;
+         while ((b = is.read()) != -1)
+         {
+            os.write(b);
+         }
+         os.flush();
+         clientAOPStack = os.toByteArray();
+      }
+      finally
+      {
+         if (is != null)
+         {
+            is.close();
+         }
+         if (os != null)
+         {
+            os.close();
+         }
+      }
+   }
+
+   private String deployDestinationDefault(boolean isQueue, String name, String jndiName)
+      throws Exception
+   {
+      //
+      // TODO - THIS IS A TEMPORARY IMPLEMENTATION; WILL BE REPLACED WITH INTEGRATION-CONSISTENT ONE
+      // TODO - if I find a way not using UnifiedClassLoader3 directly, then get rid of
+      //        <path refid="jboss.jmx.classpath"/> from jms/build.xml dependentmodule.classpath
+      //
+
+      //TODO - Yes this is super-ugly - there must be an easier way of doing it
+      //also in LocalTestServer is doing the same thing in a slightly different way
+      //this should be combined
+
+      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);
+
+      String destinationMBeanConfig =
+         "<mbean code=\"" + className + "\" " +
+         "       name=\"" + ons + "\" " +
+         "       xmbean-dd=\"xmdesc/" + destType + "-xmbean.xml\">\n" +
+         "    <constructor>" +
+         "        <arg type=\"boolean\" value=\"true\"/>" +
+         "    </constructor>" +
+         "</mbean>";
+
+      return deployDestinationInternal(destinationMBeanConfig, on, jndiName, false, -1, -1, -1);
+   }
+   
+   private String deployDestination(boolean isQueue, String name, String jndiName, int fullSize,
+            int pageSize, int downCacheSize) throws Exception
+   {
+      //    
+      //    TODO - THIS IS A TEMPORARY IMPLEMENTATION; WILL BE REPLACED WITH INTEGRATION-CONSISTENT ONE
+      //    TODO - if I find a way not using UnifiedClassLoader3 directly, then get rid of
+      //    <path refid="jboss.jmx.classpath"/> from jms/build.xml dependentmodule.classpath
+      //    
+      
+      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);
+      
+      String destinationMBeanConfig =
+         "<mbean code=\"" + className + "\" " +
+         "       name=\"" + ons + "\" " +
+         "       xmbean-dd=\"xmdesc/" + destType + "-xmbean.xml\">\n" +
+         "    <constructor>" +
+         "        <arg type=\"boolean\" value=\"true\"/>" +
+         "    </constructor>" +
+         "    <attribute name=\"FullSize\">" + fullSize + "</attribute>" +
+         "    <attribute name=\"PageSize\">" + pageSize + "</attribute>" +
+         "    <attribute name=\"DownCacheSize\">" + downCacheSize + "</attribute>" +
+         "</mbean>";
+      
+      return deployDestinationInternal(destinationMBeanConfig, on, jndiName, true, fullSize,
+               pageSize, downCacheSize);
+   }
+
+   private String deployDestinationInternal(String destinationMBeanConfig, ObjectName on,
+                                            String jndiName, boolean params, int fullSize,
+                                            int pageSize, int downCacheSize) throws Exception
+   {
+      MBeanServer mbeanServer = getServer();
+
+      Element element = Util.stringToElement(destinationMBeanConfig);
+
+      ServiceCreator sc = new ServiceCreator(mbeanServer);
+
+      ClassLoader cl = this.getClass().getClassLoader();
+      ObjectName loaderObjectName = null;
+      if (cl instanceof UnifiedClassLoader3)
+      {
+         loaderObjectName = ((UnifiedClassLoader3)cl).getObjectName();
+      }
+
+      sc.install(on, loaderObjectName, element);
+
+      // inject dependencies
+      mbeanServer.setAttribute(on, new Attribute("ServerPeer", getServiceName()));
+      mbeanServer.setAttribute(on, new Attribute("JNDIName", jndiName));
+      if (params)
+      {
+         mbeanServer.setAttribute(on, new Attribute("FullSize", new Integer(fullSize)));
+         mbeanServer.setAttribute(on, new Attribute("PageSize", new Integer(pageSize)));
+         mbeanServer.setAttribute(on, new Attribute("DownCacheSize", new Integer(downCacheSize)));
+      }
+      mbeanServer.invoke(on, "create", new Object[0], new String[0]);
+      mbeanServer.invoke(on, "start", new Object[0], new String[0]);
+
+      return (String)mbeanServer.getAttribute(on, "JNDIName");
+
+      //
+      // end of TODO
+      //
+   }
+
+   
+
+   /*
+    * Undeploy the MBean but don't delete the underlying data
+    */
+   private boolean undeployDestination(boolean isQueue, String name) throws Exception
+   {
+      String destType = isQueue ? "Queue" : "Topic";
+      String ons ="jboss.messaging.destination:service=" + destType + ",name=" + name;
+      ObjectName on = new ObjectName(ons);
+
+      MBeanServer mbeanServer = getServer();
+
+      // we can only undeploy destinations that exist AND that have been created programatically
+      if (!mbeanServer.isRegistered(on))
+      {
+         return false;
+      }
+      Boolean b = (Boolean)mbeanServer.getAttribute(on, "CreatedProgrammatically");
+      if (!b.booleanValue())
+      {
+         log.warn("Cannot undeploy a destination that has not been created programatically");
+         return false;
+      }
+      mbeanServer.invoke(on, "stop", new Object[0], new String[0]);
+      mbeanServer.invoke(on, "destroy", new Object[0], new String[0]);
+      mbeanServer.unregisterMBean(on);
+      return true;
+   }
+   
+   /*
+    * Undeploy the MBean and delete the underlying data
+    */
+   private boolean destroyDestination(boolean isQueue, String name) throws Exception
+   {
+      String destType = isQueue ? "Queue" : "Topic";
+      String ons ="jboss.messaging.destination:service=" + destType + ",name=" + name;
+      ObjectName on = new ObjectName(ons);
+
+      MBeanServer mbeanServer = getServer();
+
+      // we can only destroy destinations that exist AND that have been created programatically
+      if (!mbeanServer.isRegistered(on))
+      {
+         return false;
+      }
+                  
+      //First deactivate
+      
+      if (isQueue)
+      {
+         Binding binding = postOffice.getBindingForQueueName(name);
+         
+         if (binding != null)
+         {
+            binding.getQueue().deactivate();
+         }
+      }
+      else
+      {
+         JMSCondition topicCond = new JMSCondition(false, name);    
+         
+         Collection bindings = postOffice.getBindingsForCondition(topicCond);
+         
+         Iterator iter = bindings.iterator();
+         while (iter.hasNext())            
+         {
+            Binding binding = (Binding)iter.next();
+            
+            binding.getQueue().deactivate();
+         }
+      }
+            
+      //Delete any message data
+      
+      mbeanServer.invoke(on, "removeAllMessages", null, null);
+      
+      //undeploy the mbean
+      if (!undeployDestination(isQueue, name))
+      {
+         return false;
+      }
+            
+      //Unbind from the post office
+      
+      if (isQueue)
+      {
+         Binding binding = postOffice.getBindingForQueueName(name);
+         
+         if (binding != null)
+         {
+            try
+            {
+               Queue queue = binding.getQueue();
+               if (!queue.isClustered())
+               {
+                  postOffice.unbindQueue(queue.getName());
+               }
+               else
+               {
+                  ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
+               }
+            }
+            catch (Throwable t)
+            {
+               throw new Exception("Failed to unbind queue", t);
+            }
+         }
+      }
+      else
+      {
+         JMSCondition topicCond = new JMSCondition(false, name);    
+         
+         Collection bindings = postOffice.getBindingsForCondition(topicCond);
+         
+         Iterator iter = bindings.iterator();
+         while (iter.hasNext())            
+         {
+            Binding binding = (Binding)iter.next();
+            
+            try
+            {
+               postOffice.unbindQueue(binding.getQueue().getName());
+            }
+            catch (Throwable t)
+            {
+               throw new Exception("Failed to unbind queue", t);
+            }
+         }
+      }
+      return true;
+   }
+   
+
+   // Inner classes --------------------------------------------------------------------------------
+   
+   private class FailoverListener implements ReplicationListener
+   {
+      public void onReplicationChange(Serializable key, Map updatedReplicantMap,
+                                      boolean added, int originatingNodeId)
+      {
+         if (key.equals(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY))
+         {
+            if (updatedReplicantMap != null && originatingNodeId == serverPeerID)
+            {
+               FailoverStatus status =
+                  (FailoverStatus)updatedReplicantMap.get(new Integer(serverPeerID));
+               
+               if (status != null && status.isFailedOver())
+               {                     
+                  // We prompt txRepository to load any prepared txs - so we can take over
+                  // responsibility for in doubt transactions from other nodes
+                  try
+                  {
+                     txRepository.loadPreparedTransactions();
+                  }
+                  catch (Exception e)
+                  {
+                     log.error("Failed to load prepared transactions", e);
+                  }
+               }
+            }
+            
+            synchronized (failoverStatusLock)
+            {
+               log.debug(ServerPeer.this +
+                  ".FailoverListener got failover event, notifying those waiting on lock");
+               
+               failoverStatusLock.notifyAll();
+            }
+         }         
+      }      
+   }
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,589 +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.endpoint;
-
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.selector.Selector;
-import org.jboss.jms.server.ConnectionManager;
-import org.jboss.jms.server.destination.TopicService;
-import org.jboss.jms.server.messagecounter.MessageCounter;
-import org.jboss.jms.util.ExceptionUtil;
-import org.jboss.jms.wireformat.ClientDelivery;
-import org.jboss.jms.wireformat.Dispatcher;
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.Channel;
-import org.jboss.messaging.core.Delivery;
-import org.jboss.messaging.core.DeliveryObserver;
-import org.jboss.messaging.core.Queue;
-import org.jboss.messaging.core.Receiver;
-import org.jboss.messaging.core.SimpleDelivery;
-import org.jboss.messaging.core.message.Message;
-import org.jboss.messaging.core.message.MessageReference;
-import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
-import org.jboss.messaging.core.plugin.contract.PostOffice;
-import org.jboss.messaging.core.plugin.postoffice.Binding;
-import org.jboss.messaging.core.tx.Transaction;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.callback.Callback;
-import org.jboss.remoting.callback.HandleCallbackException;
-import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
-
-/**
- * Concrete implementation of ConsumerEndpoint. Lives on the boundary between Messaging Core and the
- * JMS Facade. Handles delivery of messages from the server to the client side consumer.
- * 
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt> $Id$
- */
-public class ServerConsumerEndpoint implements Receiver, ConsumerEndpoint
-{
-   // Constants ------------------------------------------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(ServerConsumerEndpoint.class);
-
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   private boolean trace = log.isTraceEnabled();
-
-   private int id;
-
-   private Channel messageQueue;
-
-   private String queueName;
-
-   private ServerSessionEndpoint sessionEndpoint;
-
-   private ServerInvokerCallbackHandler callbackHandler;
-
-   private boolean noLocal;
-
-   private Selector messageSelector;
-
-   private JBossDestination destination;
-
-   private Queue dlq;
-
-   private Queue expiryQueue;
-
-   private long redeliveryDelay;
-
-   private boolean started;
-
-   // This lock protects starting and stopping
-   private Object startStopLock;
-
-   // Must be volatile
-   private volatile boolean clientAccepting;
-
-   private boolean storeDeliveries;
-   
-   private long lastDeliveryID = -1;
-   
-   // Constructors ---------------------------------------------------------------------------------
-
-   ServerConsumerEndpoint(int id, Channel messageQueue, String queueName,
-            ServerSessionEndpoint sessionEndpoint, String selector,
-            boolean noLocal, JBossDestination dest, Queue dlq,
-            Queue expiryQueue, long redeliveryDelay)
-            throws InvalidSelectorException
-   {
-      if (trace)
-      {
-         log.trace("constructing consumer endpoint " + id);
-      }
-
-      this.id = id;
-
-      this.messageQueue = messageQueue;
-
-      this.queueName = queueName;
-
-      this.sessionEndpoint = sessionEndpoint;
-
-      this.callbackHandler = sessionEndpoint.getConnectionEndpoint()
-               .getCallbackHandler();
-
-      this.noLocal = noLocal;
-
-      this.destination = dest;
-
-      this.dlq = dlq;
-
-      this.redeliveryDelay = redeliveryDelay;
-
-      this.expiryQueue = expiryQueue;
-
-      // Always start as false - wait for consumer to initiate.
-      this.clientAccepting = false;
-
-      this.startStopLock = new Object();
-
-      if (dest.isTopic() && !messageQueue.isRecoverable())
-      {
-         // This is a consumer of a non durable topic subscription. We don't need to store
-         // deliveries since if the consumer is closed or dies the refs go too.
-         this.storeDeliveries = false;
-      }
-      else
-      {
-         this.storeDeliveries = true;
-      }
-
-      //For now always true - revisit later
-      storeDeliveries = true;
-
-      if (selector != null)
-      {
-         if (trace) { log.trace("creating selector:" + selector); }
-
-         this.messageSelector = new Selector(selector);
-         if (trace) { log.trace("created selector"); }
-      }
-
-      this.started = this.sessionEndpoint.getConnectionEndpoint().isStarted();
-      
-      // adding the consumer to the queue
-      this.messageQueue.add(this);
-
-      // We don't need to prompt delivery - this will come from the client in a changeRate request
-
-      log.debug(this + " constructed");
-   }
-
-   // Receiver implementation ----------------------------------------------------------------------
-
-   /*
-    * The queue ensures that handle is never called concurrently by more than
-    * one thread.
-    */
-   public Delivery handle(DeliveryObserver observer, MessageReference ref,
-            Transaction tx)
-   {
-      if (trace)
-      {
-         log.trace(this + " receives " + ref + " for delivery");
-      }
-
-      // This is ok to have outside lock - is volatile
-      if (!clientAccepting)
-      {
-         if (trace) { log.trace(this + "'s client is NOT accepting messages!"); }
-
-         return null;
-      }
-
-      if (ref.getMessage().isExpired())
-      {
-         SimpleDelivery delivery = new SimpleDelivery(observer, ref, true);
-
-         try
-         {
-            sessionEndpoint.expireDelivery(delivery, expiryQueue);
-         }
-         catch (Throwable t)
-         {
-            log.error("Failed to expire delivery: " + delivery, t);
-         }
-
-         return delivery;
-      }
-
-      synchronized (startStopLock)
-      {
-         // If the consumer is stopped then we don't accept the message, it should go back into the
-         // queue for delivery later.
-         if (!started)
-         {
-            if (trace) { log.trace(this + " NOT started yet!"); }
-
-            return null;
-         }
-         
-         if (trace) { log.trace(this + " has startStopLock lock, preparing the message for delivery"); }
-
-         Message message = ref.getMessage();
-
-         boolean selectorRejected = !this.accept(message);
-
-         SimpleDelivery delivery = new SimpleDelivery(observer, ref,
-                  !storeDeliveries, !selectorRejected);
-
-         if (selectorRejected)
-         {
-            return delivery;
-         }
-
-         long deliveryId;
-
-         if (storeDeliveries)
-         {
-            deliveryId = sessionEndpoint.addDelivery(delivery, id, dlq, expiryQueue, redeliveryDelay);
-         }
-         else
-         {
-            deliveryId = -1;
-         }
-
-         // We send the message to the client on the current thread. The message is written onto the
-         // transport and then the thread returns immediately without waiting for a response.
-
-         Client callbackClient = callbackHandler.getCallbackClient();
-
-         ClientDelivery del = new ClientDelivery(message, id, deliveryId, ref.getDeliveryCount());
-
-         Callback callback = new Callback(del);
-
-         try
-         {
-            // FIXME - due a design (flaw??) in the socket based transports, they use a pool of TCP
-            // connections, so subsequent invocations can end up using different underlying
-            // connections meaning that later invocations can overtake earlier invocations, if there
-            // are more than one user concurrently invoking on the same transport. We need someway
-            // of pinning the client object to the underlying invocation. For now we just serialize
-            // all access so that only the first connection in the pool is ever used - bit this is
-            // far from ideal!!!
-            // See http://jira.jboss.com/jira/browse/JBMESSAGING-789
-
-            Object invoker = null;
-
-            if (callbackClient != null)
-            {
-               invoker = callbackClient.getInvoker();
-                              
-            }
-            else
-            {
-               // TODO: dummy synchronization object, in case there's no clientInvoker. This will
-               // happen during the first invocation anyway. It's a kludge, I know, but this whole
-               // synchronization thing is a huge kludge. Needs to be reviewed.
-               invoker = new Object();
-            }
-            
-            synchronized (invoker)
-            {
-               // one way invocation, no acknowledgment sent back by the client
-               if (trace) { log.trace(this + " submitting message " + message + " to the remoting layer to be sent asynchronously"); }
-               
-               callbackHandler.handleCallbackOneway(callback);
-               
-               //We store the delivery id so we know to wait for any deliveries in transit on close
-               this.lastDeliveryID = deliveryId;
-            }
-         }
-         catch (HandleCallbackException e)
-         {
-            // it's an oneway callback, so exception could only have happened on the server, while
-            // trying to send the callback. This is a good reason to smack the whole connection.
-            // I trust remoting to have already done its own cleanup via a CallbackErrorHandler,
-            // I need to do my own cleanup at ConnectionManager level.
-
-            log.debug(this + " failed to handle callback", e);
-
-            ServerConnectionEndpoint sce = sessionEndpoint.getConnectionEndpoint();
-            ConnectionManager cm = sce.getServerPeer().getConnectionManager();
-
-            cm.handleClientFailure(sce.getRemotingClientSessionID(), false);
-
-            // we're practically cut, from connection down
-
-            return null;
-         }
-
-         return delivery;
-      }
-   }
-
-   // Filter implementation ------------------------------------------------------------------------
-
-   public boolean accept(Message msg)
-   {
-      boolean accept = true;
-
-      if (destination.isQueue())
-      {
-         // For subscriptions message selection is handled in the Subscription itself we do not want
-         // to do the check twice
-         if (messageSelector != null)
-         {
-            accept = messageSelector.accept(msg);
-
-            if (trace) { log.trace("message selector " + (accept ? "accepts " : "DOES NOT accept ") + "the message"); }
-         }
-      }
-
-      if (accept)
-      {
-         if (noLocal)
-         {
-            int conId = ((JBossMessage) msg).getConnectionID();
-
-            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }
-
-            accept = conId != sessionEndpoint.getConnectionEndpoint().getConnectionID();
-
-            if (trace) { log.trace("accepting? " + accept); }
-         }
-      }
-      return accept;
-   }
-
-   // Closeable implementation ---------------------------------------------------------------------
-
-   public long closing() throws JMSException
-   {
-      try
-      {
-         if (trace) { log.trace(this + " closing");}
-
-         stop();
-         
-         return lastDeliveryID;
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " closing");
-      }
-   }
-
-   public void close() throws JMSException
-   {
-      try
-      {
-         if (trace)
-         {
-            log.trace(this + " close");
-         }
-
-         localClose();
-
-         sessionEndpoint.removeConsumer(id);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " close");
-      }
-   }
-
-   // ConsumerEndpoint implementation --------------------------------------------------------------
-
-   public void changeRate(float newRate) throws JMSException
-   {
-      if (trace)
-      {
-         log.trace(this + " changing rate to " + newRate);
-      }
-
-      try
-      {
-         // For now we just support a binary on/off.
-         // The client will send newRate = 0, to say it does not want any more messages when its
-         // client side buffer gets full or it will send an arbitrary non zero number to say it
-         // does want more messages, when its client side buffer empties to half its full size.
-         // Note the client does not wait until the client side buffer is empty before sending a
-         // newRate(+ve) message since this would add extra latency.
-
-         // In the future we can fine tune this by allowing the client to specify an actual rate in
-         // the newRate value so this is basically a placeholder for the future so we don't have to
-         // change the wire format when we support it.
-
-         // No need to synchronize - clientAccepting is volatile.
-
-         if (newRate > 0)
-         {
-            clientAccepting = true;
-         }
-         else
-         {
-            clientAccepting = false;
-         }
-
-         if (clientAccepting)
-         {
-            promptDelivery();
-         }
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " changeRate");
-      }
-   }
-
-   // Public ---------------------------------------------------------------------------------------
-
-   public String toString()
-   {
-      return "ConsumerEndpoint[" + id + "]";
-   }
-
-   public JBossDestination getDestination()
-   {
-      return destination;
-   }
-
-   public ServerSessionEndpoint getSessionEndpoint()
-   {
-      return sessionEndpoint;
-   }
-
-   // Package protected ----------------------------------------------------------------------------
-
-   Queue getDLQ()
-   {
-      return dlq;
-   }
-
-   Queue getExpiryQueue()
-   {
-      return expiryQueue;
-   }
-
-   long getRedliveryDelay()
-   {
-      return redeliveryDelay;
-   }
-
-   void localClose() throws Throwable
-   {
-      if (trace) { log.trace(this + " grabbed the main lock in close() " + this); }
-
-      messageQueue.remove(this);
-
-      Dispatcher.instance.unregisterTarget(id, this);
-
-      // If this is a consumer of a non durable subscription then we want to unbind the
-      // subscription and delete all its data.
-
-      if (destination.isTopic())
-      {
-         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint()
-                  .getServerPeer().getPostOfficeInstance();
-
-         Binding binding = postOffice.getBindingForQueueName(queueName);
-
-         // Note binding can be null since there can many competing subscribers for the
-         // subscription - in which case the first will have removed the subscription and
-         // subsequently ones won't find it
-
-         if (binding != null && !binding.getQueue().isRecoverable())
-         {
-            Queue queue = binding.getQueue();
-            if (!queue.isClustered())
-            {
-               postOffice.unbindQueue(queue.getName());
-            }
-            else
-            {
-               ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
-            }
-
-            String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
-
-            MessageCounter counter = sessionEndpoint.getConnectionEndpoint()
-                     .getServerPeer().getMessageCounterManager()
-                     .unregisterMessageCounter(counterName);
-
-            if (counter == null)
-            {
-               throw new IllegalStateException("Cannot find counter to remove " + counterName);
-            }
-         }
-      }
-
-   }
-
-   void start()
-   {
-      synchronized (startStopLock)
-      {
-         if (started)
-         {
-            return;
-         }
-
-         started = true;
-      }
-
-      // Prompt delivery
-      promptDelivery();
-   }
-
-   void stop() throws Throwable
-   {
-      synchronized (startStopLock)
-      {
-         if (!started)
-         {
-            return;
-         }
-
-         started = false;
-         
-         // Any message deliveries already transit to the consumer, will just be ignored by the
-         // MessageCallbackHandler since it will be closed.
-         //
-         // To clarify, the close protocol (from connection) is as follows:
-         //
-         // 1) MessageCallbackHandler::close() - any messages in buffer are cancelled to the server
-         // session, and any subsequent receive messages will be ignored.
-         //
-         // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to
-         // deliver to the client callback handler.
-         //
-         // 3) MessageCallbackHandler waits for all deliveries to arrive at client side
-         //
-         // 4) ServerConsumerEndpoint:close() - endpoint is deregistered.
-         //
-         // 5) Session.close() - acks or cancels any remaining deliveries in the SessionState as
-         // appropriate.
-         //
-         // 6) ServerSessionEndpoint::close() - cancels any remaining deliveries and deregisters
-         // session.
-         //
-         // 7) Client side session executor is shutdown.
-         //
-         // 8) ServerConnectionEndpoint::close() - connection is deregistered.
-         //
-         // 9) Remoting connection listener is removed and remoting connection stopped.
-
-      }
-   }
-
-   // Protected ------------------------------------------------------------------------------------
-
-   // Private --------------------------------------------------------------------------------------
-
-   private void promptDelivery()
-   {
-      sessionEndpoint.promptDelivery(messageQueue);
-   }
-
-   // Inner classes --------------------------------------------------------------------------------
-
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java (from rev 2560, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,601 @@
+/*
+ * 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.endpoint;
+
+import javax.jms.IllegalStateException;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.selector.Selector;
+import org.jboss.jms.server.ConnectionManager;
+import org.jboss.jms.server.destination.TopicService;
+import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.util.ExceptionUtil;
+import org.jboss.jms.wireformat.ClientDelivery;
+import org.jboss.jms.wireformat.Dispatcher;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Channel;
+import org.jboss.messaging.core.Delivery;
+import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.core.Receiver;
+import org.jboss.messaging.core.SimpleDelivery;
+import org.jboss.messaging.core.message.Message;
+import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
+import org.jboss.messaging.core.plugin.contract.PostOffice;
+import org.jboss.messaging.core.plugin.postoffice.Binding;
+import org.jboss.messaging.core.tx.Transaction;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+
+/**
+ * Concrete implementation of ConsumerEndpoint. Lives on the boundary between Messaging Core and the
+ * JMS Facade. Handles delivery of messages from the server to the client side consumer.
+ * 
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt> $Id$
+ */
+public class ServerConsumerEndpoint implements Receiver, ConsumerEndpoint
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(ServerConsumerEndpoint.class);
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private boolean trace = log.isTraceEnabled();
+
+   private int id;
+
+   private Channel messageQueue;
+
+   private String queueName;
+
+   private ServerSessionEndpoint sessionEndpoint;
+
+   private ServerInvokerCallbackHandler callbackHandler;
+
+   private boolean noLocal;
+
+   private Selector messageSelector;
+
+   private JBossDestination destination;
+
+   private Queue dlq;
+
+   private Queue expiryQueue;
+
+   private long redeliveryDelay;
+
+   private boolean started;
+
+   // This lock protects starting and stopping
+   private Object startStopLock;
+
+   // Must be volatile
+   private volatile boolean clientAccepting;
+
+   private boolean storeDeliveries;
+   
+   private long lastDeliveryID = -1;
+   
+   // Constructors ---------------------------------------------------------------------------------
+
+   ServerConsumerEndpoint(int id, Channel messageQueue, String queueName,
+            ServerSessionEndpoint sessionEndpoint, String selector,
+            boolean noLocal, JBossDestination dest, Queue dlq,
+            Queue expiryQueue, long redeliveryDelay)
+            throws InvalidSelectorException
+   {
+      if (trace)
+      {
+         log.trace("constructing consumer endpoint " + id);
+      }
+
+      this.id = id;
+
+      this.messageQueue = messageQueue;
+
+      this.queueName = queueName;
+
+      this.sessionEndpoint = sessionEndpoint;
+
+      this.callbackHandler = sessionEndpoint.getConnectionEndpoint()
+               .getCallbackHandler();
+
+      this.noLocal = noLocal;
+
+      this.destination = dest;
+
+      this.dlq = dlq;
+
+      this.redeliveryDelay = redeliveryDelay;
+
+      this.expiryQueue = expiryQueue;
+
+      // Always start as false - wait for consumer to initiate.
+      this.clientAccepting = false;
+
+      this.startStopLock = new Object();
+
+      if (dest.isTopic() && !messageQueue.isRecoverable())
+      {
+         // This is a consumer of a non durable topic subscription. We don't need to store
+         // deliveries since if the consumer is closed or dies the refs go too.
+         this.storeDeliveries = false;
+      }
+      else
+      {
+         this.storeDeliveries = true;
+      }
+
+      //For now always true - revisit later
+      storeDeliveries = true;
+
+      if (selector != null)
+      {
+         if (trace) { log.trace("creating selector:" + selector); }
+
+         this.messageSelector = new Selector(selector);
+         if (trace) { log.trace("created selector"); }
+      }
+
+      this.started = this.sessionEndpoint.getConnectionEndpoint().isStarted();
+      
+      // adding the consumer to the queue
+      this.messageQueue.add(this);
+
+      // We don't need to prompt delivery - this will come from the client in a changeRate request
+
+      log.debug(this + " constructed");
+   }
+
+   // Receiver implementation ----------------------------------------------------------------------
+
+   /*
+    * The queue ensures that handle is never called concurrently by more than
+    * one thread.
+    */
+   public Delivery handle(DeliveryObserver observer, MessageReference ref,
+            Transaction tx)
+   {
+      if (trace)
+      {
+         log.trace(this + " receives " + ref + " for delivery");
+      }
+
+      // This is ok to have outside lock - is volatile
+      if (!clientAccepting)
+      {
+         if (trace) { log.trace(this + "'s client is NOT accepting messages!"); }
+
+         return null;
+      }
+
+      if (ref.getMessage().isExpired())
+      {
+         SimpleDelivery delivery = new SimpleDelivery(observer, ref, true);
+
+         try
+         {
+            sessionEndpoint.expireDelivery(delivery, expiryQueue);
+         }
+         catch (Throwable t)
+         {
+            log.error("Failed to expire delivery: " + delivery, t);
+         }
+
+         return delivery;
+      }
+
+      synchronized (startStopLock)
+      {
+         // If the consumer is stopped then we don't accept the message, it should go back into the
+         // queue for delivery later.
+         if (!started)
+         {
+            if (trace) { log.trace(this + " NOT started yet!"); }
+
+            return null;
+         }
+         
+         if (trace) { log.trace(this + " has startStopLock lock, preparing the message for delivery"); }
+
+         Message message = ref.getMessage();
+
+         boolean selectorRejected = !this.accept(message);
+
+         SimpleDelivery delivery = new SimpleDelivery(observer, ref,
+                  !storeDeliveries, !selectorRejected);
+
+         if (selectorRejected)
+         {
+            return delivery;
+         }
+
+         long deliveryId;
+
+         if (storeDeliveries)
+         {
+            deliveryId = sessionEndpoint.addDelivery(delivery, id, dlq, expiryQueue, redeliveryDelay);
+         }
+         else
+         {
+            deliveryId = -1;
+         }
+
+         // We send the message to the client on the current thread. The message is written onto the
+         // transport and then the thread returns immediately without waiting for a response.
+
+         Client callbackClient = callbackHandler.getCallbackClient();
+
+         ClientDelivery del = new ClientDelivery(message, id, deliveryId, ref.getDeliveryCount());
+
+         Callback callback = new Callback(del);
+
+         try
+         {
+            // FIXME - due a design (flaw??) in the socket based transports, they use a pool of TCP
+            // connections, so subsequent invocations can end up using different underlying
+            // connections meaning that later invocations can overtake earlier invocations, if there
+            // are more than one user concurrently invoking on the same transport. We need someway
+            // of pinning the client object to the underlying invocation. For now we just serialize
+            // all access so that only the first connection in the pool is ever used - bit this is
+            // far from ideal!!!
+            // See http://jira.jboss.com/jira/browse/JBMESSAGING-789
+
+            Object invoker = null;
+
+            if (callbackClient != null)
+            {
+               invoker = callbackClient.getInvoker();
+                              
+            }
+            else
+            {
+               // TODO: dummy synchronization object, in case there's no clientInvoker. This will
+               // happen during the first invocation anyway. It's a kludge, I know, but this whole
+               // synchronization thing is a huge kludge. Needs to be reviewed.
+               invoker = new Object();
+            }
+            
+            synchronized (invoker)
+            {
+               // one way invocation, no acknowledgment sent back by the client
+               if (trace) { log.trace(this + " submitting message " + message + " to the remoting layer to be sent asynchronously"); }
+               
+               callbackHandler.handleCallbackOneway(callback);
+               
+               //We store the delivery id so we know to wait for any deliveries in transit on close
+               this.lastDeliveryID = deliveryId;
+            }
+         }
+         catch (HandleCallbackException e)
+         {
+            // it's an oneway callback, so exception could only have happened on the server, while
+            // trying to send the callback. This is a good reason to smack the whole connection.
+            // I trust remoting to have already done its own cleanup via a CallbackErrorHandler,
+            // I need to do my own cleanup at ConnectionManager level.
+
+            log.debug(this + " failed to handle callback", e);
+
+            /*
+
+            TODO: http://jira.jboss.org/jira/browse/JBMESSAGING-928
+                  We need to fix the lock condition caused by handleClientFailure (the promotion of the readLock to writeLock,
+                  cause a infinite wait on read locks that will need synchronized methods...
+                  We will relay on Lease until we can fix this.
+
+                  due to a time constraint to fix a production issue on an user, I have removed this condition until we can
+                  perform this condition without a risk while we will create a testcase for this condition.
+
+                  
+
+            ServerConnectionEndpoint sce = sessionEndpoint.getConnectionEndpoint();
+            ConnectionManager cm = sce.getServerPeer().getConnectionManager();
+
+            cm.handleClientFailure(sce.getRemotingClientSessionID(), false); */
+
+            // we're practically cut, from connection down
+
+            return null;
+         }
+
+         return delivery;
+      }
+   }
+
+   // Filter implementation ------------------------------------------------------------------------
+
+   public boolean accept(Message msg)
+   {
+      boolean accept = true;
+
+      if (destination.isQueue())
+      {
+         // For subscriptions message selection is handled in the Subscription itself we do not want
+         // to do the check twice
+         if (messageSelector != null)
+         {
+            accept = messageSelector.accept(msg);
+
+            if (trace) { log.trace("message selector " + (accept ? "accepts " : "DOES NOT accept ") + "the message"); }
+         }
+      }
+
+      if (accept)
+      {
+         if (noLocal)
+         {
+            int conId = ((JBossMessage) msg).getConnectionID();
+
+            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }
+
+            accept = conId != sessionEndpoint.getConnectionEndpoint().getConnectionID();
+
+            if (trace) { log.trace("accepting? " + accept); }
+         }
+      }
+      return accept;
+   }
+
+   // Closeable implementation ---------------------------------------------------------------------
+
+   public long closing() throws JMSException
+   {
+      try
+      {
+         if (trace) { log.trace(this + " closing");}
+
+         stop();
+         
+         return lastDeliveryID;
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " closing");
+      }
+   }
+
+   public void close() throws JMSException
+   {
+      try
+      {
+         if (trace)
+         {
+            log.trace(this + " close");
+         }
+
+         localClose();
+
+         sessionEndpoint.removeConsumer(id);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " close");
+      }
+   }
+
+   // ConsumerEndpoint implementation --------------------------------------------------------------
+
+   public void changeRate(float newRate) throws JMSException
+   {
+      if (trace)
+      {
+         log.trace(this + " changing rate to " + newRate);
+      }
+
+      try
+      {
+         // For now we just support a binary on/off.
+         // The client will send newRate = 0, to say it does not want any more messages when its
+         // client side buffer gets full or it will send an arbitrary non zero number to say it
+         // does want more messages, when its client side buffer empties to half its full size.
+         // Note the client does not wait until the client side buffer is empty before sending a
+         // newRate(+ve) message since this would add extra latency.
+
+         // In the future we can fine tune this by allowing the client to specify an actual rate in
+         // the newRate value so this is basically a placeholder for the future so we don't have to
+         // change the wire format when we support it.
+
+         // No need to synchronize - clientAccepting is volatile.
+
+         if (newRate > 0)
+         {
+            clientAccepting = true;
+         }
+         else
+         {
+            clientAccepting = false;
+         }
+
+         if (clientAccepting)
+         {
+            promptDelivery();
+         }
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " changeRate");
+      }
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public String toString()
+   {
+      return "ConsumerEndpoint[" + id + "]";
+   }
+
+   public JBossDestination getDestination()
+   {
+      return destination;
+   }
+
+   public ServerSessionEndpoint getSessionEndpoint()
+   {
+      return sessionEndpoint;
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   Queue getDLQ()
+   {
+      return dlq;
+   }
+
+   Queue getExpiryQueue()
+   {
+      return expiryQueue;
+   }
+
+   long getRedliveryDelay()
+   {
+      return redeliveryDelay;
+   }
+
+   void localClose() throws Throwable
+   {
+      if (trace) { log.trace(this + " grabbed the main lock in close() " + this); }
+
+      messageQueue.remove(this);
+
+      Dispatcher.instance.unregisterTarget(id, this);
+
+      // If this is a consumer of a non durable subscription then we want to unbind the
+      // subscription and delete all its data.
+
+      if (destination.isTopic())
+      {
+         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint()
+                  .getServerPeer().getPostOfficeInstance();
+
+         Binding binding = postOffice.getBindingForQueueName(queueName);
+
+         // Note binding can be null since there can many competing subscribers for the
+         // subscription - in which case the first will have removed the subscription and
+         // subsequently ones won't find it
+
+         if (binding != null && !binding.getQueue().isRecoverable())
+         {
+            Queue queue = binding.getQueue();
+            if (!queue.isClustered())
+            {
+               postOffice.unbindQueue(queue.getName());
+            }
+            else
+            {
+               ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
+            }
+
+            String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
+
+            MessageCounter counter = sessionEndpoint.getConnectionEndpoint()
+                     .getServerPeer().getMessageCounterManager()
+                     .unregisterMessageCounter(counterName);
+
+            if (counter == null)
+            {
+               throw new IllegalStateException("Cannot find counter to remove " + counterName);
+            }
+         }
+      }
+
+   }
+
+   void start()
+   {
+      synchronized (startStopLock)
+      {
+         if (started)
+         {
+            return;
+         }
+
+         started = true;
+      }
+
+      // Prompt delivery
+      promptDelivery();
+   }
+
+   void stop() throws Throwable
+   {
+      synchronized (startStopLock)
+      {
+         if (!started)
+         {
+            return;
+         }
+
+         started = false;
+         
+         // Any message deliveries already transit to the consumer, will just be ignored by the
+         // MessageCallbackHandler since it will be closed.
+         //
+         // To clarify, the close protocol (from connection) is as follows:
+         //
+         // 1) MessageCallbackHandler::close() - any messages in buffer are cancelled to the server
+         // session, and any subsequent receive messages will be ignored.
+         //
+         // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to
+         // deliver to the client callback handler.
+         //
+         // 3) MessageCallbackHandler waits for all deliveries to arrive at client side
+         //
+         // 4) ServerConsumerEndpoint:close() - endpoint is deregistered.
+         //
+         // 5) Session.close() - acks or cancels any remaining deliveries in the SessionState as
+         // appropriate.
+         //
+         // 6) ServerSessionEndpoint::close() - cancels any remaining deliveries and deregisters
+         // session.
+         //
+         // 7) Client side session executor is shutdown.
+         //
+         // 8) ServerConnectionEndpoint::close() - connection is deregistered.
+         //
+         // 9) Remoting connection listener is removed and remoting connection stopped.
+
+      }
+   }
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   private void promptDelivery()
+   {
+      sessionEndpoint.promptDelivery(messageQueue);
+   }
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,1606 +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.endpoint;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.jms.client.delegate.ClientBrowserDelegate;
-import org.jboss.jms.client.delegate.ClientConsumerDelegate;
-import org.jboss.jms.delegate.BrowserDelegate;
-import org.jboss.jms.delegate.ConsumerDelegate;
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.destination.JBossTopic;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.selector.Selector;
-import org.jboss.jms.server.DestinationManager;
-import org.jboss.jms.server.JMSCondition;
-import org.jboss.jms.server.ServerPeer;
-import org.jboss.jms.server.destination.ManagedDestination;
-import org.jboss.jms.server.destination.ManagedQueue;
-import org.jboss.jms.server.destination.ManagedTopic;
-import org.jboss.jms.server.destination.TopicService;
-import org.jboss.jms.server.endpoint.advised.BrowserAdvised;
-import org.jboss.jms.server.endpoint.advised.ConsumerAdvised;
-import org.jboss.jms.server.messagecounter.MessageCounter;
-import org.jboss.jms.util.ExceptionUtil;
-import org.jboss.jms.util.MessageQueueNameHelper;
-import org.jboss.jms.wireformat.Dispatcher;
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.Channel;
-import org.jboss.messaging.core.Delivery;
-import org.jboss.messaging.core.DeliveryObserver;
-import org.jboss.messaging.core.Queue;
-import org.jboss.messaging.core.local.PagingFilteredQueue;
-import org.jboss.messaging.core.message.MessageReference;
-import org.jboss.messaging.core.plugin.IDManager;
-import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
-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.messaging.core.plugin.postoffice.Binding;
-import org.jboss.messaging.core.plugin.postoffice.cluster.LocalClusteredQueue;
-import org.jboss.messaging.core.tx.Transaction;
-import org.jboss.messaging.core.tx.TransactionException;
-import org.jboss.messaging.core.tx.TransactionRepository;
-import org.jboss.messaging.core.tx.TxCallback;
-import org.jboss.util.id.GUID;
-
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
-
-/**
- * The server side representation of a JMS session.
- * 
- * A user must not invoke methods of a session concurrently on different threads, however there are
- * situations where multiple threads may access this object concurrently, for instance:
- * - A session can be closed when it's connection is closed by the user which might be called on a
- *   different thread.
- * - A session can be closed when the server determines the connection is dead.
- *
- * If the session represents a connection consumer's session then the connection consumer will farm
- * off messages to different sessions obtained from a pool, these may then cancel/ack etc on
- * different threads, but the acks/cancels/etc will end up back here on the connection consumer
- * session instance.
- * 
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ServerSessionEndpoint implements SessionEndpoint
-{
-   // Constants ------------------------------------------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(ServerSessionEndpoint.class);
-   
-   static final String TEMP_QUEUE_MESSAGECOUNTER_PREFIX = "TempQueue.";
-   
-   public static final String JBOSS_MESSAGING_ORIG_DESTINATION = "JBM_ORIG_DESTINATION";
-
-   public static final String JBOSS_MESSAGING_ORIG_MESSAGE_ID = "JBM_ORIG_MESSAGE_ID";
-   
-   public static final String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME = "JBM_ACTUAL_EXPIRY";
-   
-   // Static ---------------------------------------------------------------------------------------
-
-   // Attributes -----------------------------------------------------------------------------------
-
-   private boolean trace = log.isTraceEnabled();
-
-   private int id;
-
-   private volatile boolean closed;
-
-   private ServerConnectionEndpoint connectionEndpoint;
-   
-   private ServerPeer sp;
-
-   private Map consumers;
-   private Map browsers;
-
-   private PersistenceManager pm;
-   private MessageStore ms;
-
-   private DestinationManager dm;
-   private IDManager idm;
-   private TransactionRepository tr;
-   private PostOffice postOffice;
-   private int nodeId;
-   private int maxDeliveryAttempts;
-   private Queue defaultDLQ;
-   private Queue defaultExpiryQueue;
-   
-   // Map <deliveryID, Delivery>
-   private Map deliveries;
-   
-   private SynchronizedLong deliveryIdSequence;
-   
-   //Temporary until we have our own NIO transport   
-   QueuedExecutor executor = new QueuedExecutor();
-   
-   // Constructors ---------------------------------------------------------------------------------
-
-   ServerSessionEndpoint(int sessionID, ServerConnectionEndpoint connectionEndpoint)
-      throws Exception
-   {
-      this.id = sessionID;
-
-      this.connectionEndpoint = connectionEndpoint;
-
-      sp = connectionEndpoint.getServerPeer();
-
-      pm = sp.getPersistenceManagerInstance();
-      ms = sp.getMessageStore();
-      dm = sp.getDestinationManager();
-      postOffice = sp.getPostOfficeInstance();     
-      idm = sp.getChannelIDManager();
-      nodeId = sp.getServerPeerID();
-      tr = sp.getTxRepository();
-
-      consumers = new HashMap();
-		browsers = new HashMap();
-      
-      defaultDLQ = sp.getDefaultDLQInstance();
-      defaultExpiryQueue = sp.getDefaultExpiryQueueInstance();
-      tr = sp.getTxRepository();
-      maxDeliveryAttempts = sp.getDefaultMaxDeliveryAttempts();
-      
-      deliveries = new ConcurrentHashMap();
-      
-      deliveryIdSequence = new SynchronizedLong(0);
-   }
-   
-   // SessionDelegate implementation ---------------------------------------------------------------
-       
-   public ConsumerDelegate createConsumerDelegate(JBossDestination jmsDestination,
-                                                  String selector,
-                                                  boolean noLocal,
-                                                  String subscriptionName,
-                                                  boolean isCC) throws JMSException
-   {
-      try
-      {
-//         if (!connectionEndpoint.isFailoverConnection())
-//         {
-            // regular consumer
-            return createConsumerDelegateInternal(jmsDestination, selector,
-                                                  noLocal, subscriptionName);
-  //       }
-
-//         // we're child of a failover connection. Favor failover channels when creating new
-//         // consumers
-//         return createFailoverConsumerDelegateInternal(jmsDestination, selector,
-//                                                       noLocal, subscriptionName,
-//                                                       failoverChannelID);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " createConsumerDelegate");
-      }
-   }
-      
-	public BrowserDelegate createBrowserDelegate(JBossDestination jmsDestination,
-                                                String selector)
-      throws JMSException
-	{
-      try
-      {
-//         if (!connectionEndpoint.isFailoverConnection())
-//         {
-            // regular browser
-            return createBrowserDelegateInternal(jmsDestination, selector);
-//         }
-//
-//         // we're child of a failover connection. Favor failover channels when creating new
-//         // browsers
-//         return createFailoverBrowserDelegateInternal(jmsDestination, selector, failoverChannelID);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " createBrowserDelegate");
-      }
-	}
-
-   public JBossQueue createQueue(String name) throws JMSException
-   {
-      try
-      {
-         if (closed)
-         {
-            throw new IllegalStateException("Session is closed");
-         }
-         
-         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, true);
-         
-         if (dest == null)
-         {
-            throw new JMSException("There is no administratively defined queue with name:" + name);
-         }        
-   
-         return new JBossQueue(dest.getName());
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " createQueue");
-      }
-   }
-
-   public JBossTopic createTopic(String name) throws JMSException
-   {
-      try
-      {
-         if (closed)
-         {
-            throw new IllegalStateException("Session is closed");
-         }
-         
-         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, false);
-                  
-         if (dest == null)
-         {
-            throw new JMSException("There is no administratively defined topic with name:" + name);
-         }        
-   
-         return new JBossTopic(name);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " createTopic");
-      }
-   }
-   
-   public void close() throws JMSException
-   {
-      try
-      {
-         localClose();
-         
-         connectionEndpoint.removeSession(id);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " close");
-      }
-   }
-      
-   public long closing() throws JMSException
-   {
-      // currently does nothing
-      if (trace) log.trace(this + " closing (noop)");
-      
-      return -1;
-   }
- 
-   public void send(JBossMessage message, boolean checkForDuplicates) throws JMSException
-   {
-      try
-      {                
-         connectionEndpoint.sendMessage(message, null, checkForDuplicates);         
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " send");
-      }
-   }
-   
-   public void acknowledgeDelivery(Ack ack) throws JMSException
-   {
-      try
-      {
-         acknowledgeDeliveryInternal(ack);   
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " acknowledgeDelivery");
-      }
-   }     
-         
-   public void acknowledgeDeliveries(List acks) throws JMSException
-   {    
-      if (trace) {log.trace(this + " acknowledges deliveries " + acks); }
-      
-      try
-      {
-         Iterator iter = acks.iterator();
-         
-         while (iter.hasNext())
-         {
-            Ack ack = (Ack)iter.next();
-            
-            acknowledgeDeliveryInternal(ack);
-         }
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " acknowledgeDeliveries");
-      }
-   }
-             
-   public void cancelDelivery(Cancel cancel) throws JMSException
-   {
-      if (trace) {log.trace(this + " cancelDelivery " + cancel); }
-      
-      try
-      {
-         Delivery del = cancelDeliveryInternal(cancel);
-         
-         //Prompt delivery
-         promptDelivery((Channel)del.getObserver());
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDelivery");
-      }     
-   }            
-
-   public void cancelDeliveries(List cancels) throws JMSException
-   {
-      if (trace) {log.trace(this + " cancels deliveries " + cancels); }
-        
-      try
-      {
-         // deliveries must be cancelled in reverse order
-
-         Set channels = new HashSet();
-                          
-         for (int i = cancels.size() - 1; i >= 0; i--)
-         {
-            Cancel cancel = (Cancel)cancels.get(i);       
-            
-            if (trace) { log.trace(this + " cancelling delivery " + cancel.getDeliveryId()); }
-                        
-            Delivery del = cancelDeliveryInternal(cancel);
-            
-            channels.add(del.getObserver());
-         }
-                              
-         // need to prompt delivery for all affected channels
-         
-         promptDelivery(channels);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDeliveries");
-      }
-   }         
-   
-   public void recoverDeliveries(List deliveryRecoveryInfos) throws JMSException
-   {
-      if (trace) { log.trace(this + "recovers deliveries " + deliveryRecoveryInfos); }
-
-      try
-      {
-         if (postOffice.isLocal())
-         {
-            throw new IllegalStateException("Recovering deliveries but post office is not clustered!");
-         }
-         
-         long maxDeliveryId = 0;
-                  
-         //Sort into different list for each channel
-         Map ackMap = new HashMap();
-                  
-         for (Iterator iter = deliveryRecoveryInfos.iterator(); iter.hasNext(); )
-         {
-            DeliveryRecovery deliveryInfo = (DeliveryRecovery)iter.next();
-                
-            String queueName = deliveryInfo.getQueueName();
-
-            List acks = (List)ackMap.get(queueName);
-            
-            if (acks == null)
-            {
-               acks = new ArrayList();
-               
-               ackMap.put(queueName, acks);
-            }
-            
-            acks.add(deliveryInfo);
-         }  
-         
-         Iterator iter = ackMap.entrySet().iterator();
-         
-         while (iter.hasNext())
-         {
-            Map.Entry entry = (Map.Entry)iter.next();
-            
-            String queueName = (String)entry.getKey();
-            
-            //Look up channel
-            Binding binding = postOffice.getBindingForQueueName(queueName);
-            
-            if (binding == null)
-            {
-               throw new IllegalStateException("Cannot find channel with queue name: " + queueName);
-            }
-            
-            List acks = (List)entry.getValue();
-            
-            List ids = new ArrayList(acks.size());
-            
-            for (Iterator iter2 = acks.iterator(); iter2.hasNext(); )
-            {
-               DeliveryRecovery info = (DeliveryRecovery)iter2.next();
-               
-               ids.add(new Long(info.getMessageID()));
-            }
-            
-            Queue queue = binding.getQueue();
-            
-            JMSCondition cond = (JMSCondition)binding.getCondition();                        
-            
-            ManagedDestination dest =
-               sp.getDestinationManager().getDestination(cond.getName(), cond.isQueue());
-            
-            if (dest == null)
-            {
-               throw new IllegalStateException("Cannot find managed destination with name " +
-                  cond.getName() + " isQueue" + cond.isQueue());
-            }
-            
-            Queue dlqToUse =
-               dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
-            
-            Queue expiryQueueToUse =
-               dest.getExpiryQueue() == null ? defaultExpiryQueue : dest.getExpiryQueue();
-            
-            List dels = queue.recoverDeliveries(ids);
-            
-            Iterator iter2 = dels.iterator();
-            
-            Iterator iter3 = acks.iterator();
-            
-            while (iter2.hasNext())
-            {
-               Delivery del = (Delivery)iter2.next();
-               
-               DeliveryRecovery info = (DeliveryRecovery)iter3.next();
-               
-               long deliveryId = info.getDeliveryID();
-               
-               maxDeliveryId = Math.max(maxDeliveryId, deliveryId);
-               
-               if (trace) { log.trace(this + " Recovered delivery " + deliveryId + ", " + del); }
-               
-               deliveries.put(new Long(deliveryId),
-                              new DeliveryRecord(del, -1, dlqToUse,
-                                                 expiryQueueToUse, dest.getRedeliveryDelay()));
-            }
-         }
-         
-         this.deliveryIdSequence = new SynchronizedLong(maxDeliveryId + 1);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " recoverDeliveries");
-      }
-   }
-   
-   public void addTemporaryDestination(JBossDestination dest) throws JMSException
-   {
-      try
-      {
-         if (closed)
-         {
-            throw new IllegalStateException("Session is closed");
-         }
-         if (!dest.isTemporary())
-         {
-            throw new InvalidDestinationException("Destination:" + dest +
-               " is not a temporary destination");
-         }
-
-         connectionEndpoint.addTemporaryDestination(dest);
-         
-         // Register with the destination manager
-         
-         ManagedDestination mDest;
-         
-         int fullSize = connectionEndpoint.getDefaultTempQueueFullSize();
-         int pageSize = connectionEndpoint.getDefaultTempQueuePageSize();
-         int downCacheSize = connectionEndpoint.getDefaultTempQueueDownCacheSize();
-         
-         if (dest.isTopic())
-         {
-            mDest = new ManagedTopic(dest.getName(), fullSize, pageSize, downCacheSize);
-         }
-         else
-         {
-            mDest = new ManagedQueue(dest.getName(), fullSize, pageSize, downCacheSize);
-         }
-         
-         dm.registerDestination(mDest);
-         
-         if (dest.isQueue())
-         {            
-            Queue coreQueue;
-
-            coreQueue = new PagingFilteredQueue(dest.getName(),
-                                                idm.getID(), ms, pm, true, false,
-                                                -1, null, fullSize, pageSize, downCacheSize);
-
-            String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
-            
-            MessageCounter counter =
-               new MessageCounter(counterName, null, coreQueue, false, false,
-                                  sp.getDefaultMessageCounterHistoryDayLimit());
-            
-            sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
-                                 
-            // make a binding for this queue
-            postOffice.bindQueue(new JMSCondition(true, dest.getName()), coreQueue);
-         }         
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " addTemporaryDestination");
-      }
-   }
-   
-   public void deleteTemporaryDestination(JBossDestination dest) throws JMSException
-   {
-      try
-      {
-         if (closed)
-         {
-            throw new IllegalStateException("Session is closed");
-         }
-   
-         if (!dest.isTemporary())
-         {
-            throw new InvalidDestinationException("Destination:" + dest +
-               " is not a temporary destination");
-         }
-         
-         ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
-         
-         if (mDest == null)
-         {
-            throw new InvalidDestinationException("No such destination: " + dest);
-         }
-                  
-         if (dest.isQueue())
-         {
-            //Unbind
-            postOffice.unbindQueue(dest.getName());
-            
-            String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
-            
-            connectionEndpoint.removeTemporaryDestination(dest);
-            
-            MessageCounter counter =
-               sp.getMessageCounterManager().unregisterMessageCounter(counterName);
-            
-            if (counter == null)
-            {
-               throw new IllegalStateException("Cannot find counter to unregister " + counterName);
-            }
-         }
-         else
-         {
-            //Topic            
-            Collection bindings =
-               postOffice.getBindingsForCondition(new JMSCondition(false, dest.getName()));
-            
-            if (!bindings.isEmpty())
-            {
-               throw new IllegalStateException("Cannot delete temporary destination, " +
-                  "since it has active consumer(s)");
-            }
-         }
-         
-         dm.unregisterDestination(mDest);                             
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " deleteTemporaryDestination");
-      }
-   }
-   
-   public void unsubscribe(String subscriptionName) throws JMSException
-   {
-      log.debug(this + " unsubscribing " + subscriptionName);
-      
-      try
-      {
-         if (closed)
-         {
-            throw new IllegalStateException("Session is closed");
-         }
-         if (subscriptionName == null)
-         {
-            throw new InvalidDestinationException("Destination is null");
-         }
-   
-         String clientID = connectionEndpoint.getClientID();
-   
-         if (clientID == null)
-         {
-            throw new JMSException("null clientID on connection");
-         }
-         
-         String queueName = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);
-         
-         Binding binding = postOffice.getBindingForQueueName(queueName);
-         
-         if (binding == null)
-         {
-            throw new InvalidDestinationException("Cannot find durable subscription with name " +
-                                                  subscriptionName + " to unsubscribe");
-         }
-         
-         // Section 6.11. JMS 1.1.
-         // "It is erroneous for a client to delete a durable subscription while it has an active
-         // TopicSubscriber for it or while a message received by it is part of a current
-         // transaction or has not been acknowledged in the session."
-         
-         Queue sub = binding.getQueue();
-         
-         if (sub.getNumberOfReceivers() != 0)
-         {
-            throw new IllegalStateException("Cannot unsubscribe durable subscription " +
-                                            subscriptionName + " since it has active subscribers");
-         }
-         
-         //Look up the topic
-         
-         JMSCondition topicCond = (JMSCondition)binding.getCondition();
-         
-         String topicName = topicCond.getName();
-         
-         ManagedDestination mDest = dm.getDestination(topicName, false);
-         
-         //Unbind it
-    
-         if (mDest.isClustered() && !postOffice.isLocal())
-         {
-            ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-            
-            cpo.unbindClusteredQueue(queueName);
-         }
-         else
-         {         
-            postOffice.unbindQueue(queueName);
-         }
-         
-         String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + sub.getName();
-         
-         MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
-         
-         if (counter == null)
-         {
-            throw new IllegalStateException("Cannot find counter to remove " + counterName);
-         }
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " unsubscribe");
-      }
-   }
-   
-   // Public ---------------------------------------------------------------------------------------
-   
-   public ServerConnectionEndpoint getConnectionEndpoint()
-   {
-      return connectionEndpoint;
-   }
-
-   public String toString()
-   {
-      return "SessionEndpoint[" + id + "]";
-   }
-
-   // Package protected ----------------------------------------------------------------------------
-   
-   void expireDelivery(Delivery del, Queue expiryQueue) throws Throwable
-   {
-      if (trace) { log.trace(this + " detected expired message " + del.getReference()); }
-      
-      if (expiryQueue != null)
-      {
-         if (trace) { log.trace(this + " sending expired message to expiry queue " + expiryQueue); }
-         
-         JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
-         
-         moveInTransaction(copy, del, expiryQueue);
-      }
-      else
-      {
-         log.warn("No expiry queue has been configured so removing expired " +  del.getReference());
-      }
-   }
-      
-   void removeBrowser(int browserId) throws Exception
-   {
-      synchronized (browsers)
-      {
-         if (browsers.remove(new Integer(browserId)) == null)
-         {
-            throw new IllegalStateException("Cannot find browser with id " + browserId + " to remove");
-         }
-      }
-   }
-   
-   void removeConsumer(int consumerId) throws Exception
-   {
-      synchronized (consumers)
-      {
-         if (consumers.remove(new Integer(consumerId)) == null)
-         {
-            throw new IllegalStateException("Cannot find consumer with id " + consumerId + " to remove");
-         }
-      }
-   }
-    
-   void localClose() throws Throwable
-   {
-      if (closed)
-      {
-         throw new IllegalStateException("Session is already closed");
-      }
-      
-      if (trace) log.trace(this + " close()");
-            
-      //We clone to avoid deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
-      Map consumersClone;
-      synchronized (consumers)
-      {
-         consumersClone = new HashMap(consumers);
-      }
-      
-      for( Iterator i = consumersClone.values().iterator(); i.hasNext(); )
-      {
-         ((ServerConsumerEndpoint)i.next()).localClose();
-      }  
-      
-      consumers.clear();
-      
-      
-      //We clone to avoid deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
-      Map browsersClone;
-      synchronized (browsers)
-      {
-         browsersClone = new HashMap(browsers);
-      }
-      
-      for( Iterator i = browsersClone.values().iterator(); i.hasNext(); )
-      {
-         ((ServerBrowserEndpoint)i.next()).localClose();
-      }  
-      
-      browsers.clear();
-      
-      
-      //Now cancel any remaining deliveries in reverse delivery order
-      //Note we don't maintain order using a LinkedHashMap since then we lose
-      //concurrency since we would have to lock it exclusively
-      
-      List entries = new ArrayList(deliveries.entrySet());
-      
-      //Sort them in reverse delivery id order
-      Collections.sort(entries,
-                       new Comparator()
-                       {
-                           public int compare(Object obj1, Object obj2)
-                           {
-                              Map.Entry entry1 = (Map.Entry)obj1;
-                              Map.Entry entry2 = (Map.Entry)obj2;
-                              Long id1 = (Long)entry1.getKey();
-                              Long id2 = (Long)entry2.getKey();
-                              return id2.compareTo(id1);
-                           } 
-                       });
-
-      Iterator iter = entries.iterator();
-            
-      Set channels = new HashSet();
-      
-      if (trace) { log.trace(this + " cancelling " + entries.size() + " deliveries"); }
-      
-      while (iter.hasNext())
-      {
-         Map.Entry entry = (Map.Entry)iter.next();
-         
-         if (trace) { log.trace(this + " cancelling delivery with delivery id: " + entry.getKey()); }
-         
-         DeliveryRecord rec = (DeliveryRecord)entry.getValue();
-         
-         rec.del.cancel();
-         
-         channels.add(rec.del.getObserver());
-      }
-      
-      promptDelivery(channels);
-      
-      deliveries.clear();
-      
-      sp.removeSession(new Integer(id));
-            
-      Dispatcher.instance.unregisterTarget(id, this);
-      
-      closed = true;
-   }            
-   
-   void cancelDelivery(long deliveryId) throws Throwable
-   {
-      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(deliveryId));
-      
-      if (rec == null)
-      {
-         throw new IllegalStateException("Cannot find delivery to cancel " + deliveryId);
-      }
-      
-      rec.del.cancel();
-   }
-   
-   long addDelivery(Delivery del, int consumerId, Queue dlq, Queue expiryQueue, long redeliveryDelay)
-   {
-      long deliveryId = deliveryIdSequence.increment();
-      
-      deliveries.put(new Long(deliveryId), new DeliveryRecord(del, consumerId, dlq, expiryQueue, redeliveryDelay));
-      
-      if (trace) { log.trace(this + " added delivery " + deliveryId + ": " + del); }
-      
-      return deliveryId;      
-   }      
-   
-   void acknowledgeTransactionally(List acks, Transaction tx) throws Throwable
-   {
-      if (trace) { log.trace(this + " acknowledging transactionally " + acks.size() + " messages for " + tx); }
-      
-      DeliveryCallback deliveryCallback = (DeliveryCallback)tx.getCallback(this);
-      
-      if (deliveryCallback == null)
-      {
-         deliveryCallback = new DeliveryCallback();
-         tx.addCallback(deliveryCallback, this);
-      }
-            
-      for(Iterator i = acks.iterator(); i.hasNext(); )
-      {
-         Ack ack = (Ack)i.next();
-         Long id = new Long(ack.getDeliveryID());
-         DeliveryRecord rec = (DeliveryRecord)deliveries.get(id);
-         
-         if (rec == null)
-         {
-            log.warn("Cannot find delivery to acknowledge " + ack);
-            continue;
-         }
-                           
-         deliveryCallback.addDeliveryId(id);
-         rec.del.acknowledge(tx);
-      }      
-   }
-   
-   /**
-    * Starts this session's Consumers
-    */
-   void setStarted(boolean s) throws Throwable
-   {
-      //We clone to prevent deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
-      Map consumersClone;
-      synchronized(consumers)
-      {
-         consumersClone = new HashMap(consumers);
-      }
-      
-      for(Iterator i = consumersClone.values().iterator(); i.hasNext(); )
-      {
-         ServerConsumerEndpoint sce = (ServerConsumerEndpoint)i.next();
-         if (s)
-         {
-            sce.start();
-         }
-         else
-         {
-            sce.stop();
-         }
-      }      
-   } 
-   
-   void promptDelivery(final Channel channel)
-   {
-      try
-      {
-         //Prompting delivery must be asynchronous to avoid deadlock
-         //but we cannot use one way invocations on cancelDelivery and
-         //cancelDeliveries because remoting one way invocations can 
-         //overtake each other in flight - this problem will
-         //go away when we have our own transport and our dedicated connection
-         this.executor.execute(new Runnable() { public void run() { channel.deliver(); } } );
-      }
-      catch (Throwable t)
-      {
-         log.error("Failed to prompt delivery", t);
-      }
-   }
-   
-
-   // Protected ------------------------------------------------------------------------------------
-
-   // Private --------------------------------------------------------------------------------------
-   
-   private Delivery cancelDeliveryInternal(Cancel cancel) throws Throwable
-   {
-      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(cancel.getDeliveryId()));
-      
-      if (rec == null)
-      {
-         throw new IllegalStateException("Cannot find delivery to cancel " + cancel.getDeliveryId());
-      }
-                 
-      //Note we check the flag *and* evaluate again, this is because the server and client clocks may
-      //be out of synch and don't want to send back to the client a message it thought it has sent to
-      //the expiry queue  
-      boolean expired = cancel.isExpired() || rec.del.getReference().getMessage().isExpired();
-      
-      //Note we check the flag *and* evaluate again, this is because the server value of maxDeliveries
-      //might get changed after the client has sent the cancel - and we don't want to end up cancelling
-      //back to the original queue
-      boolean reachedMaxDeliveryAttempts =
-         cancel.isReachedMaxDeliveryAttempts() || cancel.getDeliveryCount() >= maxDeliveryAttempts;
-                    
-      Delivery del = rec.del;   
-         
-      if (!expired && !reachedMaxDeliveryAttempts)
-      {
-         //Normal cancel back to the queue
-         
-         del.getReference().setDeliveryCount(cancel.getDeliveryCount());
-         
-         //Do we need to set a redelivery delay?
-         
-         if (rec.redeliveryDelay != 0)
-         {
-            del.getReference().setScheduledDeliveryTime(System.currentTimeMillis() + rec.redeliveryDelay);
-         }
-         
-         del.cancel();
-      }
-      else
-      {                  
-         if (expired)
-         {
-            //Sent to expiry queue
-            
-            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
-            
-            moveInTransaction(copy, del, rec.expiryQueue);
-         }
-         else
-         {
-            //Send to DLQ
-            
-            JBossMessage copy = makeCopyForDLQOrExpiry(false, del);
-            
-            moveInTransaction(copy, del, rec.dlq);
-         }
-      }      
-      
-      return rec.del;
-   }      
-   
-   private JBossMessage makeCopyForDLQOrExpiry(boolean expiry, Delivery del) throws Exception
-   {
-      //We copy the message and send that to the dlq/expiry queue - this is because
-      //otherwise we may end up with a ref with the same message id in the queue more than once
-      //which would barf - this might happen if the same message had been expire from multiple
-      //subscriptions of a topic for example
-      //We set headers that hold the original message destination, expiry time and original message id
-      
-      JBossMessage msg = ((JBossMessage)del.getReference().getMessage());
-      
-      JBossMessage copy = msg.doCopy();
-      
-      long newMessageId = sp.getMessageIDManager().getID();
-      
-      copy.setMessageId(newMessageId);
-      
-      //reset expiry
-      copy.setExpiration(0);
-      
-      String origMessageId = msg.getJMSMessageID();
-      
-      String origDest = msg.getJMSDestination().toString();
-            
-      copy.setStringProperty(JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
-      
-      copy.setStringProperty(JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
-      
-      if (expiry)
-      {
-         long actualExpiryTime = System.currentTimeMillis();
-         
-         copy.setLongProperty(JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
-      }
-      
-      return copy;
-   }
-   
-   private void moveInTransaction(JBossMessage msg, Delivery del, Queue queue) throws Throwable
-   {
-      Transaction tx = tr.createTransaction();
-      
-      MessageReference ref = ms.reference(msg);
-                       
-      try
-      {               
-         if (queue != null)
-         {                                                       
-            queue.handle(null, ref, tx);
-            del.acknowledge(tx);
-         }
-         else
-         {
-            log.warn("Cannot move to destination since destination has not been deployed! " +
-               "The message will be removed");
-            
-            del.acknowledge(tx);
-         }             
-         
-         tx.commit();         
-      }
-      catch (Throwable t)
-      {
-         tx.rollback();
-         throw t;
-      } 
-      finally
-      {
-         if (ref != null)
-         {
-            ref.releaseMemoryReference();
-         }
-      }
-      
-      //Need to prompt delivery on the dlq/expiry queue
-      
-      //TODO - are we sure this is the right place to prompt delivery?
-      if (queue != null)
-      {
-         promptDelivery(queue);
-      }
-   }
-   
-   private void acknowledgeDeliveryInternal(Ack ack) throws Throwable
-   {
-      if (trace) { log.trace(this + " acknowledging delivery " + ack); }
-      
-      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(ack.getDeliveryID()));
-      
-      if (rec == null)
-      {
-         log.warn("Cannot find " + ack + " to acknowledge, " +
-            "maybe it was already acknowledged before failover!");
-         return;
-      }
-      
-      rec.del.acknowledge(null);    
-      
-      if (trace) { log.trace(this + " acknowledged delivery " + ack); }
-   }
-
-   private ConsumerDelegate createConsumerDelegateInternal(JBossDestination jmsDestination,
-                                                           String selectorString,
-                                                           boolean noLocal,
-                                                           String subscriptionName)
-      throws Throwable
-   {
-      if (closed)
-      {
-         throw new IllegalStateException("Session is closed");
-      }
-      
-      if ("".equals(selectorString))
-      {
-         selectorString = null;
-      }
-      
-      if (trace)
-      {
-         log.trace(this + " creating consumer for " + jmsDestination +
-            (selectorString == null ? "" : ", selector '" + selectorString + "'") +
-            (subscriptionName == null ? "" : ", subscription '" + subscriptionName + "'") +
-            (noLocal ? ", noLocal" : ""));
-      }
-
-      ManagedDestination mDest = dm.
-         getDestination(jmsDestination.getName(), jmsDestination.isQueue());
-      
-      if (mDest == null)
-      {
-         throw new InvalidDestinationException("No such destination: " + jmsDestination);
-      }
-      
-      if (jmsDestination.isTemporary())
-      {
-         // Can only create a consumer for a temporary destination on the same connection
-         // that created it
-         if (!connectionEndpoint.hasTemporaryDestination(jmsDestination))
-         {
-            String msg = "Cannot create a message consumer on a different connection " +
-                         "to that which created the temporary destination";
-            throw new IllegalStateException(msg);
-         }
-      }
-      
-      int consumerID = connectionEndpoint.getServerPeer().getNextObjectID();
-      
-      Binding binding = null;
-      
-      // Always validate the selector first
-      Selector selector = null;
-      if (selectorString != null)
-      {
-         selector = new Selector(selectorString);
-      }
-      
-      if (jmsDestination.isTopic())
-      {
-         JMSCondition topicCond = new JMSCondition(false, jmsDestination.getName());
-         
-         if (subscriptionName == null)
-         {
-            // non-durable subscription
-            if (log.isTraceEnabled()) { log.trace(this + " creating new non-durable subscription on " + jmsDestination); }
-            
-            // Create the non durable sub
-                        
-            PagingFilteredQueue q;
-            
-            if (postOffice.isLocal() || !mDest.isClustered())
-            {
-               q = new PagingFilteredQueue(new GUID().toString(), idm.getID(), ms, pm, true, false,
-                        mDest.getMaxSize(), selector,
-                        mDest.getFullSize(),
-                        mDest.getPageSize(),
-                        mDest.getDownCacheSize());
-               
-               binding = postOffice.bindQueue(topicCond, q);
-            }
-            else
-            {  
-               q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, new GUID().toString(),
-                                           idm.getID(), ms, pm, true, false,
-                                           mDest.getMaxSize(), selector, tr,
-                                           mDest.getFullSize(),
-                                           mDest.getPageSize(),
-                                           mDest.getDownCacheSize());
-               
-               ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-
-               binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
-            }
-            String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
-  
-            int dayLimitToUse = mDest.getMessageCounterHistoryDayLimit();
-            if (dayLimitToUse == -1)
-            {
-               //Use override on server peer
-               dayLimitToUse = sp.getDefaultMessageCounterHistoryDayLimit();
-            }
-            
-            MessageCounter counter =
-               new MessageCounter(counterName, null, q, true, false,
-                                  dayLimitToUse);
-            
-            sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
-         }
-         else
-         {
-            if (jmsDestination.isTemporary())
-            {
-               throw new InvalidDestinationException("Cannot create a durable subscription on a temporary topic");
-            }
-            
-            // We have a durable subscription, look it up
-            String clientID = connectionEndpoint.getClientID();
-            if (clientID == null)
-            {
-               throw new JMSException("Cannot create durable subscriber without a valid client ID");
-            }
-            
-            // See if there any bindings with the same client_id.subscription_name name
-            
-            String name = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);
-            
-            binding = postOffice.getBindingForQueueName(name);
-            
-            if (binding == null)
-            {
-               // Does not already exist
-               
-               if (trace) { log.trace(this + " creating new durable subscription on " + jmsDestination); }
-                              
-               PagingFilteredQueue q;
-
-               if (postOffice.isLocal())
-               {
-                  q = new PagingFilteredQueue(name, idm.getID(), ms, pm, true, true,
-                                              mDest.getMaxSize(), selector,
-                                              mDest.getFullSize(),
-                                              mDest.getPageSize(),
-                                              mDest.getDownCacheSize());
-
-                  binding = postOffice.bindQueue(topicCond, q);
-               }
-               else
-               {
-                  q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, name, idm.getID(),
-                                              ms, pm, true, true,
-                                              mDest.getMaxSize(), selector, tr,
-                                              mDest.getFullSize(),
-                                              mDest.getPageSize(),
-                                              mDest.getDownCacheSize());
-                  
-                  ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-                  
-                  if (mDest.isClustered())
-                  {
-                     binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
-                  }
-                  else
-                  {
-                     binding = cpo.bindQueue(topicCond, q);
-                  }
-               }
-               String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
-                       
-               MessageCounter counter =
-                  new MessageCounter(counterName, subscriptionName, q, true, true,
-                                     mDest.getMessageCounterHistoryDayLimit());
-               
-               sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
-            }
-            else
-            {
-               //Durable sub already exists
-               
-               if (trace) { log.trace(this + " subscription " + subscriptionName + " already exists"); }
-               
-               // From javax.jms.Session Javadoc (and also JMS 1.1 6.11.1):
-               // A client can change an existing durable subscription by creating a durable
-               // TopicSubscriber with the same name and a new topic and/or message selector.
-               // Changing a durable subscriber is equivalent to unsubscribing (deleting) the old
-               // one and creating a new one.
-               
-               String filterString =
-                  binding.getQueue().getFilter() != null ?
-                     binding.getQueue().getFilter().getFilterString() : null;
-               
-               boolean selectorChanged =
-                  (selectorString == null && filterString != null) ||
-                  (filterString == null && selectorString != null) ||
-                  (filterString != null && selectorString != null &&
-                           !filterString.equals(selectorString));
-               
-               if (trace) { log.trace("selector " + (selectorChanged ? "has" : "has NOT") + " changed"); }
-               
-               JMSCondition cond = (JMSCondition)binding.getCondition();
-               
-               boolean topicChanged = !cond.getName().equals(jmsDestination.getName());
-               
-               if (log.isTraceEnabled()) { log.trace("topic " + (topicChanged ? "has" : "has NOT") + " changed"); }
-               
-               if (selectorChanged || topicChanged)
-               {
-                  if (trace) { log.trace("topic or selector changed so deleting old subscription"); }
-                  
-                  // Unbind the durable subscription
-                  
-                  if (mDest.isClustered() && !postOffice.isLocal())
-                  {
-                     ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-                     
-                     cpo.unbindClusteredQueue(name);
-                  }
-                  else
-                  {
-                     postOffice.unbindQueue(name);
-                  }
-                  
-                  // create a fresh new subscription
-                                    
-                  PagingFilteredQueue q;
-                  
-                  if (postOffice.isLocal())
-                  {
-                     q = new PagingFilteredQueue(name, idm.getID(), ms, pm, true, true,
-                              mDest.getMaxSize(), selector,
-                              mDest.getFullSize(),
-                              mDest.getPageSize(),
-                              mDest.getDownCacheSize());
-                     binding = postOffice.bindQueue(topicCond, q);
-                  }
-                  else
-                  {
-                     q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, name, idm.getID(), ms, pm, true, true,
-                              mDest.getMaxSize(), selector, tr,
-                              mDest.getFullSize(),
-                              mDest.getPageSize(),
-                              mDest.getDownCacheSize());
-                     
-                     ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-                     
-                     if (mDest.isClustered())
-                     {
-                        binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
-                     }
-                     else
-                     {
-                        binding = cpo.bindQueue(topicCond, (LocalClusteredQueue)q);
-                     }
-                  }
-                  String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
-                  
-                  MessageCounter counter =
-                     new MessageCounter(counterName, subscriptionName, q, true, true,
-                                        mDest.getMessageCounterHistoryDayLimit());
-                  
-                  sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
-               }
-            }
-         }
-      }
-      else
-      {
-         // Consumer on a jms queue
-         
-         // Let's find the binding
-         binding = postOffice.getBindingForQueueName(jmsDestination.getName());
-         
-         if (binding == null)
-         {
-            throw new IllegalStateException("Cannot find binding for jms queue: " + jmsDestination.getName());
-         }
-      }
-      
-      int prefetchSize = connectionEndpoint.getPrefetchSize();
-      
-      Queue dlqToUse = mDest.getDLQ() == null ? defaultDLQ : mDest.getDLQ();
-      
-      Queue expiryQueueToUse = mDest.getExpiryQueue() == null ? defaultExpiryQueue : mDest.getExpiryQueue();
-      
-      long redeliveryDelay = mDest.getRedeliveryDelay();
-      
-      if (redeliveryDelay == 0)
-      {
-         redeliveryDelay = sp.getDefaultRedeliveryDelay();
-      }
-      
-      ServerConsumerEndpoint ep =
-         new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(),
-                  binding.getQueue().getName(), this, selectorString, noLocal,
-                  jmsDestination, dlqToUse, expiryQueueToUse, redeliveryDelay);
-      
-      ConsumerAdvised advised;
-      
-      // Need to synchronized to prevent a deadlock
-      // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
-      synchronized (AspectManager.instance())
-      {       
-         advised = new ConsumerAdvised(ep);
-      }
-      
-      Dispatcher.instance.registerTarget(consumerID, advised);
-      
-      ClientConsumerDelegate stub =
-         new ClientConsumerDelegate(consumerID,
-                                    prefetchSize, maxDeliveryAttempts);
-      
-      synchronized (consumers)
-      {
-         consumers.put(new Integer(consumerID), ep);
-      }
-         
-      log.debug(this + " created and registered " + ep);
-      
-      return stub;
-   }   
-
-   private BrowserDelegate createBrowserDelegateInternal(JBossDestination jmsDestination,
-                                                         String selector) throws Throwable
-   {
-      if (closed)
-      {
-         throw new IllegalStateException("Session is closed");
-      }
-
-      if (jmsDestination == null)
-      {
-         throw new InvalidDestinationException("null destination");
-      }
-
-      if (jmsDestination.isTopic())
-      {
-         throw new IllegalStateException("Cannot browse a topic");
-      }
-
-      if (dm.getDestination(jmsDestination.getName(), jmsDestination.isQueue()) == null)
-      {
-         throw new InvalidDestinationException("No such destination: " + jmsDestination);
-      }
-
-      log.debug(this + " creating browser for " + jmsDestination +
-         (selector == null ? "" : ", selector '" + selector + "'"));
-
-      Binding binding = postOffice.getBindingForQueueName(jmsDestination.getName()); // TODO
-
-      int browserID = connectionEndpoint.getServerPeer().getNextObjectID();
-
-      ServerBrowserEndpoint ep =
-         new ServerBrowserEndpoint(this, browserID,
-                                   (PagingFilteredQueue)binding.getQueue(), selector);
-
-      // still need to synchronized since close() can come in on a different thread
-      synchronized (browsers)
-      {
-         browsers.put(new Integer(browserID), ep);
-      }
-
-      BrowserAdvised advised;
-      
-      // Need to synchronized to prevent a deadlock
-      // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
-      synchronized (AspectManager.instance())
-      {       
-         advised = new BrowserAdvised(ep);
-      }
-      
-      Dispatcher.instance.registerTarget(browserID, advised);
-
-      ClientBrowserDelegate stub = new ClientBrowserDelegate(browserID);
-
-      log.debug(this + " created and registered " + ep);
-
-      return stub;
-   }
-
-   private void promptDelivery(Set channels)
-   {
-      //Now prompt delivery on the channels
-      Iterator iter = channels.iterator();
-      
-      while (iter.hasNext())
-      {
-         DeliveryObserver observer = (DeliveryObserver)iter.next();
-         
-         promptDelivery((Channel)observer);
-      }
-   }
-   
-   // Inner classes --------------------------------------------------------------------------------
-   
-   /*
-    * Holds a record of a delivery - we need to store the consumer id as well
-    * hence this class
-    * We can't rely on the cancel being driven from the MessageCallbackHandler since
-    * the deliveries may have got lost in transit (ignored) since the consumer might have closed
-    * when they were in transit.
-    * In such a case we might otherwise end up with the consumer closing but not all it's deliveries being
-    * cancelled, which would mean they wouldn't be cancelled until the session is closed which is too late
-    * 
-    * We need to store various pieces of information, such as consumer id, dlq, expiry queue
-    * since we need this at cancel time, but by then the actual consumer might have closed
-    */
-   private static class DeliveryRecord
-   {
-      Delivery del;
-      
-      int consumerId;
-      
-      Queue dlq;
-      
-      Queue expiryQueue;
-      
-      long redeliveryDelay;
-      
-      DeliveryRecord(Delivery del, int consumerId, Queue dlq, Queue expiryQueue, long redeliveryDelay)
-      {
-         this.del = del;
-         
-         this.consumerId = consumerId;
-         
-         this.dlq = dlq;
-         
-         this.expiryQueue = expiryQueue;
-         
-         this.redeliveryDelay = redeliveryDelay;
-      }            
-   }
-   
-   /**
-    * 
-    * The purpose of this class is to remove deliveries from the delivery list on commit
-    * Each transaction has once instance of this per SCE
-    *
-    */
-   private class DeliveryCallback implements TxCallback
-   {
-      List delList = new ArrayList();
-         
-      public void beforePrepare()
-      {         
-         //NOOP
-      }
-      
-      public void beforeCommit(boolean onePhase)
-      {         
-         //NOOP
-      }
-      
-      public void beforeRollback(boolean onePhase)
-      {         
-         //NOOP
-      }
-      
-      public void afterPrepare()
-      {         
-         //NOOP
-      }
-      
-      public synchronized void afterCommit(boolean onePhase) throws TransactionException
-      {
-         // Remove the deliveries from the delivery map.
-         Iterator iter = delList.iterator();
-         while (iter.hasNext())
-         {
-            Long deliveryId = (Long)iter.next();
-            
-            deliveries.remove(deliveryId);
-         }
-      }
-      
-      public void afterRollback(boolean onePhase) throws TransactionException
-      {                            
-         //One phase rollbacks never hit the server - they are dealt with locally only
-         //so this would only ever be executed for a two phase rollback.
-
-         //We don't do anything since cancellation is driven from the client.
-      }
-      
-      synchronized void addDeliveryId(Long deliveryId)
-      {
-         delList.add(deliveryId);
-      }
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java (from rev 2556, branches/Branch_1_2_0_SP/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,1609 @@
+/*
+  * 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.endpoint;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jms.IllegalStateException;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.jms.client.delegate.ClientBrowserDelegate;
+import org.jboss.jms.client.delegate.ClientConsumerDelegate;
+import org.jboss.jms.delegate.BrowserDelegate;
+import org.jboss.jms.delegate.ConsumerDelegate;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.destination.JBossQueue;
+import org.jboss.jms.destination.JBossTopic;
+import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.selector.Selector;
+import org.jboss.jms.server.DestinationManager;
+import org.jboss.jms.server.JMSCondition;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.destination.ManagedDestination;
+import org.jboss.jms.server.destination.ManagedQueue;
+import org.jboss.jms.server.destination.ManagedTopic;
+import org.jboss.jms.server.destination.TopicService;
+import org.jboss.jms.server.endpoint.advised.BrowserAdvised;
+import org.jboss.jms.server.endpoint.advised.ConsumerAdvised;
+import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.util.ExceptionUtil;
+import org.jboss.jms.util.MessageQueueNameHelper;
+import org.jboss.jms.wireformat.Dispatcher;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Channel;
+import org.jboss.messaging.core.Delivery;
+import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.core.local.PagingFilteredQueue;
+import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.plugin.IDManager;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
+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.messaging.core.plugin.postoffice.Binding;
+import org.jboss.messaging.core.plugin.postoffice.cluster.LocalClusteredQueue;
+import org.jboss.messaging.core.tx.Transaction;
+import org.jboss.messaging.core.tx.TransactionException;
+import org.jboss.messaging.core.tx.TransactionRepository;
+import org.jboss.messaging.core.tx.TxCallback;
+import org.jboss.util.id.GUID;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
+
+/**
+ * The server side representation of a JMS session.
+ * 
+ * A user must not invoke methods of a session concurrently on different threads, however there are
+ * situations where multiple threads may access this object concurrently, for instance:
+ * - A session can be closed when it's connection is closed by the user which might be called on a
+ *   different thread.
+ * - A session can be closed when the server determines the connection is dead.
+ *
+ * If the session represents a connection consumer's session then the connection consumer will farm
+ * off messages to different sessions obtained from a pool, these may then cancel/ack etc on
+ * different threads, but the acks/cancels/etc will end up back here on the connection consumer
+ * session instance.
+ * 
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ServerSessionEndpoint implements SessionEndpoint
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(ServerSessionEndpoint.class);
+   
+   static final String TEMP_QUEUE_MESSAGECOUNTER_PREFIX = "TempQueue.";
+   
+   public static final String JBOSS_MESSAGING_ORIG_DESTINATION = "JBM_ORIG_DESTINATION";
+
+   public static final String JBOSS_MESSAGING_ORIG_MESSAGE_ID = "JBM_ORIG_MESSAGE_ID";
+   
+   public static final String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME = "JBM_ACTUAL_EXPIRY";
+   
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private boolean trace = log.isTraceEnabled();
+
+   private int id;
+
+   private volatile boolean closed;
+
+   private ServerConnectionEndpoint connectionEndpoint;
+   
+   private ServerPeer sp;
+
+   private Map consumers;
+   private Map browsers;
+
+   private PersistenceManager pm;
+   private MessageStore ms;
+
+   private DestinationManager dm;
+   private IDManager idm;
+   private TransactionRepository tr;
+   private PostOffice postOffice;
+   private int nodeId;
+   private int maxDeliveryAttempts;
+   private Queue defaultDLQ;
+   private Queue defaultExpiryQueue;
+   
+   // Map <deliveryID, Delivery>
+   private Map deliveries;
+   
+   private SynchronizedLong deliveryIdSequence;
+   
+   //Temporary until we have our own NIO transport   
+   QueuedExecutor executor = new QueuedExecutor();
+   
+   // Constructors ---------------------------------------------------------------------------------
+
+   ServerSessionEndpoint(int sessionID, ServerConnectionEndpoint connectionEndpoint)
+      throws Exception
+   {
+      this.id = sessionID;
+
+      this.connectionEndpoint = connectionEndpoint;
+
+      sp = connectionEndpoint.getServerPeer();
+
+      pm = sp.getPersistenceManagerInstance();
+      ms = sp.getMessageStore();
+      dm = sp.getDestinationManager();
+      postOffice = sp.getPostOfficeInstance();     
+      idm = sp.getChannelIDManager();
+      nodeId = sp.getServerPeerID();
+      tr = sp.getTxRepository();
+
+      consumers = new HashMap();
+		browsers = new HashMap();
+      
+      defaultDLQ = sp.getDefaultDLQInstance();
+      defaultExpiryQueue = sp.getDefaultExpiryQueueInstance();
+      tr = sp.getTxRepository();
+      maxDeliveryAttempts = sp.getDefaultMaxDeliveryAttempts();
+      
+      deliveries = new ConcurrentHashMap();
+      
+      deliveryIdSequence = new SynchronizedLong(0);
+   }
+   
+   // SessionDelegate implementation ---------------------------------------------------------------
+       
+   public ConsumerDelegate createConsumerDelegate(JBossDestination jmsDestination,
+                                                  String selector,
+                                                  boolean noLocal,
+                                                  String subscriptionName,
+                                                  boolean isCC) throws JMSException
+   {
+      try
+      {
+//         if (!connectionEndpoint.isFailoverConnection())
+//         {
+            // regular consumer
+            return createConsumerDelegateInternal(jmsDestination, selector,
+                                                  noLocal, subscriptionName);
+  //       }
+
+//         // we're child of a failover connection. Favor failover channels when creating new
+//         // consumers
+//         return createFailoverConsumerDelegateInternal(jmsDestination, selector,
+//                                                       noLocal, subscriptionName,
+//                                                       failoverChannelID);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " createConsumerDelegate");
+      }
+   }
+      
+	public BrowserDelegate createBrowserDelegate(JBossDestination jmsDestination,
+                                                String selector)
+      throws JMSException
+	{
+      try
+      {
+//         if (!connectionEndpoint.isFailoverConnection())
+//         {
+            // regular browser
+            return createBrowserDelegateInternal(jmsDestination, selector);
+//         }
+//
+//         // we're child of a failover connection. Favor failover channels when creating new
+//         // browsers
+//         return createFailoverBrowserDelegateInternal(jmsDestination, selector, failoverChannelID);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " createBrowserDelegate");
+      }
+	}
+
+   public JBossQueue createQueue(String name) throws JMSException
+   {
+      try
+      {
+         if (closed)
+         {
+            throw new IllegalStateException("Session is closed");
+         }
+         
+         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, true);
+         
+         if (dest == null)
+         {
+            throw new JMSException("There is no administratively defined queue with name:" + name);
+         }        
+   
+         return new JBossQueue(dest.getName());
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " createQueue");
+      }
+   }
+
+   public JBossTopic createTopic(String name) throws JMSException
+   {
+      try
+      {
+         if (closed)
+         {
+            throw new IllegalStateException("Session is closed");
+         }
+         
+         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, false);
+                  
+         if (dest == null)
+         {
+            throw new JMSException("There is no administratively defined topic with name:" + name);
+         }        
+   
+         return new JBossTopic(name);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " createTopic");
+      }
+   }
+   
+   public void close() throws JMSException
+   {
+      try
+      {
+         localClose();
+         
+         connectionEndpoint.removeSession(id);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " close");
+      }
+   }
+      
+   public long closing() throws JMSException
+   {
+      // currently does nothing
+      if (trace) log.trace(this + " closing (noop)");
+      
+      return -1;
+   }
+ 
+   public void send(JBossMessage message, boolean checkForDuplicates) throws JMSException
+   {
+      try
+      {                
+         connectionEndpoint.sendMessage(message, null, checkForDuplicates);         
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " send");
+      }
+   }
+   
+   public void acknowledgeDelivery(Ack ack) throws JMSException
+   {
+      try
+      {
+         acknowledgeDeliveryInternal(ack);   
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " acknowledgeDelivery");
+      }
+   }     
+         
+   public void acknowledgeDeliveries(List acks) throws JMSException
+   {    
+      if (trace) {log.trace(this + " acknowledges deliveries " + acks); }
+      
+      try
+      {
+         Iterator iter = acks.iterator();
+         
+         while (iter.hasNext())
+         {
+            Ack ack = (Ack)iter.next();
+            
+            acknowledgeDeliveryInternal(ack);
+         }
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " acknowledgeDeliveries");
+      }
+   }
+             
+   public void cancelDelivery(Cancel cancel) throws JMSException
+   {
+      if (trace) {log.trace(this + " cancelDelivery " + cancel); }
+      
+      try
+      {
+         Delivery del = cancelDeliveryInternal(cancel);
+         
+         //Prompt delivery
+         promptDelivery((Channel)del.getObserver());
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDelivery");
+      }     
+   }            
+
+   public void cancelDeliveries(List cancels) throws JMSException
+   {
+      if (trace) {log.trace(this + " cancels deliveries " + cancels); }
+        
+      try
+      {
+         // deliveries must be cancelled in reverse order
+
+         Set channels = new HashSet();
+                          
+         for (int i = cancels.size() - 1; i >= 0; i--)
+         {
+            Cancel cancel = (Cancel)cancels.get(i);       
+            
+            if (trace) { log.trace(this + " cancelling delivery " + cancel.getDeliveryId()); }
+                        
+            Delivery del = cancelDeliveryInternal(cancel);
+            
+            channels.add(del.getObserver());
+         }
+                              
+         // need to prompt delivery for all affected channels
+         
+         promptDelivery(channels);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDeliveries");
+      }
+   }         
+   
+   public void recoverDeliveries(List deliveryRecoveryInfos) throws JMSException
+   {
+      if (trace) { log.trace(this + "recovers deliveries " + deliveryRecoveryInfos); }
+
+      try
+      {
+         if (postOffice.isLocal())
+         {
+            throw new IllegalStateException("Recovering deliveries but post office is not clustered!");
+         }
+         
+         long maxDeliveryId = 0;
+                  
+         //Sort into different list for each channel
+         Map ackMap = new HashMap();
+                  
+         for (Iterator iter = deliveryRecoveryInfos.iterator(); iter.hasNext(); )
+         {
+            DeliveryRecovery deliveryInfo = (DeliveryRecovery)iter.next();
+                
+            String queueName = deliveryInfo.getQueueName();
+
+            List acks = (List)ackMap.get(queueName);
+            
+            if (acks == null)
+            {
+               acks = new ArrayList();
+               
+               ackMap.put(queueName, acks);
+            }
+            
+            acks.add(deliveryInfo);
+         }  
+         
+         Iterator iter = ackMap.entrySet().iterator();
+         
+         while (iter.hasNext())
+         {
+            Map.Entry entry = (Map.Entry)iter.next();
+            
+            String queueName = (String)entry.getKey();
+            
+            //Look up channel
+            Binding binding = postOffice.getBindingForQueueName(queueName);
+            
+            if (binding == null)
+            {
+               throw new IllegalStateException("Cannot find channel with queue name: " + queueName);
+            }
+            
+            List acks = (List)entry.getValue();
+            
+            List ids = new ArrayList(acks.size());
+            
+            for (Iterator iter2 = acks.iterator(); iter2.hasNext(); )
+            {
+               DeliveryRecovery info = (DeliveryRecovery)iter2.next();
+               
+               ids.add(new Long(info.getMessageID()));
+            }
+            
+            Queue queue = binding.getQueue();
+            
+            JMSCondition cond = (JMSCondition)binding.getCondition();                        
+            
+            ManagedDestination dest =
+               sp.getDestinationManager().getDestination(cond.getName(), cond.isQueue());
+            
+            if (dest == null)
+            {
+               throw new IllegalStateException("Cannot find managed destination with name " +
+                  cond.getName() + " isQueue" + cond.isQueue());
+            }
+            
+            Queue dlqToUse =
+               dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
+            
+            Queue expiryQueueToUse =
+               dest.getExpiryQueue() == null ? defaultExpiryQueue : dest.getExpiryQueue();
+            
+            List dels = queue.recoverDeliveries(ids);
+            
+            Iterator iter2 = dels.iterator();
+            
+            Iterator iter3 = acks.iterator();
+            
+            while (iter2.hasNext())
+            {
+               Delivery del = (Delivery)iter2.next();
+               
+               DeliveryRecovery info = (DeliveryRecovery)iter3.next();
+               
+               long deliveryId = info.getDeliveryID();
+               
+               maxDeliveryId = Math.max(maxDeliveryId, deliveryId);
+               
+               if (trace) { log.trace(this + " Recovered delivery " + deliveryId + ", " + del); }
+               
+               deliveries.put(new Long(deliveryId),
+                              new DeliveryRecord(del, -1, dlqToUse,
+                                                 expiryQueueToUse, dest.getRedeliveryDelay()));
+            }
+         }
+         
+         this.deliveryIdSequence = new SynchronizedLong(maxDeliveryId + 1);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " recoverDeliveries");
+      }
+   }
+   
+   public void addTemporaryDestination(JBossDestination dest) throws JMSException
+   {
+      try
+      {
+         if (closed)
+         {
+            throw new IllegalStateException("Session is closed");
+         }
+         if (!dest.isTemporary())
+         {
+            throw new InvalidDestinationException("Destination:" + dest +
+               " is not a temporary destination");
+         }
+
+         connectionEndpoint.addTemporaryDestination(dest);
+         
+         // Register with the destination manager
+         
+         ManagedDestination mDest;
+         
+         int fullSize = connectionEndpoint.getDefaultTempQueueFullSize();
+         int pageSize = connectionEndpoint.getDefaultTempQueuePageSize();
+         int downCacheSize = connectionEndpoint.getDefaultTempQueueDownCacheSize();
+         
+         if (dest.isTopic())
+         {
+            mDest = new ManagedTopic(dest.getName(), fullSize, pageSize, downCacheSize);
+         }
+         else
+         {
+            mDest = new ManagedQueue(dest.getName(), fullSize, pageSize, downCacheSize);
+         }
+         
+         dm.registerDestination(mDest);
+         
+         if (dest.isQueue())
+         {            
+            Queue coreQueue;
+
+            coreQueue = new PagingFilteredQueue(dest.getName(),
+                                                idm.getID(), ms, pm, true, false,
+                                                -1, null, fullSize, pageSize, downCacheSize);
+
+            String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
+            
+            MessageCounter counter =
+               new MessageCounter(counterName, null, coreQueue, false, false,
+                                  sp.getDefaultMessageCounterHistoryDayLimit());
+            
+            sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+                                 
+            // make a binding for this queue
+            postOffice.bindQueue(new JMSCondition(true, dest.getName()), coreQueue);
+         }         
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " addTemporaryDestination");
+      }
+   }
+   
+   public void deleteTemporaryDestination(JBossDestination dest) throws JMSException
+   {
+      try
+      {
+         if (closed)
+         {
+            throw new IllegalStateException("Session is closed");
+         }
+   
+         if (!dest.isTemporary())
+         {
+            throw new InvalidDestinationException("Destination:" + dest +
+               " is not a temporary destination");
+         }
+         
+         ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
+         
+         if (mDest == null)
+         {
+            throw new InvalidDestinationException("No such destination: " + dest);
+         }
+                  
+         if (dest.isQueue())
+         {
+            //Unbind
+            postOffice.unbindQueue(dest.getName());
+            
+            String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
+            
+            connectionEndpoint.removeTemporaryDestination(dest);
+            
+            MessageCounter counter =
+               sp.getMessageCounterManager().unregisterMessageCounter(counterName);
+            
+            if (counter == null)
+            {
+               throw new IllegalStateException("Cannot find counter to unregister " + counterName);
+            }
+         }
+         else
+         {
+            //Topic            
+            Collection bindings =
+               postOffice.getBindingsForCondition(new JMSCondition(false, dest.getName()));
+            
+            if (!bindings.isEmpty())
+            {
+               throw new IllegalStateException("Cannot delete temporary destination, " +
+                  "since it has active consumer(s)");
+            }
+         }
+         
+         dm.unregisterDestination(mDest);                             
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " deleteTemporaryDestination");
+      }
+   }
+   
+   public void unsubscribe(String subscriptionName) throws JMSException
+   {
+      log.debug(this + " unsubscribing " + subscriptionName);
+      
+      try
+      {
+         if (closed)
+         {
+            throw new IllegalStateException("Session is closed");
+         }
+         if (subscriptionName == null)
+         {
+            throw new InvalidDestinationException("Destination is null");
+         }
+   
+         String clientID = connectionEndpoint.getClientID();
+   
+         if (clientID == null)
+         {
+            throw new JMSException("null clientID on connection");
+         }
+         
+         String queueName = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);
+         
+         Binding binding = postOffice.getBindingForQueueName(queueName);
+         
+         if (binding == null)
+         {
+            throw new InvalidDestinationException("Cannot find durable subscription with name " +
+                                                  subscriptionName + " to unsubscribe");
+         }
+         
+         // Section 6.11. JMS 1.1.
+         // "It is erroneous for a client to delete a durable subscription while it has an active
+         // TopicSubscriber for it or while a message received by it is part of a current
+         // transaction or has not been acknowledged in the session."
+         
+         Queue sub = binding.getQueue();
+         
+         if (sub.getNumberOfReceivers() != 0)
+         {
+            throw new IllegalStateException("Cannot unsubscribe durable subscription " +
+                                            subscriptionName + " since it has active subscribers");
+         }
+         
+         //Look up the topic
+         
+         JMSCondition topicCond = (JMSCondition)binding.getCondition();
+         
+         String topicName = topicCond.getName();
+         
+         ManagedDestination mDest = dm.getDestination(topicName, false);
+         
+         //Unbind it
+    
+         if (mDest.isClustered() && !postOffice.isLocal())
+         {
+            ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+            
+            cpo.unbindClusteredQueue(queueName);
+         }
+         else
+         {         
+            postOffice.unbindQueue(queueName);
+         }
+         
+         String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + sub.getName();
+         
+         MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
+         
+         if (counter == null)
+         {
+            throw new IllegalStateException("Cannot find counter to remove " + counterName);
+         }
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " unsubscribe");
+      }
+   }
+   
+   // Public ---------------------------------------------------------------------------------------
+   
+   public ServerConnectionEndpoint getConnectionEndpoint()
+   {
+      return connectionEndpoint;
+   }
+
+   public String toString()
+   {
+      return "SessionEndpoint[" + id + "]";
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+   
+   void expireDelivery(Delivery del, Queue expiryQueue) throws Throwable
+   {
+      if (trace) { log.trace(this + " detected expired message " + del.getReference()); }
+      
+      if (expiryQueue != null)
+      {
+         if (trace) { log.trace(this + " sending expired message to expiry queue " + expiryQueue); }
+         
+         JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
+         
+         moveInTransaction(copy, del, expiryQueue);
+      }
+      else
+      {
+         log.warn("No expiry queue has been configured so removing expired " +  del.getReference());
+      }
+   }
+      
+   void removeBrowser(int browserId) throws Exception
+   {
+      synchronized (browsers)
+      {
+         if (browsers.remove(new Integer(browserId)) == null)
+         {
+            throw new IllegalStateException("Cannot find browser with id " + browserId + " to remove");
+         }
+      }
+   }
+   
+   void removeConsumer(int consumerId) throws Exception
+   {
+      synchronized (consumers)
+      {
+         if (consumers.remove(new Integer(consumerId)) == null)
+         {
+            throw new IllegalStateException("Cannot find consumer with id " + consumerId + " to remove");
+         }
+      }
+   }
+    
+   void localClose() throws Throwable
+   {
+      if (closed)
+      {
+         throw new IllegalStateException("Session is already closed");
+      }
+      
+      if (trace) log.trace(this + " close()");
+            
+      //We clone to avoid deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
+      Map consumersClone;
+      synchronized (consumers)
+      {
+         consumersClone = new HashMap(consumers);
+      }
+      
+      for( Iterator i = consumersClone.values().iterator(); i.hasNext(); )
+      {
+         ((ServerConsumerEndpoint)i.next()).localClose();
+      }  
+      
+      consumers.clear();
+      
+      
+      //We clone to avoid deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
+      Map browsersClone;
+      synchronized (browsers)
+      {
+         browsersClone = new HashMap(browsers);
+      }
+      
+      for( Iterator i = browsersClone.values().iterator(); i.hasNext(); )
+      {
+         ((ServerBrowserEndpoint)i.next()).localClose();
+      }  
+      
+      browsers.clear();
+      
+      
+      //Now cancel any remaining deliveries in reverse delivery order
+      //Note we don't maintain order using a LinkedHashMap since then we lose
+      //concurrency since we would have to lock it exclusively
+      
+      List entries = new ArrayList(deliveries.entrySet());
+      
+      //Sort them in reverse delivery id order
+      Collections.sort(entries,
+                       new Comparator()
+                       {
+                           public int compare(Object obj1, Object obj2)
+                           {
+                              Map.Entry entry1 = (Map.Entry)obj1;
+                              Map.Entry entry2 = (Map.Entry)obj2;
+                              Long id1 = (Long)entry1.getKey();
+                              Long id2 = (Long)entry2.getKey();
+                              return id2.compareTo(id1);
+                           } 
+                       });
+
+      Iterator iter = entries.iterator();
+            
+      Set channels = new HashSet();
+      
+      if (trace) { log.trace(this + " cancelling " + entries.size() + " deliveries"); }
+      
+      while (iter.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)iter.next();
+         
+         if (trace) { log.trace(this + " cancelling delivery with delivery id: " + entry.getKey()); }
+         
+         DeliveryRecord rec = (DeliveryRecord)entry.getValue();
+         
+         rec.del.cancel();
+         
+         channels.add(rec.del.getObserver());
+      }
+      
+      promptDelivery(channels);
+      
+      //Close down the executor
+      executor.shutdownAfterProcessingCurrentTask();
+
+      deliveries.clear();
+      
+      sp.removeSession(new Integer(id));
+            
+      Dispatcher.instance.unregisterTarget(id, this);
+      
+      closed = true;
+   }            
+   
+   void cancelDelivery(long deliveryId) throws Throwable
+   {
+      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(deliveryId));
+      
+      if (rec == null)
+      {
+         throw new IllegalStateException("Cannot find delivery to cancel " + deliveryId);
+      }
+      
+      rec.del.cancel();
+   }
+   
+   long addDelivery(Delivery del, int consumerId, Queue dlq, Queue expiryQueue, long redeliveryDelay)
+   {
+      long deliveryId = deliveryIdSequence.increment();
+      
+      deliveries.put(new Long(deliveryId), new DeliveryRecord(del, consumerId, dlq, expiryQueue, redeliveryDelay));
+      
+      if (trace) { log.trace(this + " added delivery " + deliveryId + ": " + del); }
+      
+      return deliveryId;      
+   }      
+   
+   void acknowledgeTransactionally(List acks, Transaction tx) throws Throwable
+   {
+      if (trace) { log.trace(this + " acknowledging transactionally " + acks.size() + " messages for " + tx); }
+      
+      DeliveryCallback deliveryCallback = (DeliveryCallback)tx.getCallback(this);
+      
+      if (deliveryCallback == null)
+      {
+         deliveryCallback = new DeliveryCallback();
+         tx.addCallback(deliveryCallback, this);
+      }
+            
+      for(Iterator i = acks.iterator(); i.hasNext(); )
+      {
+         Ack ack = (Ack)i.next();
+         Long id = new Long(ack.getDeliveryID());
+         DeliveryRecord rec = (DeliveryRecord)deliveries.get(id);
+         
+         if (rec == null)
+         {
+            log.warn("Cannot find delivery to acknowledge " + ack);
+            continue;
+         }
+                           
+         deliveryCallback.addDeliveryId(id);
+         rec.del.acknowledge(tx);
+      }      
+   }
+   
+   /**
+    * Starts this session's Consumers
+    */
+   void setStarted(boolean s) throws Throwable
+   {
+      //We clone to prevent deadlock http://jira.jboss.org/jira/browse/JBMESSAGING-836
+      Map consumersClone;
+      synchronized(consumers)
+      {
+         consumersClone = new HashMap(consumers);
+      }
+      
+      for(Iterator i = consumersClone.values().iterator(); i.hasNext(); )
+      {
+         ServerConsumerEndpoint sce = (ServerConsumerEndpoint)i.next();
+         if (s)
+         {
+            sce.start();
+         }
+         else
+         {
+            sce.stop();
+         }
+      }      
+   } 
+   
+   void promptDelivery(final Channel channel)
+   {
+      try
+      {
+         //Prompting delivery must be asynchronous to avoid deadlock
+         //but we cannot use one way invocations on cancelDelivery and
+         //cancelDeliveries because remoting one way invocations can 
+         //overtake each other in flight - this problem will
+         //go away when we have our own transport and our dedicated connection
+         this.executor.execute(new Runnable() { public void run() { channel.deliver(); } } );
+      }
+      catch (Throwable t)
+      {
+         log.error("Failed to prompt delivery", t);
+      }
+   }
+   
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+   
+   private Delivery cancelDeliveryInternal(Cancel cancel) throws Throwable
+   {
+      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(cancel.getDeliveryId()));
+      
+      if (rec == null)
+      {
+         throw new IllegalStateException("Cannot find delivery to cancel " + cancel.getDeliveryId());
+      }
+                 
+      //Note we check the flag *and* evaluate again, this is because the server and client clocks may
+      //be out of synch and don't want to send back to the client a message it thought it has sent to
+      //the expiry queue  
+      boolean expired = cancel.isExpired() || rec.del.getReference().getMessage().isExpired();
+      
+      //Note we check the flag *and* evaluate again, this is because the server value of maxDeliveries
+      //might get changed after the client has sent the cancel - and we don't want to end up cancelling
+      //back to the original queue
+      boolean reachedMaxDeliveryAttempts =
+         cancel.isReachedMaxDeliveryAttempts() || cancel.getDeliveryCount() >= maxDeliveryAttempts;
+                    
+      Delivery del = rec.del;   
+         
+      if (!expired && !reachedMaxDeliveryAttempts)
+      {
+         //Normal cancel back to the queue
+         
+         del.getReference().setDeliveryCount(cancel.getDeliveryCount());
+         
+         //Do we need to set a redelivery delay?
+         
+         if (rec.redeliveryDelay != 0)
+         {
+            del.getReference().setScheduledDeliveryTime(System.currentTimeMillis() + rec.redeliveryDelay);
+         }
+         
+         del.cancel();
+      }
+      else
+      {                  
+         if (expired)
+         {
+            //Sent to expiry queue
+            
+            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
+            
+            moveInTransaction(copy, del, rec.expiryQueue);
+         }
+         else
+         {
+            //Send to DLQ
+            
+            JBossMessage copy = makeCopyForDLQOrExpiry(false, del);
+            
+            moveInTransaction(copy, del, rec.dlq);
+         }
+      }      
+      
+      return rec.del;
+   }      
+   
+   private JBossMessage makeCopyForDLQOrExpiry(boolean expiry, Delivery del) throws Exception
+   {
+      //We copy the message and send that to the dlq/expiry queue - this is because
+      //otherwise we may end up with a ref with the same message id in the queue more than once
+      //which would barf - this might happen if the same message had been expire from multiple
+      //subscriptions of a topic for example
+      //We set headers that hold the original message destination, expiry time and original message id
+      
+      JBossMessage msg = ((JBossMessage)del.getReference().getMessage());
+      
+      JBossMessage copy = msg.doCopy();
+      
+      long newMessageId = sp.getMessageIDManager().getID();
+      
+      copy.setMessageId(newMessageId);
+      
+      //reset expiry
+      copy.setExpiration(0);
+      
+      String origMessageId = msg.getJMSMessageID();
+      
+      String origDest = msg.getJMSDestination().toString();
+            
+      copy.setStringProperty(JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
+      
+      copy.setStringProperty(JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
+      
+      if (expiry)
+      {
+         long actualExpiryTime = System.currentTimeMillis();
+         
+         copy.setLongProperty(JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
+      }
+      
+      return copy;
+   }
+   
+   private void moveInTransaction(JBossMessage msg, Delivery del, Queue queue) throws Throwable
+   {
+      Transaction tx = tr.createTransaction();
+      
+      MessageReference ref = ms.reference(msg);
+                       
+      try
+      {               
+         if (queue != null)
+         {                                                       
+            queue.handle(null, ref, tx);
+            del.acknowledge(tx);
+         }
+         else
+         {
+            log.warn("Cannot move to destination since destination has not been deployed! " +
+               "The message will be removed");
+            
+            del.acknowledge(tx);
+         }             
+         
+         tx.commit();         
+      }
+      catch (Throwable t)
+      {
+         tx.rollback();
+         throw t;
+      } 
+      finally
+      {
+         if (ref != null)
+         {
+            ref.releaseMemoryReference();
+         }
+      }
+      
+      //Need to prompt delivery on the dlq/expiry queue
+      
+      //TODO - are we sure this is the right place to prompt delivery?
+      if (queue != null)
+      {
+         promptDelivery(queue);
+      }
+   }
+   
+   private void acknowledgeDeliveryInternal(Ack ack) throws Throwable
+   {
+      if (trace) { log.trace(this + " acknowledging delivery " + ack); }
+      
+      DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(ack.getDeliveryID()));
+      
+      if (rec == null)
+      {
+         log.warn("Cannot find " + ack + " to acknowledge, " +
+            "maybe it was already acknowledged before failover!");
+         return;
+      }
+      
+      rec.del.acknowledge(null);    
+      
+      if (trace) { log.trace(this + " acknowledged delivery " + ack); }
+   }
+
+   private ConsumerDelegate createConsumerDelegateInternal(JBossDestination jmsDestination,
+                                                           String selectorString,
+                                                           boolean noLocal,
+                                                           String subscriptionName)
+      throws Throwable
+   {
+      if (closed)
+      {
+         throw new IllegalStateException("Session is closed");
+      }
+      
+      if ("".equals(selectorString))
+      {
+         selectorString = null;
+      }
+      
+      if (trace)
+      {
+         log.trace(this + " creating consumer for " + jmsDestination +
+            (selectorString == null ? "" : ", selector '" + selectorString + "'") +
+            (subscriptionName == null ? "" : ", subscription '" + subscriptionName + "'") +
+            (noLocal ? ", noLocal" : ""));
+      }
+
+      ManagedDestination mDest = dm.
+         getDestination(jmsDestination.getName(), jmsDestination.isQueue());
+      
+      if (mDest == null)
+      {
+         throw new InvalidDestinationException("No such destination: " + jmsDestination);
+      }
+      
+      if (jmsDestination.isTemporary())
+      {
+         // Can only create a consumer for a temporary destination on the same connection
+         // that created it
+         if (!connectionEndpoint.hasTemporaryDestination(jmsDestination))
+         {
+            String msg = "Cannot create a message consumer on a different connection " +
+                         "to that which created the temporary destination";
+            throw new IllegalStateException(msg);
+         }
+      }
+      
+      int consumerID = connectionEndpoint.getServerPeer().getNextObjectID();
+      
+      Binding binding = null;
+      
+      // Always validate the selector first
+      Selector selector = null;
+      if (selectorString != null)
+      {
+         selector = new Selector(selectorString);
+      }
+      
+      if (jmsDestination.isTopic())
+      {
+         JMSCondition topicCond = new JMSCondition(false, jmsDestination.getName());
+         
+         if (subscriptionName == null)
+         {
+            // non-durable subscription
+            if (log.isTraceEnabled()) { log.trace(this + " creating new non-durable subscription on " + jmsDestination); }
+            
+            // Create the non durable sub
+                        
+            PagingFilteredQueue q;
+            
+            if (postOffice.isLocal() || !mDest.isClustered())
+            {
+               q = new PagingFilteredQueue(new GUID().toString(), idm.getID(), ms, pm, true, false,
+                        mDest.getMaxSize(), selector,
+                        mDest.getFullSize(),
+                        mDest.getPageSize(),
+                        mDest.getDownCacheSize());
+               
+               binding = postOffice.bindQueue(topicCond, q);
+            }
+            else
+            {  
+               q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, new GUID().toString(),
+                                           idm.getID(), ms, pm, true, false,
+                                           mDest.getMaxSize(), selector, tr,
+                                           mDest.getFullSize(),
+                                           mDest.getPageSize(),
+                                           mDest.getDownCacheSize());
+               
+               ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+
+               binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
+            }
+            String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
+  
+            int dayLimitToUse = mDest.getMessageCounterHistoryDayLimit();
+            if (dayLimitToUse == -1)
+            {
+               //Use override on server peer
+               dayLimitToUse = sp.getDefaultMessageCounterHistoryDayLimit();
+            }
+            
+            MessageCounter counter =
+               new MessageCounter(counterName, null, q, true, false,
+                                  dayLimitToUse);
+            
+            sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+         }
+         else
+         {
+            if (jmsDestination.isTemporary())
+            {
+               throw new InvalidDestinationException("Cannot create a durable subscription on a temporary topic");
+            }
+            
+            // We have a durable subscription, look it up
+            String clientID = connectionEndpoint.getClientID();
+            if (clientID == null)
+            {
+               throw new JMSException("Cannot create durable subscriber without a valid client ID");
+            }
+            
+            // See if there any bindings with the same client_id.subscription_name name
+            
+            String name = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);
+            
+            binding = postOffice.getBindingForQueueName(name);
+            
+            if (binding == null)
+            {
+               // Does not already exist
+               
+               if (trace) { log.trace(this + " creating new durable subscription on " + jmsDestination); }
+                              
+               PagingFilteredQueue q;
+
+               if (postOffice.isLocal())
+               {
+                  q = new PagingFilteredQueue(name, idm.getID(), ms, pm, true, true,
+                                              mDest.getMaxSize(), selector,
+                                              mDest.getFullSize(),
+                                              mDest.getPageSize(),
+                                              mDest.getDownCacheSize());
+
+                  binding = postOffice.bindQueue(topicCond, q);
+               }
+               else
+               {
+                  q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, name, idm.getID(),
+                                              ms, pm, true, true,
+                                              mDest.getMaxSize(), selector, tr,
+                                              mDest.getFullSize(),
+                                              mDest.getPageSize(),
+                                              mDest.getDownCacheSize());
+                  
+                  ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+                  
+                  if (mDest.isClustered())
+                  {
+                     binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
+                  }
+                  else
+                  {
+                     binding = cpo.bindQueue(topicCond, q);
+                  }
+               }
+               String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
+                       
+               MessageCounter counter =
+                  new MessageCounter(counterName, subscriptionName, q, true, true,
+                                     mDest.getMessageCounterHistoryDayLimit());
+               
+               sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+            }
+            else
+            {
+               //Durable sub already exists
+               
+               if (trace) { log.trace(this + " subscription " + subscriptionName + " already exists"); }
+               
+               // From javax.jms.Session Javadoc (and also JMS 1.1 6.11.1):
+               // A client can change an existing durable subscription by creating a durable
+               // TopicSubscriber with the same name and a new topic and/or message selector.
+               // Changing a durable subscriber is equivalent to unsubscribing (deleting) the old
+               // one and creating a new one.
+               
+               String filterString =
+                  binding.getQueue().getFilter() != null ?
+                     binding.getQueue().getFilter().getFilterString() : null;
+               
+               boolean selectorChanged =
+                  (selectorString == null && filterString != null) ||
+                  (filterString == null && selectorString != null) ||
+                  (filterString != null && selectorString != null &&
+                           !filterString.equals(selectorString));
+               
+               if (trace) { log.trace("selector " + (selectorChanged ? "has" : "has NOT") + " changed"); }
+               
+               JMSCondition cond = (JMSCondition)binding.getCondition();
+               
+               boolean topicChanged = !cond.getName().equals(jmsDestination.getName());
+               
+               if (log.isTraceEnabled()) { log.trace("topic " + (topicChanged ? "has" : "has NOT") + " changed"); }
+               
+               if (selectorChanged || topicChanged)
+               {
+                  if (trace) { log.trace("topic or selector changed so deleting old subscription"); }
+                  
+                  // Unbind the durable subscription
+                  
+                  if (mDest.isClustered() && !postOffice.isLocal())
+                  {
+                     ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+                     
+                     cpo.unbindClusteredQueue(name);
+                  }
+                  else
+                  {
+                     postOffice.unbindQueue(name);
+                  }
+                  
+                  // create a fresh new subscription
+                                    
+                  PagingFilteredQueue q;
+                  
+                  if (postOffice.isLocal())
+                  {
+                     q = new PagingFilteredQueue(name, idm.getID(), ms, pm, true, true,
+                              mDest.getMaxSize(), selector,
+                              mDest.getFullSize(),
+                              mDest.getPageSize(),
+                              mDest.getDownCacheSize());
+                     binding = postOffice.bindQueue(topicCond, q);
+                  }
+                  else
+                  {
+                     q = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, name, idm.getID(), ms, pm, true, true,
+                              mDest.getMaxSize(), selector, tr,
+                              mDest.getFullSize(),
+                              mDest.getPageSize(),
+                              mDest.getDownCacheSize());
+                     
+                     ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+                     
+                     if (mDest.isClustered())
+                     {
+                        binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
+                     }
+                     else
+                     {
+                        binding = cpo.bindQueue(topicCond, (LocalClusteredQueue)q);
+                     }
+                  }
+                  String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
+                  
+                  MessageCounter counter =
+                     new MessageCounter(counterName, subscriptionName, q, true, true,
+                                        mDest.getMessageCounterHistoryDayLimit());
+                  
+                  sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+               }
+            }
+         }
+      }
+      else
+      {
+         // Consumer on a jms queue
+         
+         // Let's find the binding
+         binding = postOffice.getBindingForQueueName(jmsDestination.getName());
+         
+         if (binding == null)
+         {
+            throw new IllegalStateException("Cannot find binding for jms queue: " + jmsDestination.getName());
+         }
+      }
+      
+      int prefetchSize = connectionEndpoint.getPrefetchSize();
+      
+      Queue dlqToUse = mDest.getDLQ() == null ? defaultDLQ : mDest.getDLQ();
+      
+      Queue expiryQueueToUse = mDest.getExpiryQueue() == null ? defaultExpiryQueue : mDest.getExpiryQueue();
+      
+      long redeliveryDelay = mDest.getRedeliveryDelay();
+      
+      if (redeliveryDelay == 0)
+      {
+         redeliveryDelay = sp.getDefaultRedeliveryDelay();
+      }
+      
+      ServerConsumerEndpoint ep =
+         new ServerConsumerEndpoint(consumerID, (PagingFilteredQueue)binding.getQueue(),
+                  binding.getQueue().getName(), this, selectorString, noLocal,
+                  jmsDestination, dlqToUse, expiryQueueToUse, redeliveryDelay);
+      
+      ConsumerAdvised advised;
+      
+      // Need to synchronized to prevent a deadlock
+      // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
+      synchronized (AspectManager.instance())
+      {       
+         advised = new ConsumerAdvised(ep);
+      }
+      
+      Dispatcher.instance.registerTarget(consumerID, advised);
+      
+      ClientConsumerDelegate stub =
+         new ClientConsumerDelegate(consumerID,
+                                    prefetchSize, maxDeliveryAttempts);
+      
+      synchronized (consumers)
+      {
+         consumers.put(new Integer(consumerID), ep);
+      }
+         
+      log.debug(this + " created and registered " + ep);
+      
+      return stub;
+   }   
+
+   private BrowserDelegate createBrowserDelegateInternal(JBossDestination jmsDestination,
+                                                         String selector) throws Throwable
+   {
+      if (closed)
+      {
+         throw new IllegalStateException("Session is closed");
+      }
+
+      if (jmsDestination == null)
+      {
+         throw new InvalidDestinationException("null destination");
+      }
+
+      if (jmsDestination.isTopic())
+      {
+         throw new IllegalStateException("Cannot browse a topic");
+      }
+
+      if (dm.getDestination(jmsDestination.getName(), jmsDestination.isQueue()) == null)
+      {
+         throw new InvalidDestinationException("No such destination: " + jmsDestination);
+      }
+
+      log.debug(this + " creating browser for " + jmsDestination +
+         (selector == null ? "" : ", selector '" + selector + "'"));
+
+      Binding binding = postOffice.getBindingForQueueName(jmsDestination.getName()); // TODO
+
+      int browserID = connectionEndpoint.getServerPeer().getNextObjectID();
+
+      ServerBrowserEndpoint ep =
+         new ServerBrowserEndpoint(this, browserID,
+                                   (PagingFilteredQueue)binding.getQueue(), selector);
+
+      // still need to synchronized since close() can come in on a different thread
+      synchronized (browsers)
+      {
+         browsers.put(new Integer(browserID), ep);
+      }
+
+      BrowserAdvised advised;
+      
+      // Need to synchronized to prevent a deadlock
+      // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
+      synchronized (AspectManager.instance())
+      {       
+         advised = new BrowserAdvised(ep);
+      }
+      
+      Dispatcher.instance.registerTarget(browserID, advised);
+
+      ClientBrowserDelegate stub = new ClientBrowserDelegate(browserID);
+
+      log.debug(this + " created and registered " + ep);
+
+      return stub;
+   }
+
+   private void promptDelivery(Set channels)
+   {
+      //Now prompt delivery on the channels
+      Iterator iter = channels.iterator();
+      
+      while (iter.hasNext())
+      {
+         DeliveryObserver observer = (DeliveryObserver)iter.next();
+         
+         promptDelivery((Channel)observer);
+      }
+   }
+   
+   // Inner classes --------------------------------------------------------------------------------
+   
+   /*
+    * Holds a record of a delivery - we need to store the consumer id as well
+    * hence this class
+    * We can't rely on the cancel being driven from the MessageCallbackHandler since
+    * the deliveries may have got lost in transit (ignored) since the consumer might have closed
+    * when they were in transit.
+    * In such a case we might otherwise end up with the consumer closing but not all it's deliveries being
+    * cancelled, which would mean they wouldn't be cancelled until the session is closed which is too late
+    * 
+    * We need to store various pieces of information, such as consumer id, dlq, expiry queue
+    * since we need this at cancel time, but by then the actual consumer might have closed
+    */
+   private static class DeliveryRecord
+   {
+      Delivery del;
+      
+      int consumerId;
+      
+      Queue dlq;
+      
+      Queue expiryQueue;
+      
+      long redeliveryDelay;
+      
+      DeliveryRecord(Delivery del, int consumerId, Queue dlq, Queue expiryQueue, long redeliveryDelay)
+      {
+         this.del = del;
+         
+         this.consumerId = consumerId;
+         
+         this.dlq = dlq;
+         
+         this.expiryQueue = expiryQueue;
+         
+         this.redeliveryDelay = redeliveryDelay;
+      }            
+   }
+   
+   /**
+    * 
+    * The purpose of this class is to remove deliveries from the delivery list on commit
+    * Each transaction has once instance of this per SCE
+    *
+    */
+   private class DeliveryCallback implements TxCallback
+   {
+      List delList = new ArrayList();
+         
+      public void beforePrepare()
+      {         
+         //NOOP
+      }
+      
+      public void beforeCommit(boolean onePhase)
+      {         
+         //NOOP
+      }
+      
+      public void beforeRollback(boolean onePhase)
+      {         
+         //NOOP
+      }
+      
+      public void afterPrepare()
+      {         
+         //NOOP
+      }
+      
+      public synchronized void afterCommit(boolean onePhase) throws TransactionException
+      {
+         // Remove the deliveries from the delivery map.
+         Iterator iter = delList.iterator();
+         while (iter.hasNext())
+         {
+            Long deliveryId = (Long)iter.next();
+            
+            deliveries.remove(deliveryId);
+         }
+      }
+      
+      public void afterRollback(boolean onePhase) throws TransactionException
+      {                            
+         //One phase rollbacks never hit the server - they are dealt with locally only
+         //so this would only ever be executed for a two phase rollback.
+
+         //We don't do anything since cancellation is driven from the client.
+      }
+      
+      synchronized void addDeliveryId(Long deliveryId)
+      {
+         delList.add(deliveryId);
+      }
+   }
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/util/ThreadContextClassLoaderChanger.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/jms/util/ThreadContextClassLoaderChanger.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/jms/util/ThreadContextClassLoaderChanger.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,78 +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.util;
-
-/**
- * A thread context classloader changer. This class is an abomination. It is here for experimental
- * purposes only. The way it changes the class loader (and more important, the way it stores the
- * saved thread context class loader) is inneficient and dangerous.
- *
- * TODO: Do not use it in the production version.
- *       See http://www.jboss.org/index.html?module=bb&op=viewtopic&t=74434 for an alternative solution.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ThreadContextClassLoaderChanger
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   private ClassLoader savedThreadContextClassLoader;
-
-   public void set(ClassLoader cl)
-   {
-      Thread currentThread = Thread.currentThread();
-      savedThreadContextClassLoader = currentThread.getContextClassLoader();
-      currentThread.setContextClassLoader(cl);
-   }
-
-   /**
-    * Use it from a finally block.
-    */
-   public void restore()
-   {
-      if (savedThreadContextClassLoader == null)
-      {
-         return;
-      }
-
-      Thread.currentThread().setContextClassLoader(savedThreadContextClassLoader);
-      savedThreadContextClassLoader = null;
-   }
-   // Attributes ----------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-   
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------   
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java (from rev 2552, branches/Branch_1_2_0_SP/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,86 @@
+/*
+   * 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.messaging.util;
+
+import java.io.ObjectInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectStreamClass;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ * 
+ * $Id$
+ */
+public class ObjectInputStreamWithClassLoader extends ObjectInputStream
+{
+
+   // Constants ------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ObjectInputStreamWithClassLoader(InputStream in)
+      throws IOException
+   {
+      super(in);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
+   {
+      String name = desc.getName();
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         Class clazz = loader.loadClass(name);
+         // sanity check only.. if a classLoader can't find a clazz, it will throw an exception
+         if (clazz == null)
+         {
+            return super.resolveClass(desc);
+         }
+         else
+         {
+            return clazz;
+         }
+      }
+      catch (ClassNotFoundException e)
+      {
+         return super.resolveClass(desc);
+      }
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java
===================================================================
--- branches/Branch_1_2_0_SP/src/main/org/jboss/messaging/util/StreamUtils.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,378 +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.messaging.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
-/**
- * A StreamUtils
- *
- * Utility methods for reading and writing stuff to and from streams
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class StreamUtils
-{
-   private static final int BUFFER_SIZE = 4096;
-   
-   public static final byte NULL = 0;
-   
-   public static final byte STRING = 1;
-   
-   public static final byte MAP = 2;
-   
-   public static final byte BYTE = 3;
-
-   public static final byte SHORT = 4;
-
-   public static final byte INT = 5;
-
-   public static final byte LONG = 6;
-
-   public static final byte FLOAT = 7;
-
-   public static final byte DOUBLE = 8;
-
-   public static final byte BOOLEAN = 9;
-   
-   public static final byte BYTES = 10;
-     
-   public static final byte LIST = 11;
-   
-   public static final byte SERIALIZABLE = 12;
-   
-   public static final byte DESTINATION = 13;
-   
-   private static boolean useJBossSerialization = false;
-   
-   public static void setUseJBossSerialization(boolean use)
-   {
-      useJBossSerialization = use;
-   }
-
-         
-   public static Object readObject(DataInputStream in, boolean longStrings)
-      throws IOException, ClassNotFoundException
-   {
-      byte type = in.readByte();
-      Object value = null;
-      switch (type)
-      {
-         case NULL:
-         {
-            value = null;
-            break;
-         }
-         case STRING :
-            if (longStrings)
-            {
-               //We cope with >= 64K Strings
-               value = SafeUTF.instance.safeReadUTF(in);
-            }
-            else
-            {
-               //Limited to < 64K Strings
-               value = in.readUTF();
-            }
-            break;
-         case DESTINATION:
-         {
-            value = JBossDestination.readDestination(in);
-            break;
-         }
-         case MAP:
-         {
-            value = readMap(in, false);
-            break;
-         } 
-         case BYTE :
-            value = new Byte(in.readByte());
-            break;
-         case SHORT :
-            value = new Short(in.readShort());
-            break;
-         case INT :
-            value = new Integer(in.readInt());
-            break;
-         case LONG :
-            value = new Long(in.readLong());
-            break;
-         case FLOAT :
-            value = new Float(in.readFloat());
-            break;
-         case DOUBLE :
-            value = new Double(in.readDouble());
-            break;
-         case BOOLEAN :
-            value = in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
-            break;         
-         case BYTES :
-            int size = in.readInt();
-            byte[] bytes = new byte[size];
-            in.readFully(bytes);
-            value = bytes;
-            break;                   
-         case LIST:
-         {
-            value = readList(in);
-            break;
-         }
-         case SERIALIZABLE:
-         {
-            ObjectInputStream ois;
-            if (useJBossSerialization)
-            {
-               ois = new JBossObjectInputStream(in);
-            }
-            else
-            {
-               ois = new ObjectInputStream(in);
-            }
-                        
-            value = (Serializable)ois.readObject();
-            break;
-         }              
-         default :
-         {
-            throw new IllegalStateException("Unknown type: " + type);
-         }
-      }
-      return value;
-   }
-   
-   public static void writeObject(DataOutputStream out, Object object,
-                                  boolean containerTypes, boolean longStrings) throws IOException
-   {
-      // more efficient than using object serialization for well known types
-      if (object == null)
-      {
-         out.writeByte(NULL);
-      }
-      else if (object instanceof String)
-      {
-         out.writeByte(STRING);
-         if (longStrings)
-         {
-            //We can cope with >=64K Strings
-            SafeUTF.instance.safeWriteUTF(out, (String)object);
-         }
-         else
-         {
-            //Limited to < 64K Strings
-            out.writeUTF((String)object);
-         }
-      }
-      else if (object instanceof JBossDestination)
-      {
-         out.writeByte(DESTINATION);
-         JBossDestination.writeDestination(out, (JBossDestination)object);
-      }
-      else if (containerTypes && object instanceof Map)
-      {
-         out.writeByte(MAP);
-         writeMap(out, (Map)object, false);
-      }      
-      else if (object instanceof Integer)
-      {
-         out.writeByte(INT);
-         out.writeInt(((Integer) object).intValue());
-      }
-      else if (object instanceof Boolean)
-      {
-         out.writeByte(BOOLEAN);
-         out.writeBoolean(((Boolean) object).booleanValue());
-      }
-      else if (object instanceof Byte)
-      {
-         out.writeByte(BYTE);
-         out.writeByte(((Byte) object).byteValue());
-      }
-      else if (object instanceof Short)
-      {
-         out.writeByte(SHORT);
-         out.writeShort(((Short) object).shortValue());
-      }
-      else if (object instanceof Long)
-      {
-         out.writeByte(LONG);
-         out.writeLong(((Long) object).longValue());
-      }
-      else if (object instanceof Float)
-      {
-         out.writeByte(FLOAT);
-         out.writeFloat(((Float) object).floatValue());
-      }
-      else if (object instanceof Double)
-      {
-         out.writeByte(DOUBLE);
-         out.writeDouble(((Double) object).doubleValue());
-      }
-      else if (object instanceof byte[])
-      {
-         out.writeByte(BYTES);
-         byte[] bytes = (byte[])object;
-         out.writeInt(bytes.length);
-         out.write(bytes);
-      }      
-      else if (containerTypes && object instanceof List)
-      {
-         out.write(LIST);
-         writeList(out, (List)object);
-      }      
-      else if (object instanceof Serializable)
-      {
-         out.writeByte(SERIALIZABLE);
-         ObjectOutputStream oos;
-         
-         if (useJBossSerialization)
-         {
-            oos = new JBossObjectOutputStream(out);
-         }
-         else
-         {
-            oos = new ObjectOutputStream(out);
-         }
-                  
-         oos.writeObject(object);
-         oos.flush();
-      }
-      else
-      {
-         throw new IllegalArgumentException("Don't know how to deal with object " + object);
-      }
-   }  
-   
-   public static void writeList(DataOutputStream out, List list) throws IOException
-   {
-      out.writeInt(list.size());
-      Iterator iter = list.iterator();
-      while (iter.hasNext())
-      {
-         Object value = iter.next();
-         writeObject(out, value, false, false);
-      }
-   }
-   
-   public static ArrayList readList(DataInputStream in) throws ClassNotFoundException, IOException
-   {
-      int size = in.readInt();
-      ArrayList list = new ArrayList(size);
-      for (int i = 0; i < size; i++)
-      {
-         Object obj = readObject(in, false);
-         list.add(obj);
-      }
-      return list;
-   }
-   
-   public static void writeMap(DataOutputStream out, Map map, boolean stringKeys) throws IOException
-   {      
-      Set entrySet = map.entrySet();
-      out.writeInt(entrySet.size());
-      for (Iterator it = entrySet.iterator(); it.hasNext(); )
-      {
-         Map.Entry me = (Map.Entry)it.next();
-         
-         //Write the key
-         if (stringKeys)
-         {
-            out.writeUTF((String)me.getKey());
-         }
-         else
-         {
-            writeObject(out, me.getKey(), false, false);
-         }
-        
-         // write the value
-         writeObject(out, me.getValue(), false, false);
-      }      
-   }
-   
-   public static HashMap readMap(DataInputStream in, boolean stringKeys) throws IOException, ClassNotFoundException
-   {     
-      int size = in.readInt();
-      HashMap m = new HashMap(size);
-      for (int i = 0; i < size; i++)
-      {
-         Object key;
-         if (stringKeys)
-         {
-            key = in.readUTF();
-         }
-         else
-         {
-            key = readObject(in, false);
-         }
-         
-         Object value = readObject(in, false);
-         
-         m.put(key, value);
-      }
-      return m;      
-   }  
-   
-   public static byte[] toBytes(Streamable streamable) throws Exception
-   {
-      ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFFER_SIZE);
-      
-      DataOutputStream daos = new DataOutputStream(baos);
-      
-      streamable.write(daos);
-      
-      daos.close();
-      
-      return baos.toByteArray();
-   }
-   
-   public static void fromBytes(Streamable streamable, byte[] bytes) throws Exception
-   {
-      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-      
-      DataInputStream dais = new DataInputStream(bais);
-      
-      streamable.read(dais);
-      
-      dais.close();
-   }
-   
-}

Copied: tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java (from rev 2552, branches/Branch_1_2_0_SP/src/main/org/jboss/messaging/util/StreamUtils.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/src/main/org/jboss/messaging/util/StreamUtils.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,378 @@
+/*
+ * 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.messaging.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStream;
+
+/**
+ * A StreamUtils
+ *
+ * Utility methods for reading and writing stuff to and from streams
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ *
+ */
+public class StreamUtils
+{
+   private static final int BUFFER_SIZE = 4096;
+   
+   public static final byte NULL = 0;
+   
+   public static final byte STRING = 1;
+   
+   public static final byte MAP = 2;
+   
+   public static final byte BYTE = 3;
+
+   public static final byte SHORT = 4;
+
+   public static final byte INT = 5;
+
+   public static final byte LONG = 6;
+
+   public static final byte FLOAT = 7;
+
+   public static final byte DOUBLE = 8;
+
+   public static final byte BOOLEAN = 9;
+   
+   public static final byte BYTES = 10;
+     
+   public static final byte LIST = 11;
+   
+   public static final byte SERIALIZABLE = 12;
+   
+   public static final byte DESTINATION = 13;
+   
+   private static boolean useJBossSerialization = false;
+   
+   public static void setUseJBossSerialization(boolean use)
+   {
+      useJBossSerialization = use;
+   }
+
+         
+   public static Object readObject(DataInputStream in, boolean longStrings)
+      throws IOException, ClassNotFoundException
+   {
+      byte type = in.readByte();
+      Object value = null;
+      switch (type)
+      {
+         case NULL:
+         {
+            value = null;
+            break;
+         }
+         case STRING :
+            if (longStrings)
+            {
+               //We cope with >= 64K Strings
+               value = SafeUTF.instance.safeReadUTF(in);
+            }
+            else
+            {
+               //Limited to < 64K Strings
+               value = in.readUTF();
+            }
+            break;
+         case DESTINATION:
+         {
+            value = JBossDestination.readDestination(in);
+            break;
+         }
+         case MAP:
+         {
+            value = readMap(in, false);
+            break;
+         } 
+         case BYTE :
+            value = new Byte(in.readByte());
+            break;
+         case SHORT :
+            value = new Short(in.readShort());
+            break;
+         case INT :
+            value = new Integer(in.readInt());
+            break;
+         case LONG :
+            value = new Long(in.readLong());
+            break;
+         case FLOAT :
+            value = new Float(in.readFloat());
+            break;
+         case DOUBLE :
+            value = new Double(in.readDouble());
+            break;
+         case BOOLEAN :
+            value = in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
+            break;         
+         case BYTES :
+            int size = in.readInt();
+            byte[] bytes = new byte[size];
+            in.readFully(bytes);
+            value = bytes;
+            break;                   
+         case LIST:
+         {
+            value = readList(in);
+            break;
+         }
+         case SERIALIZABLE:
+         {
+            ObjectInputStream ois;
+            if (useJBossSerialization)
+            {
+               ois = new JBossObjectInputStream(in, Thread.currentThread().getContextClassLoader());
+            }
+            else
+            {
+               ois = new ObjectInputStreamWithClassLoader(in);
+            }
+                        
+            value = ois.readObject();
+            break;
+         }              
+         default :
+         {
+            throw new IllegalStateException("Unknown type: " + type);
+         }
+      }
+      return value;
+   }
+   
+   public static void writeObject(DataOutputStream out, Object object,
+                                  boolean containerTypes, boolean longStrings) throws IOException
+   {
+      // more efficient than using object serialization for well known types
+      if (object == null)
+      {
+         out.writeByte(NULL);
+      }
+      else if (object instanceof String)
+      {
+         out.writeByte(STRING);
+         if (longStrings)
+         {
+            //We can cope with >=64K Strings
+            SafeUTF.instance.safeWriteUTF(out, (String)object);
+         }
+         else
+         {
+            //Limited to < 64K Strings
+            out.writeUTF((String)object);
+         }
+      }
+      else if (object instanceof JBossDestination)
+      {
+         out.writeByte(DESTINATION);
+         JBossDestination.writeDestination(out, (JBossDestination)object);
+      }
+      else if (containerTypes && object instanceof Map)
+      {
+         out.writeByte(MAP);
+         writeMap(out, (Map)object, false);
+      }      
+      else if (object instanceof Integer)
+      {
+         out.writeByte(INT);
+         out.writeInt(((Integer) object).intValue());
+      }
+      else if (object instanceof Boolean)
+      {
+         out.writeByte(BOOLEAN);
+         out.writeBoolean(((Boolean) object).booleanValue());
+      }
+      else if (object instanceof Byte)
+      {
+         out.writeByte(BYTE);
+         out.writeByte(((Byte) object).byteValue());
+      }
+      else if (object instanceof Short)
+      {
+         out.writeByte(SHORT);
+         out.writeShort(((Short) object).shortValue());
+      }
+      else if (object instanceof Long)
+      {
+         out.writeByte(LONG);
+         out.writeLong(((Long) object).longValue());
+      }
+      else if (object instanceof Float)
+      {
+         out.writeByte(FLOAT);
+         out.writeFloat(((Float) object).floatValue());
+      }
+      else if (object instanceof Double)
+      {
+         out.writeByte(DOUBLE);
+         out.writeDouble(((Double) object).doubleValue());
+      }
+      else if (object instanceof byte[])
+      {
+         out.writeByte(BYTES);
+         byte[] bytes = (byte[])object;
+         out.writeInt(bytes.length);
+         out.write(bytes);
+      }      
+      else if (containerTypes && object instanceof List)
+      {
+         out.write(LIST);
+         writeList(out, (List)object);
+      }      
+      else if (object instanceof Serializable)
+      {
+         out.writeByte(SERIALIZABLE);
+         ObjectOutputStream oos;
+         
+         if (useJBossSerialization)
+         {
+            oos = new JBossObjectOutputStream(out);
+         }
+         else
+         {
+            oos = new ObjectOutputStream(out);
+         }
+                  
+         oos.writeObject(object);
+         oos.flush();
+      }
+      else
+      {
+         throw new IllegalArgumentException("Don't know how to deal with object " + object);
+      }
+   }  
+   
+   public static void writeList(DataOutputStream out, List list) throws IOException
+   {
+      out.writeInt(list.size());
+      Iterator iter = list.iterator();
+      while (iter.hasNext())
+      {
+         Object value = iter.next();
+         writeObject(out, value, false, false);
+      }
+   }
+   
+   public static ArrayList readList(DataInputStream in) throws ClassNotFoundException, IOException
+   {
+      int size = in.readInt();
+      ArrayList list = new ArrayList(size);
+      for (int i = 0; i < size; i++)
+      {
+         Object obj = readObject(in, false);
+         list.add(obj);
+      }
+      return list;
+   }
+   
+   public static void writeMap(DataOutputStream out, Map map, boolean stringKeys) throws IOException
+   {      
+      Set entrySet = map.entrySet();
+      out.writeInt(entrySet.size());
+      for (Iterator it = entrySet.iterator(); it.hasNext(); )
+      {
+         Map.Entry me = (Map.Entry)it.next();
+         
+         //Write the key
+         if (stringKeys)
+         {
+            out.writeUTF((String)me.getKey());
+         }
+         else
+         {
+            writeObject(out, me.getKey(), false, false);
+         }
+        
+         // write the value
+         writeObject(out, me.getValue(), false, false);
+      }      
+   }
+   
+   public static HashMap readMap(DataInputStream in, boolean stringKeys) throws IOException, ClassNotFoundException
+   {     
+      int size = in.readInt();
+      HashMap m = new HashMap(size);
+      for (int i = 0; i < size; i++)
+      {
+         Object key;
+         if (stringKeys)
+         {
+            key = in.readUTF();
+         }
+         else
+         {
+            key = readObject(in, false);
+         }
+         
+         Object value = readObject(in, false);
+         
+         m.put(key, value);
+      }
+      return m;      
+   }  
+   
+   public static byte[] toBytes(Streamable streamable) throws Exception
+   {
+      ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFFER_SIZE);
+      
+      DataOutputStream daos = new DataOutputStream(baos);
+      
+      streamable.write(daos);
+      
+      daos.close();
+      
+      return baos.toByteArray();
+   }
+   
+   public static void fromBytes(Streamable streamable, byte[] bytes) throws Exception
+   {
+      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+      
+      DataInputStream dais = new DataInputStream(bais);
+      
+      streamable.read(dais);
+      
+      dais.close();
+   }
+   
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/tests/build.xml
===================================================================
--- branches/Branch_1_2_0_SP/tests/build.xml	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/tests/build.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,1289 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- =========================================================================================== -->
-<!--                                                                                             -->
-<!-- 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.                                    -->
-<!--                                                                                             -->
-<!-- =========================================================================================== -->
-
-
-<!-- =========================================================================================== -->
-<!--                                                                                             -->
-<!-- $Id$ -->
-<!--                                                                                             -->
-<!-- =========================================================================================== -->
-
-<project default="tests" name="JBoss Messaging Tests">
-
-   <!--
-        'tests' is Messaging's subproject, we're relying on the main project thirdparty and lib
-        directories.
-   -->
-   <property name="project.root" value="${basedir}/.."/>
-
-   <!--
-        Import Messaging's properties, paths and everything else.
-   -->
-   <import file="../build-messaging.xml"/>
-
-   <!-- ======================================================================================== -->
-   <!-- Configuration                                                                            -->
-   <!-- ======================================================================================== -->
-
-   <property file="build.properties"/>
-
-   <property name="build.tests.remote" value="false"/>
-   <property name="test.bind.address" value="localhost"/>
-
-   <!--
-        Functional tests.
-   -->
-
-   <property name="functional.tests.database" value="mysql"/>
-   <property name="functional.tests.serialization" value="jms"/>
-
-   <!--
-        Stress tests.
-   -->
-
-   <property name="stress.tests.database" value="mysql"/>
-   <property name="stress.tests.serialization" value="jms"/>
-
-   <!-- Clustering tests -->
-   <property name="clustering.tests.database" value="mysql"/>
-   <property name ="test-mask" value="*Test"/>
-
-   <!--
-        Default remoting configuration (must be overrided by tasks that need it set otherwise).
-   -->
-   <property name="test.remoting" value="bisocket"/>
-
-
-   <!--
-       By default, remote servers log file names should end in remote-server
-   -->
-   <property name="remote.server.test.logfile.suffix" value="remote-server"/>
-
-
-   <!--
-        Project paths.
-   -->
-
-   <property name="tests.root" value="${basedir}"/>
-   <property name="source.tests.java" value="${tests.root}/src"/>
-   <property name="source.tests.stylesheets" value="${source.tests.java}/stylesheets"/>
-   <property name="tests.output" value="${tests.root}/output"/>
-   <property name="build.tests.classes" value="${tests.output}/classes"/>
-   <property name="build.tests.lib" value="${tests.output}/lib"/>
-   <property name="build.tests.reports" value="${tests.output}/reports"/>
-   <property name="build.tests.stylesheets" value="${tests.output}/stylesheets"/>
-   <property name="build.tests.archive" value="jboss-messaging-tests.jar"/>
-   <property name="build.tests.ejbarchive" value="jboss-messaging-tests-ejb.jar"/>
-   <property name="objectstore.dir" value="${tests.root}/bin/ObjectStore"/>
-
-   <!--
-        JUnit configuration (values specified in ./build.properties have priority)
-   -->
-
-   <property name="junit.printsummary" value="true"/>
-   <property name="junit.haltonerror" value="false"/>
-   <property name="junit.haltonfailure" value="false"/>
-   <property name="junit.fork" value="true"/>
-   <property name="junit.includeantruntime" value="true"/>
-   <property name="junit.timeout" value="4800000"/>
-   <property name="stress.timeout" value="4800000"/>
-
-   <property name="junit.showoutput" value="true"/>
-   <property name="junit.jvm" value=""/>
-   <property name="junit.jvm.options" value=""/>
-   <property name="junit.formatter.usefile" value="true"/>
-   <property name="junit.batchtest.todir" value="${build.tests.reports}"/>
-   <property name="junit.batchtest.haltonerror" value="false"/>
-   <property name="junit.batchtest.haltonfailure" value="false"/>
-   <property name="junit.batchtest.fork" value="true"/>
-   <property name="junit.test.haltonfailure" value="false"/>
-   <property name="junit.test.haltonerror" value="false"/>
-
-   <!--
-        Locally maintained dependencies.
-   -->
-
-   <path id="jboss.server.classpath">
-      <pathelement location="${jboss.server.lib}/jboss.jar"/>
-   </path>
-
-   <property name="jboss.jca.lib" value="${tests.root}/lib"/>
-   <path id="jboss.jca.classpath">
-      <pathelement path="${jboss.jca.lib}/jboss-jca.jar"/>
-      <pathelement path="${jboss.jca.lib}/jboss-local-jdbc.jar"/>
-      <pathelement path="${jboss.jca.lib}/jboss-common-jdbc-wrapper.jar"/>
-      <pathelement path="${jboss.jca.lib}/jms-ra.jar"/>
-   </path>
-
-   <property name="jboss.mbeans.lib" value="${tests.root}/lib"/>
-   <path id="jboss.mbeans.classpath">
-      <pathelement path="${jboss.mbeans.lib}/jboss-mbeans.jar"/>
-   </path>
-
-   <path id="jboss.naming.classpath">
-      <pathelement path="${jboss.naming.lib}/jnp-client.jar"/>
-   </path>
-
-   <!--
-       JDBC Drivers.
-   -->
-   <path id="any.jdbc.driver.classpath">
-          <fileset dir="${tests.root}/lib/jdbc-drivers" includes="*.jar"/>
-   </path>
-
-
-   <path id="mysql.jdbc.driver.classpath">
-      <pathelement path="${tests.root}/lib/mysql-connector-java-3.1.13-bin.jar"/>
-   </path>
-
-   <path id="oracle.jdbc.driver.classpath">
-      <pathelement path="${tests.root}/lib/ojdbc14.jar"/>
-   </path>
-
-   <path id="postgres.jdbc.driver.classpath">
-      <pathelement path="${tests.root}/postgresql-8.1-405.jdbc3.jar"/>
-   </path>
-
-   <!--
-        The compilation classpath.
-   -->
-
-   <path id="test.compilation.classpath">
-      <path refid="compilation.classpath"/>
-      <path location="../output/lib/jboss-messaging.jar"/>
-      <path refid="junit.junit.classpath"/>
-      <path refid="any.jdbc.driver.classpath"/>
-      <path refid="hsqldb.hsqldb.classpath"/>
-      <path refid="jboss.server.classpath"/> <!-- for org.jboss.jms.jndi.JNDIProviderAdapter -->
-      <path refid="jboss.jca.classpath"/>  <!-- for org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory, etc -->
-      <path refid="jboss.profiler.jvmti.classpath"/>
-      <path refid="jboss.test14.classpath"/>
-      <path refid="jboss.jbossretro.rt.classpath"/>
-   </path>
-
-   <!--
-        The execution classpath.
-   -->
-
-   <path id="test.execution.classpath">
-      <pathelement location="${tests.root}/etc"/>
-      <pathelement location="${build.tests.classes}"/>
-      <pathelement location="${project.root}/src/etc"/> <!-- server's configuration files -->
-      <pathelement location="${project.root}/src/etc/server/default/deploy"/>
-      <path refid="test.compilation.classpath"/>
-      <path refid="dom4j.dom4j.classpath"/>
-      <path refid="apache.log4j.classpath"/>
-      <path refid="apache.logging.classpath"/>
-      <path refid="apache.xerces.classpath"/>
-      <path refid="jboss.mbeans.classpath"/>
-      <path refid="jboss.naming.classpath"/>
-      <path refid="jboss.jbossxb.classpath"/>
-      <path refid="jgroups.jgroups.classpath"/>
-      <path refid="apache.logging.classpath"/>
-      <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">
-      <pathelement path="${tests.root}/etc/stress"/>
-      <path refid="test.execution.classpath"/>
-   </path>
-
-   <!-- ======================================================================================== -->
-   <!-- Compilation Tasks                                                                        -->
-   <!-- ======================================================================================== -->
-
-   <target name="init" depends="resolve-local-dependencies"/>
-
-   <target name="compile" depends="init">
-
-      <mkdir dir="${build.tests.classes}"/>
-      <javac destdir="${build.tests.classes}"
-             optimize="${javac.optimize}"
-             target="1.4"
-             source="1.4"
-             debug="${javac.debug}"
-             depend="${javac.depend}"
-             verbose="${javac.verbose}"
-             deprecation="${javac.deprecation}"
-             includeJavaRuntime="${javac.include.java.runtime}"
-             failonerror="${javac.fail.onerror}">
-         <src path="${source.tests.java}"/>
-         <classpath refid="test.compilation.classpath"/>
-         <include name="**/*.java"/>
-      </javac>
-
-      <!--
-           RMI compilation to to create stub for server.
-      -->
-      <rmic base="${build.tests.classes}"
-            includes="**/RMITestServer.class,**/RMINamingDelegate.class">
-         <classpath refid="test.compilation.classpath"/>
-      </rmic>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Archival Tasks                                                                           -->
-   <!-- ======================================================================================== -->
-
-   <target name="tests-jar" depends="compile">
-
-      <mkdir dir="${build.tests.lib}"/>
-      <jar jarfile="${build.tests.lib}/${build.tests.archive}">
-         <fileset dir="${build.tests.classes}">
-            <include name="org/jboss/test/messaging/**"/>
-         </fileset>
-      </jar>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Execution Helper Tasks                                                                   -->
-   <!-- ======================================================================================== -->
-
-   <target name="prepare-testdirs">
-      <mkdir dir="${build.tests.reports}"/>
-      <mkdir dir="${tests.output}/logs"/>
-   </target>
-
-   <target name="clear-test-logs" unless="test.logs.cleared">
-
-      <!-- At the beginning of a test run, clean up the logs, since log4j runs in "append" mode -->
-      <echo message="Cleaning test logs ${tests.output}/logs/*.log"/>
-      <delete quiet="true">
-         <fileset dir="${tests.output}/logs" includes="*.log"/>
-      </delete>
-      <property name="test.logs.cleared" value="true"/>
-   </target>
-
-   <target name="start-rmi-server" depends="init"
-           description="Starts the RMI server used by remote tests">
-
-      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.logfile.suffix" value="${remote.server.test.logfile.suffix}"/>
-         <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}"/>
-         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
-         -->
-         <classpath refid="test.execution.classpath"/>
-      </java>
-   </target>
-
-   <target name="start-rmi-server-clustering" depends="init"
-           description="Starts the RMI server used by clustering tests">
-
-      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
-         <sysproperty key="test.server.index" value="${test.server.index}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.logfile.suffix" value="clustering-server${test.server.index}"/>
-         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
-         <sysproperty key="test.database" value="${clustering.tests.database}"/>
-         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
-         <sysproperty key="test.clustered" value="true"/>
-         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
-         -->
-         <classpath refid="test.execution.classpath"/>
-      </java>
-   </target>
-
-   <target name="start-rmi-server-stress" depends="init"
-           description="Starts the RMI server used by remote stress tests">
-
-      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
-         <jvmarg value="-Xmx768M"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.logfile.suffix" value="remote-server-stress"/>
-         <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}"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/> -->
-         <classpath refid="stress.test.execution.classpath"/>
-
-      </java>
-   </target>
-
-   <target name="stop-rmi-server" depends="init"
-           description="Stops the RMI server used by remote tests">
-      <java classname="org.jboss.test.messaging.tools.jmx.rmi.StopRMIServer"
-            classpathref="test.execution.classpath">
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.logfile.suffix" value="stop-rmi-server"/>
-     </java>
-   </target>
-
-   <target name="stop-rmi-server-clustering" depends="init"
-           description="Stops the RMI server used by clustering tests">
-      <java classname="org.jboss.test.messaging.tools.jmx.rmi.StopRMIServer"
-            classpathref="test.execution.classpath">
-         <sysproperty key="test.server.index" value="${test.server.index}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.logfile.suffix" value="stop-rmi-server-clustering"/>
-      </java>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Test Execution Tasks                                                                     -->
-   <!-- ======================================================================================== -->
-
-   <target name="tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
-      <antcall target="crash-tests"/>
-      <antcall target="invm-tests"/>
-      <!--
-           default remoting configuration (bisocket)
-      -->
-      <antcall target="remote-tests"/>
-      <antcall target="remote-tests">
-         <param name="test.remoting" value="http"/>
-      </antcall>
-      <antcall target="clustering-tests"/>
-
-   </target>
-
-   <target name="http-tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
-      <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"/> <!-- default remoting configuration (bisocket) -->
-
-
-      <!--
-          HTTP stress tests currently fail, so they have been commented out, since they fail.
-          To be fixed for 1.2.1.
-          http://jira.jboss.com/jira/browse/JBMESSAGING-857
-
-      <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"
-           description="Runs all available tests an in-VM configuration">
-
-      <echo message=""/>
-      <echo message="Running invm tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
-      <echo message=""/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="false"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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.logfile.suffix" value="invm"/>
-         <sysproperty key="build.lib" value="${build.lib}"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-         -->
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/*Test.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/jms/stress/**"/>
-               <exclude name="**/jms/crash/*Test.class"/>
-               <exclude name="**/*LeakTest.class"/>
-               <exclude name="**/jms/bridge/**/*Test.class"/>
-               <exclude name="**/jms/manual/**/*Test.class"/>
-               <exclude name="**/jms/LongRunningInvocationTest.class"/>
-               <exclude name="**/jms/clustering/*Test.class"/>
-               <exclude name="**/jms/RemotingConnectionConfigurationTest.class"/>
-               <exclude name="**/thirdparty/remoting/ManualConnectionValidatorTest.class"/>
-               <exclude name="**/thirdparty/remoting/PureAsynchronousCallTest.class"/>
-               <exclude name="**/thirdparty/remoting/RemotingConnectionFailureTest.class"/>
-               <exclude name="**/thirdparty/remoting/CallbackServerTimeoutTest.class"/>
-               <exclude name="**/thirdparty/remoting/ClientInvokerTimeoutTest.class"/>
-               <exclude name="**/thirdparty/remoting/SocketTransportCausalityTest.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-   </target>
-
-   <target name="local-jms-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs all available tests an in-VM configuration">
-
-      <echo message=""/>
-      <echo message="Running invm tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
-      <echo message=""/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="false"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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.logfile.suffix" value="invm"/>
-         <sysproperty key="build.lib" value="${build.lib}"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-         -->
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/jms/**/*Test.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/jms/LongRunningInvocationTest.class"/>
-               <exclude name="**/jms/stress/**"/>
-               <exclude name="**/jms/crash/*Test.class"/>
-               <exclude name="**/*LeakTest.class"/>
-               <exclude name="**/jms/bridge/**/*Test.class"/>
-               <exclude name="**/jms/manual/**/*Test.class"/>
-               <exclude name="**/jms/clustering/*Test.class"/>
-               <exclude name="**/jms/RemotingConnectionConfigurationTest.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-   </target>
-
-   <target name="ref-test" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs all available tests an in-VM configuration">
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="false"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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="build.lib" value="${build.lib}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-         -->
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/jms/ReferenceableTest.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/jms/stress/**"/>
-               <exclude name="**/jms/crash/*Test.class"/>
-               <exclude name="**/*LeakTest.class"/>
-               <exclude name="**/jms/clustering/*Test.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-   </target>
-
-   <target name="invm-stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs all stress tests in an in-VM configuration">
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${stress.timeout}">
-
-         <sysproperty key="remote" value="false"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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.logfile.suffix" value="invm"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-         -->
-         <classpath refid="stress.test.execution.classpath"/>
-         <sysproperty key="jboss-junit-configuration" value="StressInVM"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-StressInVM.xml"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/jms/stress/*Test.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-   </target>
-
-   <target name="remote-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs remotely all tests for which it makes sense to run remotely">
-
-      <antcall target="stop-rmi-server"/>
-      <antcall target="start-rmi-server"/>
-
-      <mkdir dir="${build.tests.reports}"/>
-
-      <echo message=""/>
-      <echo message="Running remote tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}, remoting=${test.remoting}"/>
-      <echo message=""/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="yes"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="true"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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}"/>
-         <sysproperty key="test.logfile.suffix" value="remote-client"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
-         -->
-         <classpath>
-            <path refid="test.execution.classpath"/>
-         </classpath>
-
-         <sysproperty key="jboss-junit-configuration" value="Remote-${test.remoting}"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Remote-${test.remoting}.xml"/>
-
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-           <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
-
-            <fileset dir="${build.tests.classes}">
-               <include name="**/jms/**/${test-mask}.class"/>
-               <include name="**/thirdparty/**/${test-mask}.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/jms/WireFormatTest.class"/>
-               <exclude name="**/jms/stress/**"/>
-               <exclude name="**/jms/server/**"/>
-               <exclude name="**/jms/persistence/**"/>
-               <exclude name="**/jms/ReferencingTest.class"/>
-               <exclude name="**/jms/PersistenceTest.class"/>
-               <exclude name="**/jms/crash/*Test.class"/>
-               <exclude name="**/*LeakTest.class"/>
-               <exclude name="**/jms/ManifestTest.class"/>
-               <exclude name="**/jms/JCAWrapperTest.class"/>
-               <exclude name="**/jms/manual/**/*Test.class"/>
-               <exclude name="**/jms/clustering/*Test.class"/>
-               <exclude name="**/thirdparty/remoting/ServerAddressTest.class"/>
-               <exclude name="org/jboss/test/thirdparty/jbosssx/SecurityAssociationTest.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-
-      <antcall target="stop-rmi-server"/>
-
-   </target>
-
-   <target name="remote-stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs remotely all stress tests for which it makes sense to run remotely">
-
-      <antcall target="stop-rmi-server"/>
-      <antcall target="start-rmi-server-stress"/>
-      <mkdir dir="${build.tests.reports}"/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="yes"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${stress.timeout}">
-
-         <sysproperty key="remote" value="true"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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}"/>
-         <sysproperty key="test.logfile.suffix" value="remote-client"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=unittest"/> -->
-         <classpath>
-            <path refid="stress.test.execution.classpath"/>
-         </classpath>
-
-         <sysproperty key="jboss-junit-configuration" value="StressRemote-${test.remoting}"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-StressRemote-${test.remoting}.xml"/>
-
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/jms/stress/**/*Test.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-
-      <antcall target="stop-rmi-server"/>
-
-   </target>
-
-   <target name="clustering-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs the clustering tests">
-
-
-      <mkdir dir="${build.tests.reports}"/>
-
-      <echo message=""/>
-      <echo message="Running clustering tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
-      <echo message=""/>
-
-      <!--
-
-           By default, clustered tests are run in a "remote" configuration (the clustered
-           nodes physically live in different VMs. If you want to test a co-located clustered
-           configuration, use bin/runtest -clustered
-      -->
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="yes"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="true"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
-         <sysproperty key="test.database" value="${clustering.tests.database}"/>
-         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
-         <sysproperty key="test.clustered" value="true"/>
-         <sysproperty key="test.logfile.suffix" value="clustering-client"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <jvmarg value="-Djava.net.preferIPv4Stack=true"/>
-         <!--
-         <jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
-          -->
-
-         <classpath>
-            <path refid="test.execution.classpath"/>
-         </classpath>
-
-         <sysproperty key="jboss-junit-configuration" value="Clustering"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Clustering.xml"/>
-
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
-
-            <fileset dir="${build.tests.classes}">
-               <include name="**/jms/clustering/${test-mask}.class"/>
-               <exclude name="**/*LeakTest.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-   </target>
-
-   <target name="memory-leak-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs MemoryLeakTests, but it starts the clustering for leak-clustering-tests">
-
-
-      <mkdir dir="${build.tests.reports}"/>
-
-      <echo message=""/>
-      <echo message="Running clustering tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
-      <echo message=""/>
-
-      <!--
-
-           By default, clustered tests are run in a "remote" configuration (the clustered
-           nodes physically live in different VMs. If you want to test a co-located clustered
-           configuration, use bin/runtest -clustered
-      -->
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="yes"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="true"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
-         <sysproperty key="test.database" value="${clustering.tests.database}"/>
-         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
-         <sysproperty key="test.clustered" value="true"/>
-         <sysproperty key="test.logfile.suffix" value="clustering-client"/>
-         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <jvmarg value="-Djava.net.preferIPv4Stack=true"/>
-         <jvmarg value="-agentlib:jbossAgent"/>
-         <!--
-         <jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
-          -->
-
-         <classpath>
-            <path refid="test.execution.classpath"/>
-         </classpath>
-
-         <sysproperty key="jboss-junit-configuration" value="Clustering"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Clustering.xml"/>
-
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
-
-            <fileset dir="${build.tests.classes}">
-               <include name="**/ClusterLeakTest.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-
-   </target>
-
-   <target name="crash-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-      description="Runs crash tests">
-
-      <antcall target="stop-rmi-server"/>
-
-      <!--
-          ClientCrashTest over "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-      <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"/>
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </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 "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-
-      <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"/>
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </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 "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-
-      <antcall target="crash-test">
-         <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"/>
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </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 "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-
-      <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"/>
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </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 "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-
-      <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"/>
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </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 "bisocket"
-      -->
-
-      <antcall target="start-rmi-server">
-         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
-      </antcall>
-
-
-      <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>
-
-
-   <target name="crash-test" depends="init" description="Runs crash test">
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="yes"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-
-         <sysproperty key="remote" value="true"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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}"/>
-         <sysproperty key="test.logfile.suffix" value="crash"/>
-         <jvmarg value="-Xmx512M"/>
-         <!--
-         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-         -->
-         <classpath>
-            <path refid="test.execution.classpath"/>
-         </classpath>
-
-         <sysproperty key="jboss-junit-configuration" value="Crash-${test.remoting}"/>
-         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
-                    usefile="${junit.formatter.usefile}" extension="-Crash-${test.remoting}.xml"/>
-
-         <test name="${crash.test.name}"
-               fork="true"
-               todir="${junit.batchtest.todir}"
-               haltonfailure="${junit.test.haltonfailure}"
-               haltonerror="${junit.test.haltonerror}">
-         </test>
-
-      </junit>
-
-   </target>
-
-
-   <target name="jmstests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs the jms tests only">
-
-      <antcall target="start-rmi-server"/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-         <sysproperty key="remote" value="${build.tests.remote}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/jms/**/*Test.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/jms/stress/**"/>
-               <exclude name="org/jboss/test/messaging/jms/ManifestTest.class"/>
-               <exclude name="**/jms/clustering/*Test.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-
-      <antcall target="stop-rmi-server"/>
-
-   </target>
-
-   <target name="messagetests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs the jms tests only">
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-         <sysproperty key="remote" value="${build.tests.remote}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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="objectstore.dir" value="${objectstore.dir}"/>
-         <jvmarg value="-Xmx512M"/>
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/jms/message/**/*Test.class"/>
-            </fileset>
-         </batchtest>
-      </junit>
-
-      <antcall target="stop-rmi-server"/>
-
-   </target>
-
-   <target name="coretests" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs the jms tests only">
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-         <sysproperty key="remote" value="${build.tests.remote}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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}"/>
-         <jvmarg value="-Xmx512M"/>
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <batchtest fork="${junit.batchtest.fork}"
-                    todir="${junit.batchtest.todir}"
-                    haltonfailure="${junit.batchtest.haltonfailure}"
-                    haltonerror="${junit.batchtest.haltonerror}">
-            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/**/*Test.class"/>
-               <exclude name="**/messaging/graveyard/**/*Test.class"/>
-               <exclude name="**/messaging/jms/**"/>
-            </fileset>
-         </batchtest>
-      </junit>
-      <antcall target="stop-rmi-server"/>
-   </target>
-
-   <target name="test" depends="tests-jar, prepare-testdirs, clear-test-logs"
-           description="Runs a single test, specified by its FQ class name via 'test.classname'">
-
-      <fail unless="test.classname"
-            message="To run a single test, use: ./build.sh test -Dtest.classname=org.package.MyTest"/>
-      <echo>Module root is:${module.root}</echo>
-      <antcall target="start-rmi-server"/>
-      <property name="test.classname" value="dummy"/>
-
-      <junit printsummary="${junit.printsummary}"
-             fork="${junit.fork}"
-             includeantruntime="${junit.includeantruntime}"
-             haltonerror="${junit.haltonerror}"
-             haltonfailure="${junit.haltonfailure}"
-             showoutput="${junit.showoutput}"
-             timeout="${junit.timeout}">
-         <sysproperty key="remote" value="${build.tests.remote}"/>
-         <sysproperty key="module.output" value="${tests.output}"/>
-         <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}"/>
-         <!--
-            <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y"/>
-         -->
-         <jvmarg value="-Xmx1024M"/>
-         <classpath refid="test.execution.classpath"/>
-         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
-         <test name="${test.classname}"
-               fork="false"
-               todir="${junit.batchtest.todir}"
-               haltonfailure="${junit.test.haltonfailure}"
-               haltonerror="${junit.test.haltonerror}">
-         </test>
-      </junit>
-      <antcall target="stop-rmi-server"/>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Report Tasks                                                                             -->
-   <!-- ======================================================================================== -->
-
-   <target name="copy-stylesheets">
-      <mkdir dir="${build.tests.stylesheets}"/>
-      <copy todir="${build.tests.stylesheets}" filtering="yes">
-         <fileset dir="${source.tests.stylesheets}">
-            <include name="**/*"/>
-         </fileset>
-      </copy>
-   </target>
-
-   <target name="compile-report" depends="copy-stylesheets">
-      <mkdir dir="${build.tests.reports}/html"/>
-      <junitreport todir="${build.tests.reports}">
-         <fileset dir="${build.tests.reports}">
-            <include name="TEST-*.xml"/>
-         </fileset>
-         <report format="frames"
-                 todir="${build.tests.reports}/html"
-                 styledir="${build.tests.stylesheets}"/>
-      </junitreport>
-   </target>
-
-   <target name="report" depends="tests, copy-stylesheets, compile-report"/>
-
-   <target name="remote-tests-report" depends="remote-tests, copy-stylesheets, compile-report"/>
-
-   <target name="jmsreport" depends="jmstests, copy-stylesheets, compile-report"/>
-
-   <target name="messagereport" depends="messagetests, copy-stylesheets, compile-report"/>
-
-   <target name="corereport" depends="coretests, copy-stylesheets, compile-report"/>
-
-   <target name="stressreport" depends="stress-tests, copy-stylesheets, compile-report"/>
-
-   <target name="functional-tests" depends="tests"/>
-
-   <!-- ======================================================================================== -->
-   <!-- Cleaning Tasks                                                                           -->
-   <!-- ======================================================================================== -->
-
-   <target name="clean">
-      <delete dir="${tests.output}"/>
-      <delete quiet="true">
-         <fileset dir="./bin">
-            <include name=".*.classpath"/>
-         </fileset>
-      </delete>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Tasks required by bin/runtest                                                            -->
-   <!-- ======================================================================================== -->
-
-   <property name="test.execution.classpath.file" value=".test.execution.classpath"/>
-
-   <target name="get-test-execution-classpath" depends="init">
-      <pathconvert refid="test.execution.classpath"
-                   property="test.execution.classpath.unix"/>
-      <echo message="${test.execution.classpath.unix}" file="${test.execution.classpath.file}"/>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Miscellaneous                                                                            -->
-   <!-- ======================================================================================== -->
-
-   <target name="tests-ejb-jar"
-           depends="compile"
-           description="Creates the ejb jar file containing the test ejb and mdb for testing jms from within a managed environment">
-
-      <mkdir dir="${build.tests.lib}"/>
-      <mkdir dir="${build.tests.classes}/META-INF"/>
-      <copy file="${source.tests.java}/org/jboss/test/messaging/jms/managed/META-INF/jboss.xml"
-            tofile="${build.tests.classes}/META-INF/jboss.xml"/>
-      <copy file="${source.tests.java}/org/jboss/test/messaging/jms/managed/META-INF/ejb-jar.xml"
-            tofile="${build.tests.classes}/META-INF/ejb-jar.xml"/>
-      <!-- Build the tests ejb jar -->
-      <jar jarfile="${build.tests.lib}/${build.tests.ejbarchive}">
-         <fileset dir="${build.tests.classes}">
-            <include name="org/jboss/test/messaging/jms/managed/**"/>
-         </fileset>
-         <fileset dir="${build.tests.classes}">
-            <include name="META-INF/**"/>
-         </fileset>
-      </jar>
-   </target>
-
-   <target name="deployejb" depends="tests-ejb-jar">
-      <copy file="${build.tests.lib}/${build.tests.ejbarchive}"
-            todir="${ENV.JBOSS_HOME}/server/default/deploy"/>
-   </target>
-
-   <target name="undeployejb">
-      <delete file="${ENV.JBOSS_HOME}/server/default/deploy/${build.tests.ejbarchive}"/>
-   </target>
-
-</project>
-

Copied: tags/JBossMessaging_1_2_0_SP1/tests/build.xml (from rev 2560, branches/Branch_1_2_0_SP/tests/build.xml)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/build.xml	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/build.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,1399 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- $Id$ -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+<project default="tests" name="JBoss Messaging Tests">
+
+   <!--
+        'tests' is Messaging's subproject, we're relying on the main project thirdparty and lib
+        directories.
+   -->
+   <property name="project.root" value="${basedir}/.."/>
+
+   <!--
+        Import Messaging's properties, paths and everything else.
+   -->
+   <import file="../build-messaging.xml"/>
+
+   <!-- ======================================================================================== -->
+   <!-- Configuration                                                                            -->
+   <!-- ======================================================================================== -->
+
+   <property file="build.properties"/>
+
+   <property name="build.tests.remote" value="false"/>
+   <property name="test.bind.address" value="localhost"/>
+
+   <!--
+        Functional tests.
+   -->
+
+   <property name="functional.tests.database" value="mysql"/>
+   <property name="functional.tests.serialization" value="jms"/>
+
+   <!--
+        Stress tests.
+   -->
+
+   <property name="stress.tests.database" value="mysql"/>
+   <property name="stress.tests.serialization" value="jms"/>
+
+   <!-- Clustering tests -->
+   <property name="clustering.tests.database" value="mysql"/>
+   <property name ="test-mask" value="*Test"/>
+
+   <!--
+        Default remoting configuration (must be overrided by tasks that need it set otherwise).
+   -->
+   <property name="test.remoting" value="bisocket"/>
+
+
+   <!--
+       By default, remote servers log file names should end in remote-server
+   -->
+   <property name="remote.server.test.logfile.suffix" value="remote-server"/>
+
+
+   <!--
+        Project paths.
+   -->
+
+   <property name="tests.root" value="${basedir}"/>
+   <property name="source.tests.java" value="${tests.root}/src"/>
+   <property name="source.tests.stylesheets" value="${source.tests.java}/stylesheets"/>
+   <property name="tests.output" value="${tests.root}/output"/>
+   <property name="build.tests.classes" value="${tests.output}/classes"/>
+   <property name="build.tests.lib" value="${tests.output}/lib"/>
+   <property name="build.tests.reports" value="${tests.output}/reports"/>
+   <property name="build.tests.stylesheets" value="${tests.output}/stylesheets"/>
+   <property name="build.tests.archive" value="jboss-messaging-tests.jar"/>
+   <property name="build.tests.ejbarchive" value="jboss-messaging-tests-ejb.jar"/>
+   <property name="objectstore.dir" value="${tests.root}/bin/ObjectStore"/>
+
+   <!--
+        JUnit configuration (values specified in ./build.properties have priority)
+   -->
+
+   <property name="junit.printsummary" value="true"/>
+   <property name="junit.haltonerror" value="false"/>
+   <property name="junit.haltonfailure" value="false"/>
+   <property name="junit.fork" value="true"/>
+   <property name="junit.includeantruntime" value="true"/>
+   <property name="junit.timeout" value="4800000"/>
+   <property name="stress.timeout" value="4800000"/>
+
+   <property name="junit.showoutput" value="true"/>
+   <property name="junit.jvm" value=""/>
+   <property name="junit.jvm.options" value=""/>
+   <property name="junit.formatter.usefile" value="true"/>
+   <property name="junit.batchtest.todir" value="${build.tests.reports}"/>
+   <property name="junit.batchtest.haltonerror" value="false"/>
+   <property name="junit.batchtest.haltonfailure" value="false"/>
+   <property name="junit.batchtest.fork" value="true"/>
+   <property name="junit.test.haltonfailure" value="false"/>
+   <property name="junit.test.haltonerror" value="false"/>
+
+   <!--
+        Locally maintained dependencies.
+   -->
+
+   <path id="jboss.server.classpath">
+      <pathelement location="${jboss.server.lib}/jboss.jar"/>
+   </path>
+
+   <property name="jboss.jca.lib" value="${tests.root}/lib"/>
+   <path id="jboss.jca.classpath">
+      <pathelement path="${jboss.jca.lib}/jboss-jca.jar"/>
+      <pathelement path="${jboss.jca.lib}/jboss-local-jdbc.jar"/>
+      <pathelement path="${jboss.jca.lib}/jboss-common-jdbc-wrapper.jar"/>
+      <pathelement path="${jboss.jca.lib}/jms-ra.jar"/>
+   </path>
+
+   <property name="jboss.mbeans.lib" value="${tests.root}/lib"/>
+   <path id="jboss.mbeans.classpath">
+      <pathelement path="${jboss.mbeans.lib}/jboss-mbeans.jar"/>
+   </path>
+
+   <path id="jboss.naming.classpath">
+      <pathelement path="${jboss.naming.lib}/jnp-client.jar"/>
+   </path>
+
+   <!--
+       JDBC Drivers.
+   -->
+   <path id="any.jdbc.driver.classpath">
+          <fileset dir="${tests.root}/lib/jdbc-drivers" includes="*.jar"/>
+   </path>
+
+
+   <path id="mysql.jdbc.driver.classpath">
+      <pathelement path="${tests.root}/lib/mysql-connector-java-3.1.13-bin.jar"/>
+   </path>
+
+   <path id="oracle.jdbc.driver.classpath">
+      <pathelement path="${tests.root}/lib/ojdbc14.jar"/>
+   </path>
+
+   <path id="postgres.jdbc.driver.classpath">
+      <pathelement path="${tests.root}/postgresql-8.1-405.jdbc3.jar"/>
+   </path>
+
+   <!--
+        The compilation classpath.
+   -->
+
+   <path id="test.compilation.classpath">
+      <path refid="compilation.classpath"/>
+      <path location="../output/lib/jboss-messaging.jar"/>
+      <path refid="junit.junit.classpath"/>
+      <path refid="any.jdbc.driver.classpath"/>
+      <path refid="hsqldb.hsqldb.classpath"/>
+      <path refid="jboss.server.classpath"/> <!-- for org.jboss.jms.jndi.JNDIProviderAdapter -->
+      <path refid="jboss.jca.classpath"/>  <!-- for org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory, etc -->
+      <path refid="jboss.profiler.jvmti.classpath"/>
+      <path refid="jboss.test14.classpath"/>
+      <path refid="jboss.jbossretro.rt.classpath"/>
+   </path>
+
+   <!--
+        The execution classpath.
+   -->
+
+   <path id="test.execution.classpath">
+      <pathelement location="${tests.root}/etc"/>
+      <pathelement location="${build.tests.classes}"/>
+      <pathelement location="${project.root}/src/etc"/> <!-- server's configuration files -->
+      <pathelement location="${project.root}/src/etc/server/default/deploy"/>
+      <path refid="test.compilation.classpath"/>
+      <path refid="dom4j.dom4j.classpath"/>
+      <path refid="apache.log4j.classpath"/>
+      <path refid="apache.logging.classpath"/>
+      <path refid="apache.xerces.classpath"/>
+      <path refid="jboss.mbeans.classpath"/>
+      <path refid="jboss.naming.classpath"/>
+      <path refid="jboss.jbossxb.classpath"/>
+      <path refid="jgroups.jgroups.classpath"/>
+      <path refid="apache.logging.classpath"/>
+      <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">
+      <pathelement path="${tests.root}/etc/stress"/>
+      <path refid="test.execution.classpath"/>
+   </path>
+
+   <!-- ======================================================================================== -->
+   <!-- Compilation Tasks                                                                        -->
+   <!-- ======================================================================================== -->
+
+   <target name="init" depends="resolve-local-dependencies"/>
+
+   <target name="compile" depends="init">
+
+      <mkdir dir="${build.tests.classes}"/>
+      <javac destdir="${build.tests.classes}"
+             optimize="${javac.optimize}"
+             target="1.4"
+             source="1.4"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src path="${source.tests.java}"/>
+         <classpath refid="test.compilation.classpath"/>
+         <include name="**/*.java"/>
+      </javac>
+
+      <!--
+           RMI compilation to to create stub for server.
+      -->
+      <rmic base="${build.tests.classes}"
+            includes="**/RMITestServer.class,**/RMINamingDelegate.class">
+         <classpath refid="test.compilation.classpath"/>
+      </rmic>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Archival Tasks                                                                           -->
+   <!-- ======================================================================================== -->
+
+   <target name="tests-jar" depends="compile">
+
+      <mkdir dir="${build.tests.lib}"/>
+      <jar jarfile="${build.tests.lib}/${build.tests.archive}">
+         <fileset dir="${build.tests.classes}">
+            <include name="org/jboss/test/messaging/**"/>
+         </fileset>
+      </jar>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Execution Helper Tasks                                                                   -->
+   <!-- ======================================================================================== -->
+
+   <target name="prepare-testdirs">
+      <mkdir dir="${build.tests.reports}"/>
+      <mkdir dir="${tests.output}/logs"/>
+   </target>
+
+   <target name="clear-test-logs" unless="test.logs.cleared">
+
+      <!-- At the beginning of a test run, clean up the logs, since log4j runs in "append" mode -->
+      <echo message="Cleaning test logs ${tests.output}/logs/*.log"/>
+      <delete quiet="true">
+         <fileset dir="${tests.output}/logs" includes="*.log"/>
+      </delete>
+      <property name="test.logs.cleared" value="true"/>
+   </target>
+
+   <target name="start-rmi-server" depends="init"
+           description="Starts the RMI server used by remote tests">
+
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="${remote.server.test.logfile.suffix}"/>
+         <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}"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
+   <!-- Starts an all config already when starting the rmi server (used on crash tests) -->
+   <target name="start-rmi-server-with-allconfig" depends="init"
+           description="Starts an all config already when starting the rmi server (used on crash tests)">
+
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="${remote.server.test.logfile.suffix}"/>
+         <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}"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <arg value="-startAll"/>
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
+   <target name="start-rmi-server-clustering" depends="init"
+           description="Starts the RMI server used by clustering tests">
+
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
+         <sysproperty key="test.server.index" value="${test.server.index}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="clustering-server${test.server.index}"/>
+         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
+         <sysproperty key="test.database" value="${clustering.tests.database}"/>
+         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.clustered" value="true"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
+   <target name="start-rmi-server-stress" depends="init"
+           description="Starts the RMI server used by remote stress tests">
+
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
+         <jvmarg value="-Xmx768M"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="remote-server-stress"/>
+         <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}"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/> -->
+         <classpath refid="stress.test.execution.classpath"/>
+
+      </java>
+   </target>
+
+   <target name="stop-rmi-server" depends="init"
+           description="Stops the RMI server used by remote tests">
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.StopRMIServer"
+            classpathref="test.execution.classpath">
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="stop-rmi-server"/>
+     </java>
+   </target>
+
+   <target name="stop-rmi-server-clustering" depends="init"
+           description="Stops the RMI server used by clustering tests">
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.StopRMIServer"
+            classpathref="test.execution.classpath">
+         <sysproperty key="test.server.index" value="${test.server.index}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="stop-rmi-server-clustering"/>
+      </java>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Test Execution Tasks                                                                     -->
+   <!-- ======================================================================================== -->
+
+   <target name="tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
+      <antcall target="crash-tests"/>
+      <antcall target="invm-tests"/>
+      <!--
+           default remoting configuration (bisocket)
+      -->
+      <antcall target="remote-tests"/>
+      <antcall target="remote-tests">
+         <param name="test.remoting" value="http"/>
+      </antcall>
+      <antcall target="clustering-tests"/>
+
+   </target>
+
+   <target name="http-tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
+      <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"/> <!-- default remoting configuration (bisocket) -->
+
+
+      <!--
+          HTTP stress tests currently fail, so they have been commented out, since they fail.
+          To be fixed for 1.2.1.
+          http://jira.jboss.com/jira/browse/JBMESSAGING-857
+
+      <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"
+           description="Runs all available tests an in-VM configuration">
+
+      <echo message=""/>
+      <echo message="Running invm tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="false"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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.logfile.suffix" value="invm"/>
+         <sysproperty key="build.lib" value="${build.lib}"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/*Test.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="**/jms/crash/*Test.class"/>
+               <exclude name="**/*LeakTest.class"/>
+               <exclude name="**/jms/bridge/**/*Test.class"/>
+               <exclude name="**/jms/manual/**/*Test.class"/>
+               <exclude name="**/jms/LongRunningInvocationTest.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
+               <exclude name="**/jms/RemotingConnectionConfigurationTest.class"/>
+               <exclude name="**/thirdparty/remoting/ManualConnectionValidatorTest.class"/>
+               <exclude name="**/thirdparty/remoting/PureAsynchronousCallTest.class"/>
+               <exclude name="**/thirdparty/remoting/RemotingConnectionFailureTest.class"/>
+               <exclude name="**/thirdparty/remoting/CallbackServerTimeoutTest.class"/>
+               <exclude name="**/thirdparty/remoting/ClientInvokerTimeoutTest.class"/>
+               <exclude name="**/thirdparty/remoting/SocketTransportCausalityTest.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="local-jms-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs all available tests an in-VM configuration">
+
+      <echo message=""/>
+      <echo message="Running invm tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="false"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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.logfile.suffix" value="invm"/>
+         <sysproperty key="build.lib" value="${build.lib}"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/messaging/jms/**/*Test.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/jms/LongRunningInvocationTest.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="**/jms/crash/*Test.class"/>
+               <exclude name="**/*LeakTest.class"/>
+               <exclude name="**/jms/bridge/**/*Test.class"/>
+               <exclude name="**/jms/manual/**/*Test.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
+               <exclude name="**/jms/RemotingConnectionConfigurationTest.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="ref-test" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs all available tests an in-VM configuration">
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="false"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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="build.lib" value="${build.lib}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/messaging/jms/ReferenceableTest.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="**/jms/crash/*Test.class"/>
+               <exclude name="**/*LeakTest.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="invm-stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs all stress tests in an in-VM configuration">
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${stress.timeout}">
+
+         <sysproperty key="remote" value="false"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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.logfile.suffix" value="invm"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath refid="stress.test.execution.classpath"/>
+         <sysproperty key="jboss-junit-configuration" value="StressInVM"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-StressInVM.xml"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/jms/stress/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="remote-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs remotely all tests for which it makes sense to run remotely">
+
+      <antcall target="stop-rmi-server"/>
+      <antcall target="start-rmi-server"/>
+
+      <mkdir dir="${build.tests.reports}"/>
+
+      <echo message=""/>
+      <echo message="Running remote tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}, remoting=${test.remoting}"/>
+      <echo message=""/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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}"/>
+         <sysproperty key="test.logfile.suffix" value="remote-client"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
+         -->
+         <classpath>
+            <path refid="test.execution.classpath"/>
+         </classpath>
+
+         <sysproperty key="jboss-junit-configuration" value="Remote-${test.remoting}"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-Remote-${test.remoting}.xml"/>
+
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <!--
+                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
+                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
+                 batchtest formatter, and it will get notified on a endTestSuite() event.
+            -->
+           <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
+
+            <fileset dir="${build.tests.classes}">
+               <include name="**/jms/**/${test-mask}.class"/>
+               <include name="**/thirdparty/**/${test-mask}.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/jms/WireFormatTest.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="**/jms/server/**"/>
+               <exclude name="**/jms/persistence/**"/>
+               <exclude name="**/jms/ReferencingTest.class"/>
+               <exclude name="**/jms/PersistenceTest.class"/>
+               <exclude name="**/jms/crash/*Test.class"/>
+               <exclude name="**/*LeakTest.class"/>
+               <exclude name="**/jms/ManifestTest.class"/>
+               <exclude name="**/jms/JCAWrapperTest.class"/>
+               <exclude name="**/jms/manual/**/*Test.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
+               <exclude name="**/thirdparty/remoting/ServerAddressTest.class"/>
+               <exclude name="org/jboss/test/thirdparty/jbosssx/SecurityAssociationTest.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+      <antcall target="stop-rmi-server"/>
+
+   </target>
+
+   <target name="remote-stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs remotely all stress tests for which it makes sense to run remotely">
+
+      <antcall target="stop-rmi-server"/>
+      <antcall target="start-rmi-server-stress"/>
+      <mkdir dir="${build.tests.reports}"/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${stress.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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}"/>
+         <sysproperty key="test.logfile.suffix" value="remote-client"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!-- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=unittest"/> -->
+         <classpath>
+            <path refid="stress.test.execution.classpath"/>
+         </classpath>
+
+         <sysproperty key="jboss-junit-configuration" value="StressRemote-${test.remoting}"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-StressRemote-${test.remoting}.xml"/>
+
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/jms/stress/**/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+      <antcall target="stop-rmi-server"/>
+
+   </target>
+
+   <target name="clustering-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs the clustering tests">
+
+
+      <mkdir dir="${build.tests.reports}"/>
+
+      <echo message=""/>
+      <echo message="Running clustering tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+
+      <!--
+
+           By default, clustered tests are run in a "remote" configuration (the clustered
+           nodes physically live in different VMs. If you want to test a co-located clustered
+           configuration, use bin/runtest -clustered
+      -->
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
+         <sysproperty key="test.database" value="${clustering.tests.database}"/>
+         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.clustered" value="true"/>
+         <sysproperty key="test.logfile.suffix" value="clustering-client"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <jvmarg value="-Djava.net.preferIPv4Stack=true"/>
+         <!--
+         <jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
+          -->
+
+         <classpath>
+            <path refid="test.execution.classpath"/>
+         </classpath>
+
+         <sysproperty key="jboss-junit-configuration" value="Clustering"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-Clustering.xml"/>
+
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <!--
+                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
+                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
+                 batchtest formatter, and it will get notified on a endTestSuite() event.
+            -->
+            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
+
+            <fileset dir="${build.tests.classes}">
+               <include name="**/jms/clustering/${test-mask}.class"/>
+               <exclude name="**/*LeakTest.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="memory-leak-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs MemoryLeakTests, but it starts the clustering for leak-clustering-tests">
+
+
+      <mkdir dir="${build.tests.reports}"/>
+
+      <echo message=""/>
+      <echo message="Running clustering tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+
+      <!--
+
+           By default, clustered tests are run in a "remote" configuration (the clustered
+           nodes physically live in different VMs. If you want to test a co-located clustered
+           configuration, use bin/runtest -clustered
+      -->
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
+         <sysproperty key="test.database" value="${clustering.tests.database}"/>
+         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <sysproperty key="test.clustered" value="true"/>
+         <sysproperty key="test.logfile.suffix" value="clustering-client"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <jvmarg value="-Djava.net.preferIPv4Stack=true"/>
+         <jvmarg value="-agentlib:jbossAgent"/>
+         <!--
+         <jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=antjunit"/>
+          -->
+
+         <classpath>
+            <path refid="test.execution.classpath"/>
+         </classpath>
+
+         <sysproperty key="jboss-junit-configuration" value="Clustering"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-Clustering.xml"/>
+
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <!--
+                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
+                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
+                 batchtest formatter, and it will get notified on a endTestSuite() event.
+            -->
+            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
+
+            <fileset dir="${build.tests.classes}">
+               <include name="**/ClusterLeakTest.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+   </target>
+
+
+   <!-- Temporary crash debug -->
+   <target name="crash-tmp1" depends="tests-jar, prepare-testdirs, clear-test-logs">
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true">
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="tmp-server"/>
+         <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}"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <arg value="-startAll"/>
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
+   <!-- Temporary crash debug -->
+   <target name="crash-tmp2" depends="tests-jar, prepare-testdirs">
+
+      <java classname="org.jboss.test.messaging.jms.crash.simultaneousfailure.FailingClient" >
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="crash-client"/>
+         <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}"/>
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
+
+
+   <!-- Temporary crash debug -->
+   <target name="crash-tmp3" depends="tests-jar, prepare-testdirs">
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.simultaneousfailure.SimultaneousFailureTest"/>
+      </antcall>
+
+   </target>
+
+   <!-- This test is disabled until we can implement http://jira.jboss.org/jira/browse/JBMESSAGING-928 properly -->
+   <target name="simultaneous-crash" depends="tests-jar, prepare-testdirs, clear-test-logs">
+      <antcall target="stop-rmi-server"/>
+
+      <antcall target="start-rmi-server-with-allconfig">
+         <param name="remote.server.test.logfile.suffix" value="multiple-crash"/>
+      </antcall>
+
+      <sleep seconds="20"/>
+
+
+      <java classname="org.jboss.test.messaging.jms.crash.simultaneousfailure.FailingClient" fork="true" spawn="true">
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.logfile.suffix" value="crash-client"/>
+         <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}"/>
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="java.net.preferIPv4Stack" value="true"/>
+         <sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+      </java>
+
+      <antcall target="crash-test">
+         <param name="crash.test.name" value="org.jboss.test.messaging.jms.crash.simultaneousfailure.SimultaneousFailureTest"/>
+      </antcall>
+
+
+
+
+      <sleep seconds="120"/>
+
+      <antcall target="stop-rmi-server"/>
+   </target>
+
+   <target name="crash-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+      description="Runs crash tests">
+
+      <antcall target="stop-rmi-server"/>
+
+      <!--
+          ClientCrashTest over "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+      <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"/>
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </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 "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+
+      <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"/>
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </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 "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+
+      <antcall target="crash-test">
+         <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"/>
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </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 "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+
+      <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"/>
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </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 "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+
+      <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"/>
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </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 "bisocket"
+      -->
+
+      <antcall target="start-rmi-server">
+         <param name="remote.server.test.logfile.suffix" value="remote-crash"/>
+      </antcall>
+
+
+      <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>
+
+
+   <target name="crash-test" depends="init" description="Runs crash test">
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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}"/>
+         <sysproperty key="test.logfile.suffix" value="crash"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath>
+            <path refid="test.execution.classpath"/>
+         </classpath>
+
+         <sysproperty key="jboss-junit-configuration" value="Crash-${test.remoting}"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-Crash-${test.remoting}.xml"/>
+
+         <test name="${crash.test.name}"
+               fork="true"
+               todir="${junit.batchtest.todir}"
+               haltonfailure="${junit.test.haltonfailure}"
+               haltonerror="${junit.test.haltonerror}">
+         </test>
+
+      </junit>
+
+   </target>
+
+
+   <target name="jmstests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs the jms tests only">
+
+      <antcall target="start-rmi-server"/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+         <sysproperty key="remote" value="${build.tests.remote}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/messaging/jms/**/*Test.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="org/jboss/test/messaging/jms/ManifestTest.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+      <antcall target="stop-rmi-server"/>
+
+   </target>
+
+   <target name="messagetests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs the jms tests only">
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+         <sysproperty key="remote" value="${build.tests.remote}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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="objectstore.dir" value="${objectstore.dir}"/>
+         <jvmarg value="-Xmx512M"/>
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/messaging/jms/message/**/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+      <antcall target="stop-rmi-server"/>
+
+   </target>
+
+   <target name="coretests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs the jms tests only">
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+         <sysproperty key="remote" value="${build.tests.remote}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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}"/>
+         <jvmarg value="-Xmx512M"/>
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/messaging/**/*Test.class"/>
+               <exclude name="**/messaging/graveyard/**/*Test.class"/>
+               <exclude name="**/messaging/jms/**"/>
+            </fileset>
+         </batchtest>
+      </junit>
+      <antcall target="stop-rmi-server"/>
+   </target>
+
+   <target name="test" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs a single test, specified by its FQ class name via 'test.classname'">
+
+      <fail unless="test.classname"
+            message="To run a single test, use: ./build.sh test -Dtest.classname=org.package.MyTest"/>
+      <echo>Module root is:${module.root}</echo>
+      <antcall target="start-rmi-server"/>
+      <property name="test.classname" value="dummy"/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+         <sysproperty key="remote" value="${build.tests.remote}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <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}"/>
+         <!--
+            <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y"/>
+         -->
+         <jvmarg value="-Xmx1024M"/>
+         <classpath refid="test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <test name="${test.classname}"
+               fork="false"
+               todir="${junit.batchtest.todir}"
+               haltonfailure="${junit.test.haltonfailure}"
+               haltonerror="${junit.test.haltonerror}">
+         </test>
+      </junit>
+      <antcall target="stop-rmi-server"/>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Report Tasks                                                                             -->
+   <!-- ======================================================================================== -->
+
+   <target name="copy-stylesheets">
+      <mkdir dir="${build.tests.stylesheets}"/>
+      <copy todir="${build.tests.stylesheets}" filtering="yes">
+         <fileset dir="${source.tests.stylesheets}">
+            <include name="**/*"/>
+         </fileset>
+      </copy>
+   </target>
+
+   <target name="compile-report" depends="copy-stylesheets">
+      <mkdir dir="${build.tests.reports}/html"/>
+      <junitreport todir="${build.tests.reports}">
+         <fileset dir="${build.tests.reports}">
+            <include name="TEST-*.xml"/>
+         </fileset>
+         <report format="frames"
+                 todir="${build.tests.reports}/html"
+                 styledir="${build.tests.stylesheets}"/>
+      </junitreport>
+   </target>
+
+   <target name="report" depends="tests, copy-stylesheets, compile-report"/>
+
+   <target name="remote-tests-report" depends="remote-tests, copy-stylesheets, compile-report"/>
+
+   <target name="jmsreport" depends="jmstests, copy-stylesheets, compile-report"/>
+
+   <target name="messagereport" depends="messagetests, copy-stylesheets, compile-report"/>
+
+   <target name="corereport" depends="coretests, copy-stylesheets, compile-report"/>
+
+   <target name="stressreport" depends="stress-tests, copy-stylesheets, compile-report"/>
+
+   <target name="functional-tests" depends="tests"/>
+
+   <!-- ======================================================================================== -->
+   <!-- Cleaning Tasks                                                                           -->
+   <!-- ======================================================================================== -->
+
+   <target name="clean">
+      <delete dir="${tests.output}"/>
+      <delete quiet="true">
+         <fileset dir="./bin">
+            <include name=".*.classpath"/>
+         </fileset>
+      </delete>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Tasks required by bin/runtest                                                            -->
+   <!-- ======================================================================================== -->
+
+   <property name="test.execution.classpath.file" value=".test.execution.classpath"/>
+
+   <target name="get-test-execution-classpath" depends="init">
+      <pathconvert refid="test.execution.classpath"
+                   property="test.execution.classpath.unix"/>
+      <echo message="${test.execution.classpath.unix}" file="${test.execution.classpath.file}"/>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Miscellaneous                                                                            -->
+   <!-- ======================================================================================== -->
+
+   <target name="tests-ejb-jar"
+           depends="compile"
+           description="Creates the ejb jar file containing the test ejb and mdb for testing jms from within a managed environment">
+
+      <mkdir dir="${build.tests.lib}"/>
+      <mkdir dir="${build.tests.classes}/META-INF"/>
+      <copy file="${source.tests.java}/org/jboss/test/messaging/jms/managed/META-INF/jboss.xml"
+            tofile="${build.tests.classes}/META-INF/jboss.xml"/>
+      <copy file="${source.tests.java}/org/jboss/test/messaging/jms/managed/META-INF/ejb-jar.xml"
+            tofile="${build.tests.classes}/META-INF/ejb-jar.xml"/>
+      <!-- Build the tests ejb jar -->
+      <jar jarfile="${build.tests.lib}/${build.tests.ejbarchive}">
+         <fileset dir="${build.tests.classes}">
+            <include name="org/jboss/test/messaging/jms/managed/**"/>
+         </fileset>
+         <fileset dir="${build.tests.classes}">
+            <include name="META-INF/**"/>
+         </fileset>
+      </jar>
+   </target>
+
+   <target name="deployejb" depends="tests-ejb-jar">
+      <copy file="${build.tests.lib}/${build.tests.ejbarchive}"
+            todir="${ENV.JBOSS_HOME}/server/default/deploy"/>
+   </target>
+
+   <target name="undeployejb">
+      <delete file="${ENV.JBOSS_HOME}/server/default/deploy/${build.tests.ejbarchive}"/>
+   </target>
+
+</project>
+

Deleted: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java
===================================================================
--- branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/JMSTest.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,420 +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 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.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-import EDU.oswego.cs.dl.util.concurrent.Slot;
-
-/**
- * The most comprehensive, yet simple, unit test.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JMSTest extends MessagingTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   InitialContext ic;
-
-   // Constructors --------------------------------------------------
-
-   public JMSTest(String name)
-   {
-      super(name);
-   }
-
-   // Public --------------------------------------------------------
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-
-      ServerManagement.start("all");
-
-      ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-
-      ServerManagement.deployQueue("JMSTestQueue");
-
-      log.debug("setup done");
-   }
-
-   public void tearDown() throws Exception
-   {
-      ServerManagement.undeployQueue("JMSTestQueue");
-
-      ic.close();
-
-      super.tearDown();
-   }
-   
-   public void testNoop() throws Exception
-   {
-      log.info("noop");
-   }
-
-   public void test_NonPersistent_NonTransactional() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
-      TextMessage m = session.createTextMessage("message one");
-
-      prod.send(m);
-
-      conn.close();
-
-      conn = cf.createConnection();
-
-      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage rm = (TextMessage)cons.receive();
-
-      assertEquals("message one", rm.getText());
-
-      conn.close();
-   }
-
-   public void test_Persistent_NonTransactional() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-
-      TextMessage m = session.createTextMessage("message one");
-
-      prod.send(m);
-
-      conn.close();
-
-      conn = cf.createConnection();
-
-      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage rm = (TextMessage)cons.receive();
-
-      assertEquals("message one", rm.getText());
-
-      conn.close();
-   }
-
-   public void test_NonPersistent_Transactional_Send() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
-      TextMessage m = session.createTextMessage("message one");
-      prod.send(m);
-      m = session.createTextMessage("message two");
-      prod.send(m);
-
-      session.commit();
-
-      conn.close();
-
-      conn = cf.createConnection();
-
-      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage rm = (TextMessage)cons.receive();
-      assertEquals("message one", rm.getText());
-      rm = (TextMessage)cons.receive();
-      assertEquals("message two", rm.getText());
-
-      conn.close();
-   }
-
-   public void test_Persistent_Transactional_Send() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-
-      TextMessage m = session.createTextMessage("message one");
-      prod.send(m);
-      m = session.createTextMessage("message two");
-      prod.send(m);
-
-      session.commit();
-
-      conn.close();
-
-      conn = cf.createConnection();
-
-      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage rm = (TextMessage)cons.receive();
-      assertEquals("message one", rm.getText());
-      rm = (TextMessage)cons.receive();
-      assertEquals("message two", rm.getText());
-
-      conn.close();
-   }
-
-
-   public void test_NonPersistent_Transactional_Acknowledgment() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-      TextMessage m = session.createTextMessage("one");
-      prod.send(m);
-
-      conn.close();
-
-      conn = cf.createConnection();
-
-      session = conn.createSession(true, Session.SESSION_TRANSACTED);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage rm = (TextMessage)cons.receive();
-      assertEquals("one", rm.getText());
-
-      session.commit();
-
-      conn.close();
-   }
-
-   public void test_Asynchronous_to_Client() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      final MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      final Slot slot = new Slot();
-
-      new Thread(new Runnable()
-      {
-         public void run()
-         {
-            try
-            {
-               Message m = cons.receive(5000);
-               if (m != null)
-               {
-                  slot.put(m);
-               }
-            }
-            catch(Exception e)
-            {
-               log.error("receive failed", e);
-            }
-
-         }
-      }, "Receiving Thread").start();
-
-
-      Thread.sleep(500);
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
-      TextMessage m = session.createTextMessage("message one");
-
-      prod.send(m);
-
-      TextMessage rm = (TextMessage)slot.poll(5000);
-
-      assertEquals("message one", rm.getText());
-
-      conn.close();
-   }
-
-   public void test_MessageListener() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      final Slot slot = new Slot();
-
-      cons.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message m)
-         {
-            try
-            {
-               slot.put(m);
-            }
-            catch(InterruptedException e)
-            {
-               log.warn("got InterruptedException", e);
-            }
-         }
-      });
-
-      conn.start();
-
-      MessageProducer prod = session.createProducer(queue);
-      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-      TextMessage m = session.createTextMessage("one");
-      prod.send(m);
-
-      TextMessage rm = (TextMessage)slot.poll(5000);
-
-      assertEquals("one", rm.getText());
-
-      conn.close();
-   }
-
-   public void test_ClientAcknowledge() throws Exception
-   {
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
-
-      Connection conn = cf.createConnection();
-
-      Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-      MessageProducer p = session.createProducer(queue);
-      p.send(session.createTextMessage("CLACK"));
-
-      MessageConsumer cons = session.createConsumer(queue);
-
-      conn.start();
-
-      TextMessage m = (TextMessage)cons.receive(1000);
-
-      assertEquals("CLACK", m.getText());
-
-      // make sure there's no other message in queue
-      Message m2 = cons.receive(1000);
-      assertNull(m2);
-
-      // make sure the message is still in "delivering" state
-      ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=JMSTestQueue");
-      Integer mc = (Integer)ServerManagement.getAttribute(on, "MessageCount");
-
-      assertEquals(1, mc.intValue());
-
-      m.acknowledge();
-
-      // make sure there's nothing in queue anymore
-      mc = (Integer)ServerManagement.getAttribute(on, "MessageCount");
-
-      assertEquals(0, mc.intValue());
-
-      conn.close();
-   }
-
-
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java (from rev 2559, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/JMSTest.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/JMSTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,456 @@
+/*
+  * 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 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.management.ObjectName;
+import javax.naming.InitialContext;
+
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import EDU.oswego.cs.dl.util.concurrent.Slot;
+
+/**
+ * The most comprehensive, yet simple, unit test.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JMSTest extends MessagingTestCase
+{
+   // Constants -----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   InitialContext ic;
+
+   // Constructors --------------------------------------------------
+
+   public JMSTest(String name)
+   {
+      super(name);
+   }
+
+   // Public --------------------------------------------------------
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+
+      ServerManagement.start("all");
+
+      ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+
+      ServerManagement.deployQueue("JMSTestQueue");
+
+      log.debug("setup done");
+   }
+
+   public void tearDown() throws Exception
+   {
+      ServerManagement.undeployQueue("JMSTestQueue");
+
+      ic.close();
+
+      super.tearDown();
+   }
+   
+   public void testNoop() throws Exception
+   {
+      log.info("noop");
+   }
+
+   public void test_NonPersistent_NonTransactional() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+      TextMessage m = session.createTextMessage("message one");
+
+      prod.send(m);
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+
+      assertEquals("message one", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_CreateTextMessageNull() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+      TextMessage m = session.createTextMessage();
+
+      m.setText("message one");
+
+      prod.send(m);
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+
+      assertEquals("message one", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_Persistent_NonTransactional() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+      TextMessage m = session.createTextMessage("message one");
+
+      prod.send(m);
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+
+      assertEquals("message one", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_NonPersistent_Transactional_Send() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+      TextMessage m = session.createTextMessage("message one");
+      prod.send(m);
+      m = session.createTextMessage("message two");
+      prod.send(m);
+
+      session.commit();
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+      assertEquals("message one", rm.getText());
+      rm = (TextMessage)cons.receive();
+      assertEquals("message two", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_Persistent_Transactional_Send() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+      TextMessage m = session.createTextMessage("message one");
+      prod.send(m);
+      m = session.createTextMessage("message two");
+      prod.send(m);
+
+      session.commit();
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+      assertEquals("message one", rm.getText());
+      rm = (TextMessage)cons.receive();
+      assertEquals("message two", rm.getText());
+
+      conn.close();
+   }
+
+
+   public void test_NonPersistent_Transactional_Acknowledgment() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+      TextMessage m = session.createTextMessage("one");
+      prod.send(m);
+
+      conn.close();
+
+      conn = cf.createConnection();
+
+      session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage rm = (TextMessage)cons.receive();
+      assertEquals("one", rm.getText());
+
+      session.commit();
+
+      conn.close();
+   }
+
+   public void test_Asynchronous_to_Client() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      final MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      final Slot slot = new Slot();
+
+      new Thread(new Runnable()
+      {
+         public void run()
+         {
+            try
+            {
+               Message m = cons.receive(5000);
+               if (m != null)
+               {
+                  slot.put(m);
+               }
+            }
+            catch(Exception e)
+            {
+               log.error("receive failed", e);
+            }
+
+         }
+      }, "Receiving Thread").start();
+
+
+      Thread.sleep(500);
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+      TextMessage m = session.createTextMessage("message one");
+
+      prod.send(m);
+
+      TextMessage rm = (TextMessage)slot.poll(5000);
+
+      assertEquals("message one", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_MessageListener() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      final Slot slot = new Slot();
+
+      cons.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message m)
+         {
+            try
+            {
+               slot.put(m);
+            }
+            catch(InterruptedException e)
+            {
+               log.warn("got InterruptedException", e);
+            }
+         }
+      });
+
+      conn.start();
+
+      MessageProducer prod = session.createProducer(queue);
+      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+      TextMessage m = session.createTextMessage("one");
+      prod.send(m);
+
+      TextMessage rm = (TextMessage)slot.poll(5000);
+
+      assertEquals("one", rm.getText());
+
+      conn.close();
+   }
+
+   public void test_ClientAcknowledge() throws Exception
+   {
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      Queue queue = (Queue)ic.lookup("/queue/JMSTestQueue");
+
+      Connection conn = cf.createConnection();
+
+      Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+      MessageProducer p = session.createProducer(queue);
+      p.send(session.createTextMessage("CLACK"));
+
+      MessageConsumer cons = session.createConsumer(queue);
+
+      conn.start();
+
+      TextMessage m = (TextMessage)cons.receive(1000);
+
+      assertEquals("CLACK", m.getText());
+
+      // make sure there's no other message in queue
+      Message m2 = cons.receive(1000);
+      assertNull(m2);
+
+      // make sure the message is still in "delivering" state
+      ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=JMSTestQueue");
+      Integer mc = (Integer)ServerManagement.getAttribute(on, "MessageCount");
+
+      assertEquals(1, mc.intValue());
+
+      m.acknowledge();
+
+      // make sure there's nothing in queue anymore
+      mc = (Integer)ServerManagement.getAttribute(on, "MessageCount");
+
+      assertEquals(0, mc.intValue());
+
+      conn.close();
+   }
+
+
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
===================================================================
--- branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,225 +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 java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.Map;
-
-import javax.jms.ConnectionFactory;
-import javax.naming.InitialContext;
-
-import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.delegate.ClientConnectionDelegate;
-import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.callback.CallbackPoller;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.jmx.ServiceContainer;
-
-/**
- *  
- * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
- *
- * $Id$
- */
-public class RemotingConnectionConfigurationTest extends MessagingTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   protected ConnectionFactory cf;
-
-   // Constructors --------------------------------------------------
-
-   public RemotingConnectionConfigurationTest(String name)
-   {
-      super(name);
-   }
-
-   // TestCase overrides -------------------------------------------
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-      ServerManagement.start("all");
-      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-      cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      log.debug("setup done");
-   }
-
-   public void tearDown() throws Exception
-   {
-      super.tearDown();
-   }
-
-
-   // Public --------------------------------------------------------
-
-   /**
-    * It only makes sense to run remote. Exclude it from "invm-tests" target configuration.
-    */
-   public void testDefaultHTTPCallbackPollPeriod() throws Exception
-   {
-      if (!ServerManagement.isRemote())
-      {
-         return;
-      }
-
-      JBossConnection connection = null;
-
-      try
-      {
-         connection = (JBossConnection)cf.createConnection();
-         connection.start();
-
-         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
-         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
-         Client client = remotingConnection.getRemotingClient();
-
-         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
-         field.setAccessible(true);
-         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
-         String transport = locator.getProtocol();
-
-         if (!"http".equals(transport))
-         {
-            // not interesting
-            return;
-         }
-
-         field = Client.class.getDeclaredField("callbackPollers");
-         field.setAccessible(true);
-         Map callbackPollers = (Map)field.get(client);
-         assertEquals(1, callbackPollers.size());
-
-         CallbackPoller callbackPoller = (CallbackPoller)callbackPollers.values().iterator().next();
-
-         field = CallbackPoller.class.getDeclaredField("pollPeriod");
-         field.setAccessible(true);
-         Long pollPeriod = (Long)field.get(callbackPoller);
-         assertEquals(ServiceContainer.HTTP_CONNECTOR_CALLBACK_POLL_PERIOD, pollPeriod.longValue());
-      }
-      finally
-      {
-         if (connection != null)
-         {
-            connection.close();
-         }
-      }
-   }
-
-
-   /**
-    * It only makes sense to run remote. Exclude it from "invm-tests" target configuration.
-    */
-   public void testConnectionConfiguration() throws Exception
-   {
-      if (!ServerManagement.isRemote())
-      {
-         return;
-      }
-
-      JBossConnection connection = null;
-
-      try
-      {
-         String address = InetAddress.getLocalHost().getHostAddress();
-         System.setProperty("jboss.messaging.callback.bind.address", address);
-         
-         int freePort = PortUtil.findFreePort(InetAddress.getLocalHost().getHostName());
-         System.setProperty("jboss.messaging.callback.bind.port", Integer.toString(freePort));
-
-         String pollPeriod = "654";
-         System.setProperty("jboss.messaging.callback.pollPeriod", pollPeriod);
-
-         System.setProperty("jboss.messaging.callback.reportPollingStatistics", "true");
-         
-         connection = (JBossConnection)cf.createConnection();
-         connection.start();
-
-         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
-         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
-         Client client = remotingConnection.getRemotingClient();
-
-         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
-         field.setAccessible(true);
-         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
-         String transport = locator.getProtocol();
-
-         if ("socket".equals(transport)
-               || "sslsocket".equals(transport)
-               || "bisocket".equals(transport)
-               || "sslbisocket".equals(transport))
-         {
-            field = Client.class.getDeclaredField("callbackConnectors");
-            field.setAccessible(true);
-            Map callbackConnectors = (Map)field.get(client);
-
-            InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
-            Connector connector = (Connector)callbackConnectors.get(callbackHandler);
-            locator = new InvokerLocator(connector.getInvokerLocator());
-            assertEquals(address, locator.getHost());
-            assertEquals(freePort, locator.getPort());
-         }
-         else if ("http".equals(transport))
-         {
-            field = Client.class.getDeclaredField("callbackPollers");
-            field.setAccessible(true);
-            Map callbackPollers = (Map)field.get(client);
-            assertEquals(1, callbackPollers.size());
-
-            CallbackPoller callbackPoller =
-               (CallbackPoller)callbackPollers.values().iterator().next();
-
-            field = CallbackPoller.class.getDeclaredField("pollPeriod");
-            field.setAccessible(true);
-
-            assertEquals(pollPeriod, ((Long)field.get(callbackPoller)).toString());
-            
-            field = CallbackPoller.class.getDeclaredField("reportStatistics");
-            field.setAccessible(true);
-            assertEquals(true, ((Boolean) field.get(callbackPoller)).booleanValue());
-         }
-         else
-         {
-            fail("Unrecognized transport: " + transport);
-         }
-      }
-      finally
-      {
-         if (connection != null)
-         {
-            connection.close();
-         }
-      }
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java (from rev 2558, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,227 @@
+/*
+  * 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 java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.Map;
+import java.util.HashSet;
+
+import javax.jms.ConnectionFactory;
+import javax.naming.InitialContext;
+
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
+import org.jboss.jms.client.remoting.JMSRemotingConnection;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.callback.CallbackPoller;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.jmx.ServiceContainer;
+
+/**
+ *  
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * $Id$
+ */
+public class RemotingConnectionConfigurationTest extends MessagingTestCase
+{
+   // Constants -----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   protected ConnectionFactory cf;
+
+   // Constructors --------------------------------------------------
+
+   public RemotingConnectionConfigurationTest(String name)
+   {
+      super(name);
+   }
+
+   // TestCase overrides -------------------------------------------
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      ServerManagement.start("all");
+      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+      cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      log.debug("setup done");
+   }
+
+   public void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+
+
+   // Public --------------------------------------------------------
+
+   /**
+    * It only makes sense to run remote. Exclude it from "invm-tests" target configuration.
+    */
+   public void testDefaultHTTPCallbackPollPeriod() throws Exception
+   {
+      if (!ServerManagement.isRemote())
+      {
+         return;
+      }
+
+      JBossConnection connection = null;
+
+      try
+      {
+         connection = (JBossConnection)cf.createConnection();
+         connection.start();
+
+         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
+         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
+         Client client = remotingConnection.getRemotingClient();
+
+         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
+         field.setAccessible(true);
+         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
+         String transport = locator.getProtocol();
+
+         if (!"http".equals(transport))
+         {
+            // not interesting
+            return;
+         }
+
+         field = Client.class.getDeclaredField("callbackPollers");
+         field.setAccessible(true);
+         Map callbackPollers = (Map)field.get(client);
+         assertEquals(1, callbackPollers.size());
+
+         CallbackPoller callbackPoller = (CallbackPoller)callbackPollers.values().iterator().next();
+
+         field = CallbackPoller.class.getDeclaredField("pollPeriod");
+         field.setAccessible(true);
+         Long pollPeriod = (Long)field.get(callbackPoller);
+         assertEquals(ServiceContainer.HTTP_CONNECTOR_CALLBACK_POLL_PERIOD, pollPeriod.longValue());
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
+
+   /**
+    * It only makes sense to run remote. Exclude it from "invm-tests" target configuration.
+    */
+   public void testConnectionConfiguration() throws Exception
+   {
+      if (!ServerManagement.isRemote())
+      {
+         return;
+      }
+
+      JBossConnection connection = null;
+
+      try
+      {
+         String address = InetAddress.getLocalHost().getHostAddress();
+         System.setProperty("jboss.messaging.callback.bind.address", address);
+         
+         int freePort = PortUtil.findFreePort(InetAddress.getLocalHost().getHostName());
+         System.setProperty("jboss.messaging.callback.bind.port", Integer.toString(freePort));
+
+         String pollPeriod = "654";
+         System.setProperty("jboss.messaging.callback.pollPeriod", pollPeriod);
+
+         System.setProperty("jboss.messaging.callback.reportPollingStatistics", "true");
+         
+         connection = (JBossConnection)cf.createConnection();
+         connection.start();
+
+         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
+         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
+         Client client = remotingConnection.getRemotingClient();
+
+         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
+         field.setAccessible(true);
+         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
+         String transport = locator.getProtocol();
+
+         if ("socket".equals(transport)
+               || "sslsocket".equals(transport)
+               || "bisocket".equals(transport)
+               || "sslbisocket".equals(transport))
+         {
+            field = Client.class.getDeclaredField("callbackConnectors");
+            field.setAccessible(true);
+            Map callbackConnectors = (Map)field.get(client);
+
+            InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
+            HashSet map = (HashSet) callbackConnectors.get(callbackHandler);
+            Connector connector = (Connector)map.iterator().next();
+            locator = new InvokerLocator(connector.getInvokerLocator());
+            assertEquals(address, locator.getHost());
+            assertEquals(freePort, locator.getPort());
+         }
+         else if ("http".equals(transport))
+         {
+            field = Client.class.getDeclaredField("callbackPollers");
+            field.setAccessible(true);
+            Map callbackPollers = (Map)field.get(client);
+            assertEquals(1, callbackPollers.size());
+
+            CallbackPoller callbackPoller =
+               (CallbackPoller)callbackPollers.values().iterator().next();
+
+            field = CallbackPoller.class.getDeclaredField("pollPeriod");
+            field.setAccessible(true);
+
+            assertEquals(pollPeriod, ((Long)field.get(callbackPoller)).toString());
+            
+            field = CallbackPoller.class.getDeclaredField("reportStatistics");
+            field.setAccessible(true);
+            assertEquals(true, ((Boolean) field.get(callbackPoller)).booleanValue());
+         }
+         else
+         {
+            fail("Unrecognized transport: " + transport);
+         }
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/crash/simultaneousfailure (from rev 2560, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/crash/simultaneousfailure)

Deleted: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
===================================================================
--- branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,85 +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.message;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-
-import org.jboss.test.messaging.jms.message.base.MessageTestBase;
-
-/**
- * A test that sends/receives object messages to the JMS provider and verifies their integrity.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ObjectMessageTest extends MessageTestBase
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-   
-   // Attributes ----------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   public ObjectMessageTest(String name)
-   {
-      super(name);
-   }
-
-   // Public --------------------------------------------------------
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-      message = session.createObjectMessage();
-   }
-
-   public void tearDown() throws Exception
-   {
-      message = null;
-      super.tearDown();
-   }
-
-   // Protected -----------------------------------------------------
-
-   protected void prepareMessage(Message m) throws JMSException
-   {
-      super.prepareMessage(m);
-
-      ObjectMessage om = (ObjectMessage)m;
-      om.setObject("this is the serializable object");
-
-   }
-
-   protected void assertEquivalent(Message m, int mode) throws JMSException
-   {
-      super.assertEquivalent(m, mode);
-
-      ObjectMessage om = (ObjectMessage)m;
-      assertEquals("this is the serializable object", om.getObject());
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java (from rev 2554, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,169 @@
+/*
+  * 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.message;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.DeliveryMode;
+
+import org.jboss.test.messaging.jms.message.base.MessageTestBase;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/**
+ * A test that sends/receives object messages to the JMS provider and verifies their integrity.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ObjectMessageTest extends MessageTestBase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+   
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ObjectMessageTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      message = session.createObjectMessage();
+   }
+
+   public void tearDown() throws Exception
+   {
+      message = null;
+      super.tearDown();
+   }
+
+
+   public void testClassLoaderIsolation() throws Exception
+   {
+
+      ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         queueProd.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+         ObjectMessage om = (ObjectMessage) message;
+
+         SomeObject testObject = new SomeObject(3, 7);
+
+         ClassLoader testClassLoader = newClassLoader(testObject.getClass());
+
+         om.setObject(testObject);
+
+         queueProd.send(message);
+
+         Thread.currentThread().setContextClassLoader(testClassLoader);
+
+         ObjectMessage r = (ObjectMessage) queueCons.receive();
+
+         Object testObject2 = r.getObject();
+
+         assertEquals("org.jboss.test.messaging.jms.message.SomeObject",
+            testObject2.getClass().getName());
+         assertNotSame(testObject, testObject2);
+         assertNotSame(testObject.getClass(), testObject2.getClass());
+         assertNotSame(testObject.getClass().getClassLoader(),
+            testObject2.getClass().getClassLoader());
+         assertSame(testClassLoader,
+            testObject2.getClass().getClassLoader());
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(originalClassLoader);
+      }
+
+   }
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void prepareMessage(Message m) throws JMSException
+   {
+      super.prepareMessage(m);
+
+      ObjectMessage om = (ObjectMessage)m;
+      om.setObject("this is the serializable object");
+
+   }
+
+   protected void assertEquivalent(Message m, int mode) throws JMSException
+   {
+      super.assertEquivalent(m, mode);
+
+      ObjectMessage om = (ObjectMessage)m;
+      assertEquals("this is the serializable object", om.getObject());
+   }
+
+   protected static ClassLoader newClassLoader(Class anyUserClass) throws Exception
+   {
+      URL classLocation = anyUserClass.getProtectionDomain().getCodeSource().getLocation();
+      StringTokenizer tokenString = new StringTokenizer(System.getProperty("java.class.path"),
+         File.pathSeparator);
+      String pathIgnore = System.getProperty("java.home");
+      if (pathIgnore == null)
+      {
+         pathIgnore = classLocation.toString();
+      }
+
+      ArrayList urls = new ArrayList();
+      while (tokenString.hasMoreElements())
+      {
+         String value = tokenString.nextToken();
+         URL itemLocation = new File(value).toURL();
+         if (!itemLocation.equals(classLocation) &&
+                      itemLocation.toString().indexOf(pathIgnore) >= 0)
+         {
+            //System.out.println("Location:" + itemLocation);
+            urls.add(itemLocation);
+         }
+      }
+
+      URL[] urlArray = (URL[]) urls.toArray(new URL[urls.size()]);
+
+      ClassLoader masterClassLoader = URLClassLoader.newInstance(urlArray, null);
+
+
+      ClassLoader appClassLoader = URLClassLoader.newInstance(new URL[]{classLocation},
+                                      masterClassLoader);
+
+      return appClassLoader;
+   }
+
+}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/SomeObject.java (from rev 2552, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/jms/message/SomeObject.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/SomeObject.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/jms/message/SomeObject.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,85 @@
+/*
+   * 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.message;
+
+import java.io.Serializable;
+
+/**
+ * ObjectMessageTest needed a simple class to test ClassLoadingIsolations
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ *
+ *  $Id$
+ */
+public class SomeObject implements Serializable
+{
+
+   // Constants ------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   int i;
+   int j;
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public SomeObject(int i, int j)
+   {
+      this.i=i;
+      this.j=j;
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      SomeObject that = (SomeObject) o;
+
+      if (i != that.i) return false;
+      if (j != that.j) return false;
+
+      return true;
+   }
+
+   public int hashCode()
+   {
+      int result;
+      result = i;
+      result = 31 * result + j;
+      return result;
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Deleted: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,526 +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.tools.jmx.rmi;
-
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.Set;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import javax.management.ObjectName;
-import javax.management.NotificationListener;
-import javax.transaction.UserTransaction;
-
-import org.jboss.jms.jndi.JMSProviderAdapter;
-import org.jboss.jms.server.DestinationManager;
-import org.jboss.jms.server.ServerPeer;
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.plugin.contract.MessageStore;
-import org.jboss.messaging.core.plugin.contract.PersistenceManager;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
-
-/**
- * An RMI wrapper to access the ServiceContainer from a different address space.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
- * @version <tt>1.1</tt>
- *
- * RMITestServer.java,v 1.1 2006/02/21 08:25:33 timfox Exp
- */
-public class RMITestServer extends UnicastRemoteObject implements Server
-{
-   // Constants -----------------------------------------------------
-
-   public static final String RMI_SERVER_PREFIX = "messaging_rmi_server_";
-   public static final String NAMING_SERVER_PREFIX = "naming_rmi_server_";
-
-   public static final int DEFAULT_REGISTRY_PORT = 33777;
-   public static final int DEFAULT_SERVER_INDEX = 0;
-   public static final String DEFAULT_SERVER_HOST = "localhost";
-
-   private static final long serialVersionUID = -368445344011004778L;
-   private static final Logger log = Logger.getLogger(RMITestServer.class);
-
-   // Static --------------------------------------------------------
-
-   public static void main(String[] args) throws Exception
-   {
-      log.debug("initializing RMI runtime");
-
-      String host = System.getProperty("test.bind.address");
-
-      if (host == null)
-      {
-         host = DEFAULT_SERVER_HOST;
-      }
-
-      int serverIndex = DEFAULT_SERVER_INDEX;
-
-      String s = System.getProperty("test.server.index");
-
-      if (s != null)
-      {
-         serverIndex = Integer.parseInt(s);
-      }
-
-      log.info("RMI server " + serverIndex + ", bind address " + host);
-
-      RMITestServer testServer = new RMITestServer(serverIndex);
-      log.debug("RMI server " + serverIndex + " created");
-
-      // let RMI know the bind address
-      System.setProperty("java.rmi.server.hostname", host);
-
-      Registry registry;
-
-      // try to bind first
-      try
-      {
-         registry = LocateRegistry.getRegistry(DEFAULT_REGISTRY_PORT);
-         registry.bind(RMI_SERVER_PREFIX + serverIndex, testServer);
-         registry.bind(NAMING_SERVER_PREFIX + serverIndex, testServer.getNamingDelegate());
-
-      }
-      catch(Exception e)
-      {
-         log.info("Failure using an existing registry, trying creating it");
-
-         // try to create it
-         registry = LocateRegistry.createRegistry(DEFAULT_REGISTRY_PORT);
-
-         registry.bind(RMI_SERVER_PREFIX + serverIndex, testServer);
-         registry.bind(NAMING_SERVER_PREFIX + serverIndex, testServer.getNamingDelegate());
-      }
-
-      log.info("RMI server " + serverIndex + " bound");
-   }
-
-   // Attributes ----------------------------------------------------
-
-   protected RemoteTestServer server;
-   private RMINamingDelegate namingDelegate;
-   // Map<Long-ProxyNotificationListener>
-   private Map proxyListeners;
-
-   // Constructors --------------------------------------------------
-
-   public RMITestServer(int index) throws Exception
-   {
-      namingDelegate = new RMINamingDelegate(index);
-      server = new RemoteTestServer(index);
-      proxyListeners = new HashMap();
-   }
-
-   // Server implementation -----------------------------------------
-
-   public int getServerID()
-   {
-      return server.getServerID();
-   }
-
-   public void start(String containerConfig, boolean clearDatabase) throws Exception
-   {
-      start(containerConfig, null, clearDatabase, true);
-   }
-
-   public void start(String containerConfig, ServiceAttributeOverrides attrOverrides,
-                     boolean clearDatabase, boolean startMessagingServer) throws Exception
-   {
-      server.start(containerConfig, attrOverrides, clearDatabase, startMessagingServer);
-   }
-
-   public boolean stop() throws Exception
-   {
-      boolean result = server.stop();
-      namingDelegate.reset();
-      return result;
-   }
-
-   public synchronized void kill() throws Exception
-   {
-      // Kills the server without doing any graceful shutdown. For graceful shutdown use stop().
-      new Thread(new VMKiller(), "VM Killer").start();
-   }
-
-   public void ping() throws Exception
-   {
-      //noop - nothing to be done
-   }
-
-   public ObjectName deploy(String mbeanConfiguration) throws Exception
-   {
-      return server.deploy(mbeanConfiguration);
-   }
-
-   public void undeploy(ObjectName on) throws Exception
-   {
-      server.undeploy(on);
-   }
-
-   public Object getAttribute(ObjectName on, String attribute) throws Exception
-   {
-      return server.getAttribute(on, attribute);
-   }
-
-   public void setAttribute(ObjectName on, String name, String valueAsString) throws Exception
-   {
-      server.setAttribute(on, name, valueAsString);
-   }
-
-   public Object invoke(ObjectName on, String operationName, Object[] params, String[] signature)
-      throws Exception
-   {
-      return server.invoke(on, operationName, params, signature);
-   }
-
-   public void addNotificationListener(ObjectName on, NotificationListener listener)
-      throws Exception
-   {
-      if (!(listener instanceof NotificationListenerID))
-      {
-         throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
-      }
-
-      long id = ((NotificationListenerID)listener).getID();
-
-      ProxyNotificationListener pl = new ProxyNotificationListener();
-
-      synchronized(proxyListeners)
-      {
-         proxyListeners.put(new Long(id), pl);
-      }
-
-      server.addNotificationListener(on, pl);
-   }
-
-   public void removeNotificationListener(ObjectName on, NotificationListener listener)
-      throws Exception
-   {
-
-      if (!(listener instanceof NotificationListenerID))
-      {
-         throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
-      }
-
-      long id = ((NotificationListenerID)listener).getID();
-
-      ProxyNotificationListener pl = null;
-
-      synchronized(proxyListeners)
-      {
-         pl = (ProxyNotificationListener)proxyListeners.remove(new Long(id));
-      }
-
-      server.removeNotificationListener(on, pl);
-   }
-
-   public Set query(ObjectName pattern) throws Exception
-   {
-      return server.query(pattern);
-   }
-
-   public String getDatabaseType()
-   {
-      return server.getDatabaseType();
-   }
-
-   public String getRemotingTransport()
-   {
-      return server.getRemotingTransport();
-   }
-
-   public void log(int level, String text) throws Exception
-   {
-      server.log(level, text);
-   }
-
-   public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
-                               String defaultTopicJNDIContext, boolean clustered) throws Exception
-   {
-      startServerPeer(serverPeerID, defaultQueueJNDIContext,
-                      defaultTopicJNDIContext, null, clustered);
-   }
-
-
-   public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
-                               String defaultTopicJNDIContext,
-                               ServiceAttributeOverrides attrOverrides, boolean clustered)
-      throws Exception
-   {
-      server.startServerPeer(serverPeerID, defaultQueueJNDIContext,
-                             defaultTopicJNDIContext, attrOverrides, clustered);
-   }
-
-   public void stopServerPeer() throws Exception
-   {
-      server.stopServerPeer();
-   }
-
-   public boolean isServerPeerStarted() throws Exception
-   {
-      return server.isServerPeerStarted();
-   }
-
-   public ObjectName getServerPeerObjectName() throws Exception
-   {
-      return server.getServerPeerObjectName();
-   }
-
-   public boolean isStarted() throws Exception
-   {
-      return server.isStarted();
-   }
-
-   public Set getConnectorSubsystems() throws Exception
-   {
-      return server.getConnectorSubsystems();
-   }
-
-   public void addServerInvocationHandler(String subsystem, ServerInvocationHandler handler)
-      throws Exception
-   {
-      server.addServerInvocationHandler(subsystem, handler);
-   }
-
-   public void removeServerInvocationHandler(String subsystem) throws Exception
-   {
-      server.removeServerInvocationHandler(subsystem);
-   }
-
-   public MessageStore getMessageStore() throws Exception
-   {
-      return server.getMessageStore();
-   }
-
-   public DestinationManager getDestinationManager() throws Exception
-   {
-      return server.getDestinationManager();
-   }
-
-   public PersistenceManager getPersistenceManager() throws Exception
-   {
-      return server.getPersistenceManager();
-   }
-
-   public ServerPeer getServerPeer() throws Exception
-   {
-      return server.getServerPeer();
-   }
-
-   public void deployTopic(String name, String jndiName, boolean clustered) throws Exception
-   {
-      server.deployTopic(name, jndiName, clustered);
-   }
-
-   public void deployTopic(String name,
-                           String jndiName,
-                           int fullSize,
-                           int pageSize,
-                           int downCacheSize,
-                           boolean clustered) throws Exception
-   {
-      server.deployTopic(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
-   }
-
-   public void deployTopicProgrammatically(String name, String jndiName) throws Exception
-   {
-      server.deployTopicProgrammatically(name, jndiName);
-   }
-
-   public void deployQueue(String name, String jndiName, boolean clustered) throws Exception
-   {
-      server.deployQueue(name, jndiName, clustered);
-   }
-
-   public void deployQueue(String name,
-                           String jndiName,
-                           int fullSize,
-                           int pageSize,
-                           int downCacheSize,
-                           boolean clustered) throws Exception
-   {
-      server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
-   }
-
-   public void deployQueueProgrammatically(String name, String jndiName) throws Exception
-   {
-      server.deployQueueProgrammatically(name, jndiName);
-   }
-
-   public void undeployDestination(boolean isQueue, String name) throws Exception
-   {
-      server.undeployDestination(isQueue, name);
-   }
-
-   public boolean undeployDestinationProgrammatically(boolean isQueue, String name) throws Exception
-   {
-      return server.undeployDestinationProgrammatically(isQueue, name);
-   }
-
-   public void deployConnectionFactory(String objectName, String[] jndiBindings)
-      throws Exception
-   {
-      server.deployConnectionFactory(objectName, jndiBindings);
-   }
-
-   public void deployConnectionFactory(String objectName, String[] jndiBindings, int prefetchSize)
-      throws Exception
-   {
-      server.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
-   }
-
-   public void deployConnectionFactory(String objectName,
-                                       String[] jndiBindings,
-                                       int prefetchSize,
-                                       int defaultTempQueueFullSize,
-                                       int defaultTempQueuePageSize,
-                                       int defaultTempQueueDownCacheSize) throws Exception
-   {
-      server.deployConnectionFactory(objectName, jndiBindings, prefetchSize,
-                                     defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
-   }
-
-   public void undeployConnectionFactory(ObjectName objectName) throws Exception
-   {
-      server.undeployConnectionFactory(objectName);
-   }
-
-   public void configureSecurityForDestination(String destName, String config) throws Exception
-   {
-      server.configureSecurityForDestination(destName, config);
-   }
-
-   public void setDefaultSecurityConfig(String config) throws Exception
-   {
-      server.setDefaultSecurityConfig(config);
-   }
-
-   public String getDefaultSecurityConfig() throws Exception
-   {
-      return server.getDefaultSecurityConfig();
-   }
-
-   public Object executeCommand(Command command) throws Exception
-   {
-      return server.executeCommand(command);
-   }
-
-   public UserTransaction getUserTransaction() throws Exception
-   {
-      return server.getUserTransaction();
-   }
-
-   public Set getNodeIDView() throws Exception
-   {
-      return server.getNodeIDView();
-   }
-
-   public List pollNotificationListener(long listenerID) throws Exception
-   {
-      ProxyNotificationListener pl = null;
-
-      synchronized(proxyListeners)
-      {
-         pl = (ProxyNotificationListener)proxyListeners.get(new Long(listenerID));
-      }
-
-      if (pl == null)
-      {
-         return Collections.EMPTY_LIST;
-      }
-
-      return pl.drain();
-   }
-
-   public void poisonTheServer(int type) throws Exception
-   {
-      server.poisonTheServer(type);
-   }
-   
-   public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
-   {
-      server.installJMSProviderAdaptor(jndi, adaptor);
-   }
-
-   public void uninstallJMSProviderAdaptor(String jndi) throws Exception
-   {
-      server.uninstallJMSProviderAdaptor(jndi);
-   }
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   private RMINamingDelegate getNamingDelegate()
-   {
-      return namingDelegate;
-   }
-
-   // Inner classes -------------------------------------------------
-
-   public class VMKiller implements Runnable
-   {
-      public void run()
-      {
-         log.info("shutting down the VM");
-
-         try
-         {
-            // unregister myself from the RMI registry
-
-            Registry registry = LocateRegistry.getRegistry(DEFAULT_REGISTRY_PORT);
-
-            String name = RMI_SERVER_PREFIX + server.getServerID();
-            registry.unbind(name);
-            log.info("unregistered " + name + " from registry");
-
-            name = NAMING_SERVER_PREFIX + server.getServerID();
-            registry.unbind(name);
-            log.info("unregistered " + name + " from registry");
-         }
-         catch(Exception e)
-         {
-            log.error("Failed to unregister", e);
-         }
-
-         try
-         {
-            Thread.sleep(250);
-         }
-         catch(Exception e)
-         {
-            log.warn("interrupted while sleeping", e);
-         }
-
-         System.exit(0);
-      }
-   }
-}

Copied: tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java (from rev 2560, branches/Branch_1_2_0_SP/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,543 @@
+/*
+  * 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.tools.jmx.rmi;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.Set;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import javax.management.ObjectName;
+import javax.management.NotificationListener;
+import javax.transaction.UserTransaction;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
+import org.jboss.jms.server.DestinationManager;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.plugin.contract.MessageStore;
+import org.jboss.messaging.core.plugin.contract.PersistenceManager;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
+
+/**
+ * An RMI wrapper to access the ServiceContainer from a different address space.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
+ * @version <tt>1.1</tt>
+ *
+ * RMITestServer.java,v 1.1 2006/02/21 08:25:33 timfox Exp
+ */
+public class RMITestServer extends UnicastRemoteObject implements Server
+{
+   // Constants -----------------------------------------------------
+
+   public static final String RMI_SERVER_PREFIX = "messaging_rmi_server_";
+   public static final String NAMING_SERVER_PREFIX = "naming_rmi_server_";
+
+   public static final int DEFAULT_REGISTRY_PORT = 33777;
+   public static final int DEFAULT_SERVER_INDEX = 0;
+   public static final String DEFAULT_SERVER_HOST = "localhost";
+
+   private static final long serialVersionUID = -368445344011004778L;
+   private static final Logger log = Logger.getLogger(RMITestServer.class);
+
+   // Static --------------------------------------------------------
+
+   public static void main(String[] args) throws Exception
+   {
+      log.debug("initializing RMI runtime");
+
+      String host = System.getProperty("test.bind.address");
+
+      if (host == null)
+      {
+         host = DEFAULT_SERVER_HOST;
+      }
+
+      int serverIndex = DEFAULT_SERVER_INDEX;
+
+      String s = System.getProperty("test.server.index");
+
+      if (s != null)
+      {
+         serverIndex = Integer.parseInt(s);
+      }
+
+      log.info("RMI server " + serverIndex + ", bind address " + host);
+
+      RMITestServer testServer = new RMITestServer(serverIndex);
+      log.debug("RMI server " + serverIndex + " created");
+
+      // let RMI know the bind address
+      System.setProperty("java.rmi.server.hostname", host);
+
+      Registry registry;
+
+      // try to bind first
+      try
+      {
+         registry = LocateRegistry.getRegistry(DEFAULT_REGISTRY_PORT);
+         registry.bind(RMI_SERVER_PREFIX + serverIndex, testServer);
+         registry.bind(NAMING_SERVER_PREFIX + serverIndex, testServer.getNamingDelegate());
+
+      }
+      catch(Exception e)
+      {
+         log.info("Failure using an existing registry, trying creating it");
+
+         // try to create it
+         registry = LocateRegistry.createRegistry(DEFAULT_REGISTRY_PORT);
+
+         registry.bind(RMI_SERVER_PREFIX + serverIndex, testServer);
+         registry.bind(NAMING_SERVER_PREFIX + serverIndex, testServer.getNamingDelegate());
+      }
+
+      log.info("RMI server " + serverIndex + " bound");
+
+      // there is one crash test that needs to start the server, as an external VM...
+      // as one client will crash while another will be alive
+      boolean startAll=false;
+
+      for (int i=0;i<args.length;i++)
+      {
+         if (args[i].equals("-startAll"))
+         {
+            startAll=true;
+         }
+      }
+
+      if (startAll)
+      {
+         testServer.start("all", true);
+      }
+   }
+
+   // Attributes ----------------------------------------------------
+
+   protected RemoteTestServer server;
+   private RMINamingDelegate namingDelegate;
+   // Map<Long-ProxyNotificationListener>
+   private Map proxyListeners;
+
+   // Constructors --------------------------------------------------
+
+   public RMITestServer(int index) throws Exception
+   {
+      namingDelegate = new RMINamingDelegate(index);
+      server = new RemoteTestServer(index);
+      proxyListeners = new HashMap();
+   }
+
+   // Server implementation -----------------------------------------
+
+   public int getServerID()
+   {
+      return server.getServerID();
+   }
+
+   public void start(String containerConfig, boolean clearDatabase) throws Exception
+   {
+      start(containerConfig, null, clearDatabase, true);
+   }
+
+   public void start(String containerConfig, ServiceAttributeOverrides attrOverrides,
+                     boolean clearDatabase, boolean startMessagingServer) throws Exception
+   {
+      server.start(containerConfig, attrOverrides, clearDatabase, startMessagingServer);
+   }
+
+   public boolean stop() throws Exception
+   {
+      boolean result = server.stop();
+      namingDelegate.reset();
+      return result;
+   }
+
+   public synchronized void kill() throws Exception
+   {
+      // Kills the server without doing any graceful shutdown. For graceful shutdown use stop().
+      new Thread(new VMKiller(), "VM Killer").start();
+   }
+
+   public void ping() throws Exception
+   {
+      //noop - nothing to be done
+   }
+
+   public ObjectName deploy(String mbeanConfiguration) throws Exception
+   {
+      return server.deploy(mbeanConfiguration);
+   }
+
+   public void undeploy(ObjectName on) throws Exception
+   {
+      server.undeploy(on);
+   }
+
+   public Object getAttribute(ObjectName on, String attribute) throws Exception
+   {
+      return server.getAttribute(on, attribute);
+   }
+
+   public void setAttribute(ObjectName on, String name, String valueAsString) throws Exception
+   {
+      server.setAttribute(on, name, valueAsString);
+   }
+
+   public Object invoke(ObjectName on, String operationName, Object[] params, String[] signature)
+      throws Exception
+   {
+      return server.invoke(on, operationName, params, signature);
+   }
+
+   public void addNotificationListener(ObjectName on, NotificationListener listener)
+      throws Exception
+   {
+      if (!(listener instanceof NotificationListenerID))
+      {
+         throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
+      }
+
+      long id = ((NotificationListenerID)listener).getID();
+
+      ProxyNotificationListener pl = new ProxyNotificationListener();
+
+      synchronized(proxyListeners)
+      {
+         proxyListeners.put(new Long(id), pl);
+      }
+
+      server.addNotificationListener(on, pl);
+   }
+
+   public void removeNotificationListener(ObjectName on, NotificationListener listener)
+      throws Exception
+   {
+
+      if (!(listener instanceof NotificationListenerID))
+      {
+         throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
+      }
+
+      long id = ((NotificationListenerID)listener).getID();
+
+      ProxyNotificationListener pl = null;
+
+      synchronized(proxyListeners)
+      {
+         pl = (ProxyNotificationListener)proxyListeners.remove(new Long(id));
+      }
+
+      server.removeNotificationListener(on, pl);
+   }
+
+   public Set query(ObjectName pattern) throws Exception
+   {
+      return server.query(pattern);
+   }
+
+   public String getDatabaseType()
+   {
+      return server.getDatabaseType();
+   }
+
+   public String getRemotingTransport()
+   {
+      return server.getRemotingTransport();
+   }
+
+   public void log(int level, String text) throws Exception
+   {
+      server.log(level, text);
+   }
+
+   public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
+                               String defaultTopicJNDIContext, boolean clustered) throws Exception
+   {
+      startServerPeer(serverPeerID, defaultQueueJNDIContext,
+                      defaultTopicJNDIContext, null, clustered);
+   }
+
+
+   public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
+                               String defaultTopicJNDIContext,
+                               ServiceAttributeOverrides attrOverrides, boolean clustered)
+      throws Exception
+   {
+      server.startServerPeer(serverPeerID, defaultQueueJNDIContext,
+                             defaultTopicJNDIContext, attrOverrides, clustered);
+   }
+
+   public void stopServerPeer() throws Exception
+   {
+      server.stopServerPeer();
+   }
+
+   public boolean isServerPeerStarted() throws Exception
+   {
+      return server.isServerPeerStarted();
+   }
+
+   public ObjectName getServerPeerObjectName() throws Exception
+   {
+      return server.getServerPeerObjectName();
+   }
+
+   public boolean isStarted() throws Exception
+   {
+      return server.isStarted();
+   }
+
+   public Set getConnectorSubsystems() throws Exception
+   {
+      return server.getConnectorSubsystems();
+   }
+
+   public void addServerInvocationHandler(String subsystem, ServerInvocationHandler handler)
+      throws Exception
+   {
+      server.addServerInvocationHandler(subsystem, handler);
+   }
+
+   public void removeServerInvocationHandler(String subsystem) throws Exception
+   {
+      server.removeServerInvocationHandler(subsystem);
+   }
+
+   public MessageStore getMessageStore() throws Exception
+   {
+      return server.getMessageStore();
+   }
+
+   public DestinationManager getDestinationManager() throws Exception
+   {
+      return server.getDestinationManager();
+   }
+
+   public PersistenceManager getPersistenceManager() throws Exception
+   {
+      return server.getPersistenceManager();
+   }
+
+   public ServerPeer getServerPeer() throws Exception
+   {
+      return server.getServerPeer();
+   }
+
+   public void deployTopic(String name, String jndiName, boolean clustered) throws Exception
+   {
+      server.deployTopic(name, jndiName, clustered);
+   }
+
+   public void deployTopic(String name,
+                           String jndiName,
+                           int fullSize,
+                           int pageSize,
+                           int downCacheSize,
+                           boolean clustered) throws Exception
+   {
+      server.deployTopic(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+   }
+
+   public void deployTopicProgrammatically(String name, String jndiName) throws Exception
+   {
+      server.deployTopicProgrammatically(name, jndiName);
+   }
+
+   public void deployQueue(String name, String jndiName, boolean clustered) throws Exception
+   {
+      server.deployQueue(name, jndiName, clustered);
+   }
+
+   public void deployQueue(String name,
+                           String jndiName,
+                           int fullSize,
+                           int pageSize,
+                           int downCacheSize,
+                           boolean clustered) throws Exception
+   {
+      server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+   }
+
+   public void deployQueueProgrammatically(String name, String jndiName) throws Exception
+   {
+      server.deployQueueProgrammatically(name, jndiName);
+   }
+
+   public void undeployDestination(boolean isQueue, String name) throws Exception
+   {
+      server.undeployDestination(isQueue, name);
+   }
+
+   public boolean undeployDestinationProgrammatically(boolean isQueue, String name) throws Exception
+   {
+      return server.undeployDestinationProgrammatically(isQueue, name);
+   }
+
+   public void deployConnectionFactory(String objectName, String[] jndiBindings)
+      throws Exception
+   {
+      server.deployConnectionFactory(objectName, jndiBindings);
+   }
+
+   public void deployConnectionFactory(String objectName, String[] jndiBindings, int prefetchSize)
+      throws Exception
+   {
+      server.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+   }
+
+   public void deployConnectionFactory(String objectName,
+                                       String[] jndiBindings,
+                                       int prefetchSize,
+                                       int defaultTempQueueFullSize,
+                                       int defaultTempQueuePageSize,
+                                       int defaultTempQueueDownCacheSize) throws Exception
+   {
+      server.deployConnectionFactory(objectName, jndiBindings, prefetchSize,
+                                     defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
+   }
+
+   public void undeployConnectionFactory(ObjectName objectName) throws Exception
+   {
+      server.undeployConnectionFactory(objectName);
+   }
+
+   public void configureSecurityForDestination(String destName, String config) throws Exception
+   {
+      server.configureSecurityForDestination(destName, config);
+   }
+
+   public void setDefaultSecurityConfig(String config) throws Exception
+   {
+      server.setDefaultSecurityConfig(config);
+   }
+
+   public String getDefaultSecurityConfig() throws Exception
+   {
+      return server.getDefaultSecurityConfig();
+   }
+
+   public Object executeCommand(Command command) throws Exception
+   {
+      return server.executeCommand(command);
+   }
+
+   public UserTransaction getUserTransaction() throws Exception
+   {
+      return server.getUserTransaction();
+   }
+
+   public Set getNodeIDView() throws Exception
+   {
+      return server.getNodeIDView();
+   }
+
+   public List pollNotificationListener(long listenerID) throws Exception
+   {
+      ProxyNotificationListener pl = null;
+
+      synchronized(proxyListeners)
+      {
+         pl = (ProxyNotificationListener)proxyListeners.get(new Long(listenerID));
+      }
+
+      if (pl == null)
+      {
+         return Collections.EMPTY_LIST;
+      }
+
+      return pl.drain();
+   }
+
+   public void poisonTheServer(int type) throws Exception
+   {
+      server.poisonTheServer(type);
+   }
+   
+   public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
+   {
+      server.installJMSProviderAdaptor(jndi, adaptor);
+   }
+
+   public void uninstallJMSProviderAdaptor(String jndi) throws Exception
+   {
+      server.uninstallJMSProviderAdaptor(jndi);
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   private RMINamingDelegate getNamingDelegate()
+   {
+      return namingDelegate;
+   }
+
+   // Inner classes -------------------------------------------------
+
+   public class VMKiller implements Runnable
+   {
+      public void run()
+      {
+         log.info("shutting down the VM");
+
+         try
+         {
+            // unregister myself from the RMI registry
+
+            Registry registry = LocateRegistry.getRegistry(DEFAULT_REGISTRY_PORT);
+
+            String name = RMI_SERVER_PREFIX + server.getServerID();
+            registry.unbind(name);
+            log.info("unregistered " + name + " from registry");
+
+            name = NAMING_SERVER_PREFIX + server.getServerID();
+            registry.unbind(name);
+            log.info("unregistered " + name + " from registry");
+         }
+         catch(Exception e)
+         {
+            log.error("Failed to unregister", e);
+         }
+
+         try
+         {
+            Thread.sleep(250);
+         }
+         catch(Exception e)
+         {
+            log.warn("interrupted while sleeping", e);
+         }
+
+         System.exit(0);
+      }
+   }
+}

Modified: tags/JBossMessaging_1_2_0_SP1/util/do-not-distribute.properties
===================================================================
--- branches/Branch_1_2_0_SP/util/do-not-distribute.properties	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/util/do-not-distribute.properties	2007-03-28 19:40:59 UTC (rev 2567)
@@ -2,7 +2,7 @@
 # This file provides values for in-workarea example testing.
 # DO NOT DISTRIBUTE!
 #
-#jboss.home=C:\\work/src/jboss-4.0.1sp1-src/build/output/jboss-4.0.1sp1
+jboss.home=/home/clebert/workspaces/Branch_4_0/build/output/jboss-4.0.5.SP1/
 #jboss.home=C:\\work/src/cvs/jboss-head/build/output/jboss-5.0.0.Alpha
 #jboss.home=C:\\work\\src\\jboss-4.0.3SP1-src\\build\\output\\jboss-4.0.3SP1
 #jboss.home=C:\\work\\src\\jboss-4.0.4.GA-src\\build\\output\\jboss-4.0.4.GA

Deleted: tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml
===================================================================
--- branches/Branch_1_2_0_SP/util/release-admin.xml	2007-03-14 18:49:42 UTC (rev 2547)
+++ tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -1,724 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!--                                                                        -->
-<!--  Ant file to create a JBoss 4.x messaging configurations based on a    -->
-<!--  default configuration.                                                -->
-<!--                                                                        -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<project default="default" name="Create JBoss 4.x Messaging Configuration">
-
-   <property environment="ENV"/>
-
-   <property file="./do-not-distribute.properties"/>
-
-   <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
-   <property name="messaging.config.name" value="messaging"/>
-   <property name="id" value="0"/>
-   <property name="database" value="mysql"/>
-   <property name="thirdparty.home" value="../thirdparty"/>
-   <property name="thirdparty.jbossts.home" value="${thirdparty.home}/jboss/jbossts"/>
-   <property name="lib.home" value="../lib"/>
-   <property name="lib.jbossts.home" value="${lib.home}/jbossts"/>
-   <property name="output.lib.home" value="../output/lib"/>
-
-   <!--
-        DO NOT change these values here, otherwise the installation script won't work. If you need
-        to change them, to it in do-not-distribute.properties.
-   -->
-   <property name="main.artifact.location" value=".."/>
-   <property name="auxiliary.artifacts.location" value="../examples/config"/>
-   <property name="auxiliary.lib.location" value="./lib"/>
-   <property name="messaging.artifact.name" value="jboss-messaging-scoped.sar"/>
-
-   <!-- ======================================================================================== -->
-   <!-- Top level targets. These are the "modes" this script is supposed to work in.             -->
-   <!-- ======================================================================================== -->
-
-   <!--
-        A default scoped installation for JBoss 4.x.
-   -->
-   <target name="default" depends="validate-ant, validate-database">
-      <set-config-name base="${messaging.config.name}" suffix=""/>
-      <antcall target="create-server-config"/>
-   </target>
-
-   <!--
-        A "standalone" (non-scoped minimal configuration) installation for JBoss 4.x.
-   -->
-   <target name="standalone" depends="validate-ant, validate-database">
-      <condition property="config.name" value="${standalone.messaging.config.name}">
-          <isset property="standalone.messaging.config.name"/>
-      </condition>
-      <set-config-name base="${messaging.config.name}" suffix="standalone"/>
-      <antcall target="create-standalone-server-config"/>
-   </target>
-
-   <!--
-        A cluster node installation for JBoss 4.x.
-   -->
-   <target name="cluster-node" depends="validate-ant, validate-database">
-      <set-config-name base="${messaging.config.name}" suffix="node${id}"/>
-      <antcall target="create-cluster-node-server-config"/>
-   </target>
-
-   <!-- ======================================================================================== -->
-   <!-- Internal targets                                                                         -->
-   <!-- ======================================================================================== -->
-
-   <target name="validate-ant">
-        <condition property="ant.ok">
-            <antversion atleast="1.7.0"/>
-        </condition>
-        <fail unless="ant.ok" message="The ant you're using (${ant.version}) is too old, you need at least 1.7.0!"/>
-   </target>
-
-    <target name="validate-database">
-
-        <condition property="supported.database">
-            <or>
-                <equals arg1="${database}" arg2="mysql"/>
-                <equals arg1="${database}" arg2="postgresql"/>
-                <equals arg1="${database}" arg2="oracle"/>
-                <equals arg1="${database}" arg2="mssql"/>
-                <equals arg1="${database}" arg2="sybase"/>
-            </or>
-        </condition>
-
-        <fail unless="supported.database" message="Database type '${database}' not supported!"/>
-
-        <!--
-             We only provide database drivers for MySQL, for the time being.
-        -->
-        <condition property="database.drivers.provided.by.us">
-            <equals arg1="${database}" arg2="mysql"/>
-        </condition>
-
-    </target>
-
-   <target name="validate-jboss">
-      <fail unless="jboss.home" message="JBOSS_HOME environment variable not set! Set it and try again."/>
-      <available property="default-config" type="dir" file="${jboss.home}/server/default"/>
-      <fail unless="default-config" message="${jboss.home}/server/default not found!"/>
-   </target>
-
-   <target name="prevent-messaging-overwrite">
-      <available property="messaging-config" type="dir" file="${jboss.home}/server/${config.name}"/>
-      <fail if="messaging-config" message="'${config.name}' configuration already exists! Delete it manually and try again."/>
-   </target>
-
-   <target name="validate-messaging-artifact">
-      <available property="messaging-artifact-exists" type="file" file="${main.artifact.location}/${messaging.artifact.name}"/>
-      <fail unless="messaging-artifact-exists" message="${main.artifact.location}/${messaging.artifact.name} does not exist! Build it and try again."/>
-   </target>
-
-   <target name="create-server-config" depends="validate-jboss, prevent-messaging-overwrite, validate-messaging-artifact">
-
-      <echo message="Creating JBoss Messaging configuration '${config.name}' for ${jboss.home} based on ${messaging.artifact.name}"/>
-
-      <mkdir dir="${jboss.home}/server/${config.name}"/>
-      <copy todir="${jboss.home}/server/${config.name}">
-         <fileset dir="${jboss.home}/server/default">
-            <exclude name="data/**"/>
-            <exclude name="work/**"/>
-            <exclude name="log/**"/>
-            <exclude name="tmp/**"/>
-            <exclude name="deploy/jms/**"/>
-            <exclude name="lib/jboss-messaging.jar"/>
-         </fileset>
-      </copy>
-      <copy file="${jboss.home}/server/default/deploy/jms/jms-ra.rar"
-            todir="${jboss.home}/server/${config.name}/deploy"/>
-
-      <!-- add a "messaging" security domain -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3cpolicy\x3e)"/>
-         <substitution expression="\1&#013;&#010;&#013;&#010;    &lt;application-policy name = &quot;messaging&quot;&gt;&#013;&#010;        &lt;authentication&gt;&#013;&#010;
-            &lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;&#013;&#010;
-            flag = &quot;required&quot; &gt;&#013;&#010;
-         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;&#013;&#010;
-         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;&#013;&#010;
-         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;&#013;&#010;
-         &lt;/login-module&gt;&#013;&#010;        &lt;/authentication&gt;&#013;&#010;    &lt;/application-policy&gt;&#013;&#010;"/>
-      </replaceregexp>
-
-      <!-- Make sure JNDI CallByValue is disabled, otherwise MDB deployments will fail -->
-      <property name="naming.config.file" value="${jboss.home}/server/${config.name}/deploy/naming-service.xml"/>
-      <available property="naming.service.config.present" file="${naming.config.file}"/>
-      <antcall target="enable-jndi-call-by-reference"/>
-
-      <!-- mute org.jboss.serial DEBUG -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/log4j.xml" flags="s">
-         <regexp pattern="(\x3croot\x3e)"/>
-         <substitution expression="&lt;category name=&quot;org.jboss.serial&quot;&gt;&#013;&#010;      &lt;priority value=&quot;INFO&quot;/&gt;&#013;&#010;   &lt;/category&gt;&#013;&#010;&#013;&#010;   \1"/>
-      </replaceregexp>
-
-
-      <!-- TODO: creating a server configuration breaks if whe have this enabled. Temporarily
-                 commenting it out, until I figure out why it breaks
-                 http://jira.jboss.org/jira/browse/JBMESSAGING-811
-      -->
-
-
-      <!-- Replace local TM with JBossTS -->
-
-      <!--
-      <copy file="${thirdparty.jbossts.home}/lib/jbossjta.jar"
-            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
-      <copy file="${thirdparty.jbossts.home}/lib/jbossjta-integration.jar"
-            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
-      <copy file="${thirdparty.jbossts.home}/lib/jbossts-common.jar"
-            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
-      <copy file="${lib.jbossts.home}/jbossjta-properties.xml"
-            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
-      <copy overwrite="true"
-            file="${lib.jbossts.home}/jboss-service.xml"
-            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
-      <copy file="${output.lib.home}/jboss-messaging-integration.jar"
-            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
-      -->
-
-      <!-- copy the scoped sar
-      <copy todir="${jboss.home}/server/${config.name}/deploy"
-            file="${relative.sar.location}/${messaging.sar.name}"/>
-      -->
-
-      <!-- we deploy the archive exploded so that users can easily access the configuration files -->
-      <condition property="is.sar" value="true">
-         <contains substring=".sar" string="${messaging.artifact.name}"/>
-      </condition>
-      <antcall target="expand-jar"/>
-      <antcall target="expand-sar"/>
-   </target>
-
-   <target name="expand-sar" if="is.sar">
-      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
-             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar">
-      </unjar>
-   </target>
-
-   <target name="expand-jar" unless="is.sar">
-      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
-             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-      </unjar>
-      <jar jarfile="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jboss-messaging.jar"
-           manifest="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF/MANIFEST.MF">
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging" includes="org/**,VERSION,aop-messaging*.xml"/>
-      </jar>
-      <delete>
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-            <include name="VERSION"/>
-            <include name="aop-messaging*.xml"/>
-         </fileset>
-      </delete>
-      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/org"/>
-      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF"/>
-
-      <move file="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jboss-messaging.jar"
-            todir="${jboss.home}/server/${config.name}/lib"/>
-      <move todir="${jboss.home}/server/${config.name}/conf/xmdesc">
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc">
-            <include name="*.xml"/>
-         </fileset>
-      </move>
-      <move todir="${jboss.home}/server/${config.name}/conf">
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-            <include name="messaging-*.properties"/>
-         </fileset>
-      </move>
-      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc"/>
-   </target>
-
-   <target name="enable-jndi-call-by-reference" if="naming.service.config.present">
-      <replaceregexp file="${naming.config.file}" flags="s">
-         <regexp pattern="\x3cattribute name=\x22CallByValue\x22\x3etrue\x3c/attribute\x3e"/>
-         <substitution expression="&lt;attribute name=&quot;CallByValue&quot;&gt;false&lt;/attribute&gt;"/>
-      </replaceregexp>
-   </target>
-
-   <target name="create-standalone-server-config" depends="validate-jboss, validate-messaging-artifact"
-           description="Creates a standalone Messaging server configuration based on a default JBoss instance">
-
-      <echo message="Creating Standalone Messaging configuration '${config.name}' for ${jboss.home} based on ${messaging.artifact.name}"/>
-
-      <mkdir dir="${jboss.home}/server/${config.name}/conf"/>
-      <mkdir dir="${jboss.home}/server/${config.name}/lib"/>
-      <mkdir dir="${jboss.home}/server/${config.name}/deploy"/>
-
-      <copy todir="${jboss.home}/server/${config.name}/conf">
-         <fileset dir="${jboss.home}/server/default/conf">
-            <include name="jboss-service.xml"/>
-            <include name="jndi.properties"/>
-            <include name="log4j.xml"/>
-            <include name="login-config.xml"/>
-            <include name="props/**"/>
-            <include name="xmdesc/**"/>
-         </fileset>
-      </copy>
-
-      <copy todir="${jboss.home}/server/${config.name}/deploy">
-         <fileset dir="${jboss.home}/server/default/deploy">
-            <include name="hsqldb-ds.xml"/>
-            <include name="jboss-local-jdbc.rar"/>
-            <include name="jbossjca-service.xml"/>
-            <include name="jbossweb-tomcat55.sar/**"/>
-            <include name="jmx-console.war/**"/>
-            <include name="jmx-invoker-service.xml"/>
-            <include name="management/**"/>
-            <include name="properties-service.xml"/>
-         </fileset>
-      </copy>
-
-      <copy todir="${jboss.home}/server/${config.name}/lib">
-         <fileset dir="${jboss.home}/server/default/lib">
-            <include name="commons*.jar"/>
-            <include name="hsqldb*.jar"/>
-            <include name="javax.servlet*.jar"/>
-            <include name="jboss-common-jdbc-wrapper.jar"/>
-            <include name="jboss-j2ee.jar"/>
-            <include name="jboss-jca.jar"/>
-            <include name="jboss-management.jar"/>
-            <include name="jboss-monitoring.jar"/>
-            <include name="jboss-transaction.jar"/>
-            <include name="jboss.jar"/>
-            <include name="jbosssx.jar"/>
-            <include name="jmx-adaptor-plugin.jar"/>
-            <include name="jnpserver.jar"/>
-            <include name="log4j.jar"/>
-            <include name="properties-plugin.jar"/>
-         </fileset>
-      </copy>
-
-      <!-- slim down jboss-service.xml -->
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.management.j2ee.LocalJBossServerDomain\x22.*jboss:service=CorbaORB\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.util.property.jmx.SystemPropertyClassValue\x22.*org.jboss.system.JBossRMIClassLoader\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.web.WebService\x22.*\x3cdepends optional-attribute-name=\x22ThreadPool\x22[ \t\n\r]*proxy-type=\x22attribute\x22\x3ejboss.system:service=ThreadPool\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.tm.usertx.server.ClientUserTransactionService\x22.*\x3cdepends\x3ejboss:service=invoker,type=jrmp\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e[ \t\n\r]*\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.invocation.pooled.server.PooledInvoker\x22.*\x3cdepends optional-attribute-name=\x22TransactionManagerService\x22\x3ejboss:service=TransactionManager\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean code=\x22org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary\x22.*name=\x22jboss.jdbc:service=metadata\x22/\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <!-- customize login-config.xml -->
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3cpolicy\x3e)"/>
-         <substitution expression="\1 &lt;application-policy name = &quot;messaging&quot;&gt;
-         &lt;authentication&gt;&lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;
-            flag = &quot;required&quot; &gt;
-         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;
-         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;
-         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;
-         &lt;/login-module&gt;&lt;/authentication&gt;&lt;/application-policy&gt;"/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3cpolicy\x3e)"/>
-         <substitution expression="\1 &lt;application-policy name = &quot;messaging&quot;&gt;
-         &lt;authentication&gt;&lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;
-            flag = &quot;required&quot; &gt;
-         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;
-         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;
-         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;
-         &lt;/login-module&gt;&lt;/authentication&gt;&lt;/application-policy&gt;"/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3capplication-policy name = \x22jbossmq\x22\x3e.*FROM JMS_ROLES WHERE USERID=.\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3capplication-policy name = \x22jbossmq\x22\x3e.*jboss.mq:service=StateManager\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
-         <regexp pattern="(\x3capplication-policy name=\x22JBossWS\x22\x3e.*\x3cmodule-option name=\x22unauthenticatedIdentity\x22\x3eanonymous\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <!-- mute org.jboss.serial DEBUG -->
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/log4j.xml" flags="s">
-         <regexp pattern="(\x3croot\x3e)"/>
-         <substitution expression="&lt;category name=&quot;org.jboss.serial&quot;&gt;&#013;&#010;      &lt;priority value=&quot;INFO&quot;/&gt;&#013;&#010;   &lt;/category&gt;&#013;&#010;&#013;&#010;   \1"/>
-      </replaceregexp>
-
-      <!-- customize hsqldb-ds.xml -->
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/hsqldb-ds.xml" flags="s">
-         <regexp pattern="(\x3cmetadata\x3e[ \t\n\r]*\x3ctype-mapping\x3eHypersonic SQL\x3c/type-mapping\x3e[ \t\n\r]*\x3c/metadata\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <!-- get rid of the AJP connector -->
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/jbossweb-tomcat55.sar/server.xml" flags="s">
-         <regexp pattern="(\x3cConnector port=\x228009\x22.*protocol=\x22AJP/1.3\x22/\x3e)"/>
-         <substitution expression=""/>
-      </replaceregexp>
-
-      <!-- deploy exploded messaging -->
-
-      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
-             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-      </unjar>
-
-      <!-- un-scope the deployment -->
-
-      <move todir="${jboss.home}/server/${config.name}/lib">
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-            <include name="jboss-messaging.jar"/>
-            <include name="javassist.jar"/>
-            <include name="jboss-aop.jar"/>
-            <include name="jboss-aspect-library.jar"/>
-            <include name="jboss-common-softvaluehashmap.jar"/>
-            <include name="jboss-common-stream.jar"/>
-            <include name="jboss-remoting.jar"/>
-            <include name="jboss-serialization.jar"/>
-            <include name="jboss-unified-invocation.jar"/>
-            <include name="trove.jar"/>
-         </fileset>
-      </move>
-
-      <unjar src="${jboss.home}/server/${config.name}/lib/jboss-messaging.jar"
-             dest="${jboss.home}/server/${config.name}/conf">
-         <patternset>
-            <include name="xmdesc/**"/>
-         </patternset>
-      </unjar>
-
-      <move todir="${jboss.home}/server/${config.name}/conf">
-         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
-            <include name="messaging-*.properties"/>
-         </fileset>
-      </move>
-
-      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc"/>
-      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF"/>
-      <delete file="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jms-ds.xml"/>
-
-   </target>
-
-   <target name="create-cluster-node-server-config">
-
-      <!--
-           Create the non-clustered configuration first.
-      -->
-      <antcall target="create-server-config"/>
-
-      <!--
-           Configure the apropriate port range.
-      -->
-      <antcall target="configure-service-binding-manager"/>
-
-      <!--
-           Adjust the node id
-      -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/messaging-service.xml" flags="s"
-         match="(\x3carg[ \t]type=\x22int\x22[ \t]*value=\x22).+?(\x22.*)" replace="\1${id}\2"/>
-
-      <!--
-           Replace HSQLDB with a LAN-shareable database.
-      -->
-      <echo message="Enabling ${database}"/>
-
-      <delete file="${jboss.home}/server/${config.name}/deploy/hsqldb-ds.xml" quiet="false" failonerror="true"/>
-      <copy file="${auxiliary.artifacts.location}/${database}-ds.xml" todir="${jboss.home}/server/${config.name}/deploy/"/>
-
-      <!--
-           We may not distribute the driver for availability or copyright reasons, so the driver
-           may not be under lib. We need to check and issue a warning if it isn't.
-      -->
-      <copy todir="${jboss.home}/server/${config.name}/lib">
-         <fileset dir="${auxiliary.lib.location}">
-            <include name="${database}-driver*.jar"/>
-         </fileset>
-      </copy>
-
-      <!--
-           Use clustered persistence configuration file.
-      -->
-
-      <delete file="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml" quiet="false" failonerror="true"/>
-      <copy file="${auxiliary.artifacts.location}/clustered-${database}-persistence-service.xml" todir="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/"/>
-
-      <antcall target="warn-check-database-drivers"/>
-      <antcall target="warn-no-database-drivers"/>
-   </target>
-
-   <target name="warn-check-database-drivers" if="database.drivers.provided.by.us">
-<echo>
-
-
-
-                    ##########################
-                    #                        #
-                    #        WARNING!        #
-                    #                        #
-                    ##########################
-
-
- The configuration that has just been created uses a generic ${database} service descriptor!
-
- Check
-
-      ${jboss.home}/server/${config.name}/deploy/${database}-ds.xml
-
- and make sure that:
-
- 1. Your database is indeed ${database}.
- 2. It is accessible from every physical node you installed Messaging on.
- 3. Contains a schema (database/tablespace) named 'messaging'.
- 4. The URL (hostname and port), username and password and other connect information are correct.
- 5. The installed ${database}-driver.jar's version maches your database.
-
-
-
-
-</echo>
-   </target>
-
-   <target name="warn-no-database-drivers" unless="database.drivers.provided.by.us">
-<echo>
-
-
-
-                    ##########################
-                    #                        #
-                    #        WARNING!        #
-                    #                        #
-                    ##########################
-
-
- The configuration that has just been created uses a generic ${database} service descriptor!
-
- Check
-
-      ${jboss.home}/server/${config.name}/deploy/${database}-ds.xml
-
- and make sure that:
-
- 1. Your database is indeed ${database}.
- 2. It is accessible from every physical node you installed Messaging on.
- 3. Contains a schema (database/tablespace) named 'messaging'.
- 4. The URL (hostname and port), username and password and other connect information are correct.
-
-
-                    ##########################
-                    #                        #
-                    #    ANOTHER WARNING!    #
-                    #                        #
-                    ##########################
-
-
-
-       NO DATABASE DRIVERS HAVE BEEN INSTALLED! YOU STILL NEED
-       T0 INSTALL THE APROPRIATE ${database} DATABASE DRIVERS IN
-       ${jboss.home}/server/${config.name}/lib
-
-
-
-
-</echo>
-   </target>
-
-   <target name="configure-service-binding-manager" if="ports">
-
-      <!--
-          Enable the service binding manager, by deleting XML comment tags.
-      -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean[ \t]*code=\x22org.jboss.services.binding.ServiceBindingManager\x22.+org.jboss.services.binding.XMLServicesStoreFactory[ \t\n\r]*\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e[ \t\n\r]*)--\x3e"/>
-         <substitution expression="--&gt;&#013;&#010;&#013;&#010;   \1"/>
-      </replaceregexp>
-
-      <!--
-          Use the server configuration specified as "ports" system property
-      -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cattribute[ \t]*name=\x22ServerName\x22\x3e)ports-01(\x3c/attribute\x3e)"/>
-         <substitution expression="\1${ports}\2"/>
-      </replaceregexp>
-
-      <!--
-          Configure jboss-service.xml to use a local copy of sample-bindings.xml
-      -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cattribute[ \t]*name=\x22StoreURL\x22\x3e)\x24\x7bjboss.home.url\x7d/docs/examples/binding-manager/sample-bindings.xml(\x3c/attribute\x3e)"/>
-         <substitution expression="\1${jboss.server.config.url}/binding-manager.xml\2"/>
-      </replaceregexp>
-
-      <!--
-          The above regular expression won't match some older JBoss configurations (such as
-          4.0.1sp1), so trying with an alternate expression.
-      -->
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cattribute[ \t]*name=\x22StoreURL\x22\x3e)../docs/examples/binding-manager/sample-bindings.xml(\x3c/attribute\x3e)"/>
-         <substitution expression="\1../server/${config.name}/conf/binding-manager.xml\2"/>
-      </replaceregexp>
-
-      <!--
-          Some installer-generated installations (JBoss 4.0.3, JBoss 4.0.3.SP1) do not contain
-          a BindingManager declaration at all, so we need to insert it by ourselves.
-      -->
-      <loadfile property="jboss-service.xml-content"
-                srcFile="${jboss.home}/server/${config.name}/conf/jboss-service.xml"/>
-
-      <condition property="binding.manager.declared">
-         <contains string="${jboss-service.xml-content}" substring="org.jboss.services.binding.ServiceBindingManager"/>
-      </condition>
-
-      <antcall target="insert-service-binding-manager-configuration"/>
-
-      <!--
-          Actually copy the file
-      -->
-      <copy file="${jboss.home}/docs/examples/binding-manager/sample-bindings.xml"
-            tofile="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
-
-      <!--
-          Add remoting binding manager overrides in ${config.name}/conf/binding-manager.xml
-      -->
-      <replace-messaging-connector-override server-name="ports-default" port="4457" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
-      <replace-messaging-connector-override server-name="ports-01" port="4557" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
-      <replace-messaging-connector-override server-name="ports-02" port="4657" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
-      <replace-messaging-connector-override server-name="ports-03" port="4757" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
-
-   </target>
-
-   <target name="insert-service-binding-manager-configuration" unless="binding.manager.declared">
-
-      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
-         <regexp pattern="(\x3cmbean[ \t]*code=\x22org.jboss.logging.Log4jService\x22.*?\x3c/mbean\x3e)"/>
-         <substitution expression="\1
-&#013;&#010;&#013;&#010;
-  &lt;mbean code=&quot;org.jboss.services.binding.ServiceBindingManager&quot;&#013;&#010;
-         name=&quot;jboss.system:service=ServiceBindingManager&quot;&gt;&#013;&#010;
-     &lt;attribute name=&quot;ServerName&quot;&gt;${ports}&lt;/attribute&gt;&#013;&#010;
-     &lt;attribute name=&quot;StoreURL&quot;&gt;${jboss.server.config.url}/binding-manager.xml&lt;/attribute&gt;&#013;&#010;
-     &lt;attribute name=&quot;StoreFactoryClassName&quot;&gt;&#013;&#010;
-        org.jboss.services.binding.XMLServicesStoreFactory&#013;&#010;
-     &lt;/attribute&gt;&#013;&#010;
-  &lt;/mbean&gt;"/>
-      </replaceregexp>
-
-   </target>
-
-   <macrodef name="replace-messaging-connector-override">
-      <attribute name="server-name"/>
-      <attribute name="port"/>
-      <attribute name="binding-manager-file"/>
-      <sequential>
-         <!--
-             If configuration override already exists, replace it with the correct one.
-         -->
-         <replaceregexp file="@{binding-manager-file}" flags="s">
-            <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3cservice-config[ \t]*name=\x22jboss.messaging:service=Connector,transport=)(.*?)(\x3c/service-config\x3e)(.*?)(\x3c/server\x3e)"/>
-            <substitution expression="\1\2&#013;&#010;      &lt;service-config name=&quot;jboss.messaging:service=Connector,transport=bisocket&quot;&#013;&#010;
-                     delegateClass=&quot;org.jboss.services.binding.AttributeMappingDelegate&quot;&gt;&#013;&#010;
-        &lt;delegate-config&gt;&#013;&#010;
-           &lt;attribute name=&quot;InvokerLocator&quot;&gt;bisocket://${jboss.bind.address}:@{port}/?NumberOfCallRetries=2&#038;amp;clientMaxPoolSize=50&#038;amp;clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&#038;amp;dataType=jms&#038;amp;marshaller=org.jboss.jms.server.remoting.JMSWireFormat&#038;amp;numberOfRetries=1&#038;amp;serializationtype=jms&#038;amp;socket.check_connection=false&#038;amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&lt;/attribute&gt;&#010;
-        &lt;/delegate-config&gt;&#013;&#010;
-        &lt;binding port=&quot;@{port}&quot;/&gt;&#013;&#010;
-    &lt;/service-config&gt;\6\7"/>
-         </replaceregexp>
-
-         <!--
-             If we don't find any configuration after replacement, then it means it didn't exist
-             in the first place, so add a new one
-         -->
-
-         <loadfile property="binding.manager.xml.content"
-                   srcFile="@{binding-manager-file}"/>
-
-         <condition property="messaging.connector.override.exists">
-            <matches string="${binding.manager.xml.content}" singleline="true">
-               <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3cservice-config[ \t]*name=\x22jboss.messaging:service=Connector,transport=)(.*?)@{port}(.*?)(\x3c/service-config\x3e)(.*?)(\x3c/server\x3e)"/>
-            </matches>
-         </condition>
-         <echo message="override exists: ${messaging.connector.override.exists}"/>
-
-         <antcall target="add-messaging-connector-override-if-not-already-there">
-            <param name="local.server.name" value="@{server-name}"/>
-            <param name="local.port" value="@{port}"/>
-            <param name="local.binding.manager.file" value="@{binding-manager-file}"/>
-         </antcall>
-
-      </sequential>
-   </macrodef>
-
-   <macrodef name="add-messaging-connector-override">
-      <attribute name="server-name"/>
-      <attribute name="port"/>
-      <attribute name="binding-manager-file"/>
-      <sequential>
-         <replaceregexp file="@{binding-manager-file}" flags="s">
-            <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3c/server\x3e)"/>
-            <!--
-                 note: substitution expression mst be identical with the one in
-                 replace-messaging-connector-override, with &#013;&#010;   \3 at the end instead of
-                 \6\7
-            -->
-            <substitution expression="\1\2&#013;&#010;      &lt;service-config name=&quot;jboss.messaging:service=Connector,transport=bisocket&quot;&#013;&#010;
-                     delegateClass=&quot;org.jboss.services.binding.AttributeMappingDelegate&quot;&gt;&#013;&#010;
-        &lt;delegate-config&gt;&#013;&#010;
-           &lt;attribute name=&quot;InvokerLocator&quot;&gt;bisocket://${jboss.bind.address}:@{port}/?NumberOfCallRetries=2&#038;amp;clientMaxPoolSize=50&#038;amp;clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&#038;amp;dataType=jms&#038;amp;marshaller=org.jboss.jms.server.remoting.JMSWireFormat&#038;amp;numberOfRetries=1&#038;amp;serializationtype=jms&#038;amp;socket.check_connection=false&#038;amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&lt;/attribute&gt;&#010;
-        &lt;/delegate-config&gt;&#013;&#010;
-        &lt;binding port=&quot;@{port}&quot;/&gt;&#013;&#010;
-    &lt;/service-config&gt;&#013;&#010;   \3"/>
-         </replaceregexp>
-      </sequential>
-   </macrodef>
-
-   <target name="add-messaging-connector-override-if-not-already-there" unless="messaging.connector.override.exists">
-      <add-messaging-connector-override server-name="${local.server.name}" port="${local.port}" binding-manager-file="${local.binding.manager.file}"/>
-   </target>
-
-   <macrodef name="set-config-name">
-      <attribute name="base"/>
-      <attribute name="suffix"/>
-      <sequential>
-         <condition property="config.name" value="@{base}-@{suffix}" else="@{base}">
-            <length string="@{suffix}" when="greater" length="0"/>
-         </condition>
-      </sequential>
-   </macrodef>
-
-   <target name="dump">
-      <echo message="jboss.home=${jboss.home}"/>
-      <echo message="messaging.config.name=${messaging.config.name}"/>
-      <echo message="main.artifact.location=${main.artifact.location}"/>
-   </target>
-
-   <target name="test" depends="validate-ant">
-   </target>
-
-</project>
-

Copied: tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml (from rev 2548, branches/Branch_1_2_0_SP/util/release-admin.xml)
===================================================================
--- tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml	                        (rev 0)
+++ tags/JBossMessaging_1_2_0_SP1/util/release-admin.xml	2007-03-28 19:40:59 UTC (rev 2567)
@@ -0,0 +1,731 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  Ant file to create a JBoss 4.x messaging configurations based on a    -->
+<!--  default configuration.                                                -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<project default="default" name="Create JBoss 4.x Messaging Configuration">
+
+   <property environment="ENV"/>
+
+   <property file="./do-not-distribute.properties"/>
+
+   <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
+   <property name="messaging.config.name" value="messaging"/>
+   <property name="id" value="0"/>
+   <property name="database" value="mysql"/>
+   <property name="thirdparty.home" value="../thirdparty"/>
+   <property name="thirdparty.jbossts.home" value="${thirdparty.home}/jboss/jbossts"/>
+   <property name="lib.home" value="../lib"/>
+   <property name="lib.jbossts.home" value="${lib.home}/jbossts"/>
+   <property name="output.lib.home" value="../output/lib"/>
+
+   <!--
+        DO NOT change these values here, otherwise the installation script won't work. If you need
+        to change them, to it in do-not-distribute.properties.
+   -->
+   <property name="main.artifact.location" value=".."/>
+   <property name="auxiliary.artifacts.location" value="../examples/config"/>
+   <property name="auxiliary.lib.location" value="./lib"/>
+   <property name="messaging.artifact.name" value="jboss-messaging-scoped.sar"/>
+
+   <!-- ======================================================================================== -->
+   <!-- Top level targets. These are the "modes" this script is supposed to work in.             -->
+   <!-- ======================================================================================== -->
+
+   <!--
+        A default scoped installation for JBoss 4.x.
+   -->
+   <target name="default" depends="validate-ant, validate-database">
+      <set-config-name base="${messaging.config.name}" suffix=""/>
+      <antcall target="create-server-config"/>
+   </target>
+
+   <!--
+        A "standalone" (non-scoped minimal configuration) installation for JBoss 4.x.
+   -->
+   <target name="standalone" depends="validate-ant, validate-database">
+      <condition property="config.name" value="${standalone.messaging.config.name}">
+          <isset property="standalone.messaging.config.name"/>
+      </condition>
+      <set-config-name base="${messaging.config.name}" suffix="standalone"/>
+      <antcall target="create-standalone-server-config"/>
+   </target>
+
+   <!--
+        A cluster node installation for JBoss 4.x.
+   -->
+   <target name="cluster-node" depends="validate-ant, validate-database">
+      <set-config-name base="${messaging.config.name}" suffix="node${id}"/>
+      <antcall target="create-cluster-node-server-config"/>
+   </target>
+
+   <!-- ======================================================================================== -->
+   <!-- Internal targets                                                                         -->
+   <!-- ======================================================================================== -->
+
+   <target name="validate-ant">
+        <condition property="ant.ok">
+            <antversion atleast="1.7.0"/>
+        </condition>
+        <fail unless="ant.ok" message="The ant you're using (${ant.version}) is too old, you need at least 1.7.0!"/>
+   </target>
+
+    <target name="validate-database">
+
+        <condition property="supported.database">
+            <or>
+                <equals arg1="${database}" arg2="mysql"/>
+                <equals arg1="${database}" arg2="postgresql"/>
+                <equals arg1="${database}" arg2="oracle"/>
+                <equals arg1="${database}" arg2="mssql"/>
+                <equals arg1="${database}" arg2="sybase"/>
+            </or>
+        </condition>
+
+        <fail unless="supported.database" message="Database type '${database}' not supported!"/>
+
+        <!--
+             We only provide database drivers for MySQL, for the time being.
+        -->
+        <condition property="database.drivers.provided.by.us">
+            <equals arg1="${database}" arg2="mysql"/>
+        </condition>
+
+    </target>
+
+   <target name="validate-jboss">
+      <fail unless="jboss.home" message="JBOSS_HOME environment variable not set! Set it and try again."/>
+      <available property="default-config" type="dir" file="${jboss.home}/server/default"/>
+      <fail unless="default-config" message="${jboss.home}/server/default not found!"/>
+   </target>
+
+   <target name="prevent-messaging-overwrite">
+      <available property="messaging-config" type="dir" file="${jboss.home}/server/${config.name}"/>
+      <fail if="messaging-config" message="'${config.name}' configuration already exists! Delete it manually and try again."/>
+   </target>
+
+   <target name="validate-messaging-artifact">
+      <available property="messaging-artifact-exists" type="file" file="${main.artifact.location}/${messaging.artifact.name}"/>
+      <fail unless="messaging-artifact-exists" message="${main.artifact.location}/${messaging.artifact.name} does not exist! Build it and try again."/>
+   </target>
+
+   <target name="create-server-config" depends="validate-jboss, prevent-messaging-overwrite, validate-messaging-artifact">
+
+      <echo message="Creating JBoss Messaging configuration '${config.name}' for ${jboss.home} based on ${messaging.artifact.name}"/>
+
+      <mkdir dir="${jboss.home}/server/${config.name}"/>
+      <copy todir="${jboss.home}/server/${config.name}">
+         <fileset dir="${jboss.home}/server/default">
+            <exclude name="data/**"/>
+            <exclude name="work/**"/>
+            <exclude name="log/**"/>
+            <exclude name="tmp/**"/>
+            <exclude name="deploy/jms/**"/>
+            <exclude name="lib/jboss-messaging.jar"/>
+         </fileset>
+      </copy>
+      <copy file="${jboss.home}/server/default/deploy/jms/jms-ra.rar"
+            todir="${jboss.home}/server/${config.name}/deploy"/>
+
+      <!-- add a "messaging" security domain -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3cpolicy\x3e)"/>
+         <substitution expression="\1&#013;&#010;&#013;&#010;    &lt;application-policy name = &quot;messaging&quot;&gt;&#013;&#010;        &lt;authentication&gt;&#013;&#010;
+            &lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;&#013;&#010;
+            flag = &quot;required&quot; &gt;&#013;&#010;
+         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;&#013;&#010;
+         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;&#013;&#010;
+         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;&#013;&#010;
+         &lt;/login-module&gt;&#013;&#010;        &lt;/authentication&gt;&#013;&#010;    &lt;/application-policy&gt;&#013;&#010;"/>
+      </replaceregexp>
+
+      <!-- Make sure JNDI CallByValue is disabled, otherwise MDB deployments will fail -->
+      <property name="naming.config.file" value="${jboss.home}/server/${config.name}/deploy/naming-service.xml"/>
+      <available property="naming.service.config.present" file="${naming.config.file}"/>
+      <antcall target="enable-jndi-call-by-reference"/>
+
+      <!-- mute org.jboss.serial DEBUG -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/log4j.xml" flags="s">
+         <regexp pattern="(\x3croot\x3e)"/>
+         <substitution expression="&lt;category name=&quot;org.jboss.serial&quot;&gt;&#013;&#010;      &lt;priority value=&quot;INFO&quot;/&gt;&#013;&#010;   &lt;/category&gt;&#013;&#010;&#013;&#010;   \1"/>
+      </replaceregexp>
+
+
+      <!-- TODO: creating a server configuration breaks if whe have this enabled. Temporarily
+                 commenting it out, until I figure out why it breaks
+                 http://jira.jboss.org/jira/browse/JBMESSAGING-811
+      -->
+
+
+      <!-- Replace local TM with JBossTS -->
+
+      <!--
+      <copy file="${thirdparty.jbossts.home}/lib/jbossjta.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${thirdparty.jbossts.home}/lib/jbossjta-integration.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${thirdparty.jbossts.home}/lib/jbossts-common.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${lib.jbossts.home}/jbossjta-properties.xml"
+            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
+      <copy overwrite="true"
+            file="${lib.jbossts.home}/jboss-service.xml"
+            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
+      <copy file="${output.lib.home}/jboss-messaging-integration.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      -->
+
+      <!-- copy the scoped sar
+      <copy todir="${jboss.home}/server/${config.name}/deploy"
+            file="${relative.sar.location}/${messaging.sar.name}"/>
+      -->
+
+      <!-- we deploy the archive exploded so that users can easily access the configuration files -->
+      <condition property="is.sar" value="true">
+         <contains substring=".sar" string="${messaging.artifact.name}"/>
+      </condition>
+      <antcall target="expand-jar"/>
+      <antcall target="expand-sar"/>
+
+      <move todir="${jboss.home}/server/${config.name}/conf">
+          <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar">
+             <include name="messaging-*.properties"/>
+          </fileset>
+       </move>
+
+   </target>
+
+   <target name="expand-sar" if="is.sar">
+      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
+             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar">
+      </unjar>
+   </target>
+
+   <target name="expand-jar" unless="is.sar">
+      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
+             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+      </unjar>
+      <jar jarfile="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jboss-messaging.jar"
+           manifest="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF/MANIFEST.MF">
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging" includes="org/**,VERSION,aop-messaging*.xml"/>
+      </jar>
+      <delete>
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+            <include name="VERSION"/>
+            <include name="aop-messaging*.xml"/>
+         </fileset>
+      </delete>
+      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/org"/>
+      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF"/>
+
+      <move file="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jboss-messaging.jar"
+            todir="${jboss.home}/server/${config.name}/lib"/>
+      <move todir="${jboss.home}/server/${config.name}/conf/xmdesc">
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc">
+            <include name="*.xml"/>
+         </fileset>
+      </move>
+      <move todir="${jboss.home}/server/${config.name}/conf">
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+            <include name="messaging-*.properties"/>
+         </fileset>
+      </move>
+      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc"/>
+   </target>
+
+   <target name="enable-jndi-call-by-reference" if="naming.service.config.present">
+      <replaceregexp file="${naming.config.file}" flags="s">
+         <regexp pattern="\x3cattribute name=\x22CallByValue\x22\x3etrue\x3c/attribute\x3e"/>
+         <substitution expression="&lt;attribute name=&quot;CallByValue&quot;&gt;false&lt;/attribute&gt;"/>
+      </replaceregexp>
+   </target>
+
+   <target name="create-standalone-server-config" depends="validate-jboss, validate-messaging-artifact"
+           description="Creates a standalone Messaging server configuration based on a default JBoss instance">
+
+      <echo message="Creating Standalone Messaging configuration '${config.name}' for ${jboss.home} based on ${messaging.artifact.name}"/>
+
+      <mkdir dir="${jboss.home}/server/${config.name}/conf"/>
+      <mkdir dir="${jboss.home}/server/${config.name}/lib"/>
+      <mkdir dir="${jboss.home}/server/${config.name}/deploy"/>
+
+      <copy todir="${jboss.home}/server/${config.name}/conf">
+         <fileset dir="${jboss.home}/server/default/conf">
+            <include name="jboss-service.xml"/>
+            <include name="jndi.properties"/>
+            <include name="log4j.xml"/>
+            <include name="login-config.xml"/>
+            <include name="props/**"/>
+            <include name="xmdesc/**"/>
+         </fileset>
+      </copy>
+
+      <copy todir="${jboss.home}/server/${config.name}/deploy">
+         <fileset dir="${jboss.home}/server/default/deploy">
+            <include name="hsqldb-ds.xml"/>
+            <include name="jboss-local-jdbc.rar"/>
+            <include name="jbossjca-service.xml"/>
+            <include name="jbossweb-tomcat55.sar/**"/>
+            <include name="jmx-console.war/**"/>
+            <include name="jmx-invoker-service.xml"/>
+            <include name="management/**"/>
+            <include name="properties-service.xml"/>
+         </fileset>
+      </copy>
+
+      <copy todir="${jboss.home}/server/${config.name}/lib">
+         <fileset dir="${jboss.home}/server/default/lib">
+            <include name="commons*.jar"/>
+            <include name="hsqldb*.jar"/>
+            <include name="javax.servlet*.jar"/>
+            <include name="jboss-common-jdbc-wrapper.jar"/>
+            <include name="jboss-j2ee.jar"/>
+            <include name="jboss-jca.jar"/>
+            <include name="jboss-management.jar"/>
+            <include name="jboss-monitoring.jar"/>
+            <include name="jboss-transaction.jar"/>
+            <include name="jboss.jar"/>
+            <include name="jbosssx.jar"/>
+            <include name="jmx-adaptor-plugin.jar"/>
+            <include name="jnpserver.jar"/>
+            <include name="log4j.jar"/>
+            <include name="properties-plugin.jar"/>
+         </fileset>
+      </copy>
+
+      <!-- slim down jboss-service.xml -->
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.management.j2ee.LocalJBossServerDomain\x22.*jboss:service=CorbaORB\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.util.property.jmx.SystemPropertyClassValue\x22.*org.jboss.system.JBossRMIClassLoader\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.web.WebService\x22.*\x3cdepends optional-attribute-name=\x22ThreadPool\x22[ \t\n\r]*proxy-type=\x22attribute\x22\x3ejboss.system:service=ThreadPool\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.tm.usertx.server.ClientUserTransactionService\x22.*\x3cdepends\x3ejboss:service=invoker,type=jrmp\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e[ \t\n\r]*\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.invocation.pooled.server.PooledInvoker\x22.*\x3cdepends optional-attribute-name=\x22TransactionManagerService\x22\x3ejboss:service=TransactionManager\x3c/depends\x3e[ \t\n\r]*\x3c/mbean\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean code=\x22org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary\x22.*name=\x22jboss.jdbc:service=metadata\x22/\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <!-- customize login-config.xml -->
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3cpolicy\x3e)"/>
+         <substitution expression="\1 &lt;application-policy name = &quot;messaging&quot;&gt;
+         &lt;authentication&gt;&lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;
+            flag = &quot;required&quot; &gt;
+         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;
+         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;
+         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;
+         &lt;/login-module&gt;&lt;/authentication&gt;&lt;/application-policy&gt;"/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3cpolicy\x3e)"/>
+         <substitution expression="\1 &lt;application-policy name = &quot;messaging&quot;&gt;
+         &lt;authentication&gt;&lt;login-module code = &quot;org.jboss.security.auth.spi.UsersRolesLoginModule&quot;
+            flag = &quot;required&quot; &gt;
+         &lt;module-option name = &quot;unauthenticatedIdentity&quot;&gt;guest&lt;/module-option&gt;
+         &lt;module-option name = &quot;usersProperties&quot;&gt;messaging-users.properties&lt;/module-option&gt;
+         &lt;module-option name = &quot;rolesProperties&quot;&gt;messaging-roles.properties&lt;/module-option&gt;
+         &lt;/login-module&gt;&lt;/authentication&gt;&lt;/application-policy&gt;"/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3capplication-policy name = \x22jbossmq\x22\x3e.*FROM JMS_ROLES WHERE USERID=.\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3capplication-policy name = \x22jbossmq\x22\x3e.*jboss.mq:service=StateManager\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/login-config.xml" flags="s">
+         <regexp pattern="(\x3capplication-policy name=\x22JBossWS\x22\x3e.*\x3cmodule-option name=\x22unauthenticatedIdentity\x22\x3eanonymous\x3c/module-option\x3e[ \t\n\r]*\x3c/login-module\x3e[ \t\n\r]*\x3c/authentication\x3e[ \t\n\r]*\x3c/application-policy\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <!-- mute org.jboss.serial DEBUG -->
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/log4j.xml" flags="s">
+         <regexp pattern="(\x3croot\x3e)"/>
+         <substitution expression="&lt;category name=&quot;org.jboss.serial&quot;&gt;&#013;&#010;      &lt;priority value=&quot;INFO&quot;/&gt;&#013;&#010;   &lt;/category&gt;&#013;&#010;&#013;&#010;   \1"/>
+      </replaceregexp>
+
+      <!-- customize hsqldb-ds.xml -->
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/hsqldb-ds.xml" flags="s">
+         <regexp pattern="(\x3cmetadata\x3e[ \t\n\r]*\x3ctype-mapping\x3eHypersonic SQL\x3c/type-mapping\x3e[ \t\n\r]*\x3c/metadata\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <!-- get rid of the AJP connector -->
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/jbossweb-tomcat55.sar/server.xml" flags="s">
+         <regexp pattern="(\x3cConnector port=\x228009\x22.*protocol=\x22AJP/1.3\x22/\x3e)"/>
+         <substitution expression=""/>
+      </replaceregexp>
+
+      <!-- deploy exploded messaging -->
+
+      <unjar src="${main.artifact.location}/${messaging.artifact.name}"
+             dest="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+      </unjar>
+
+      <!-- un-scope the deployment -->
+
+      <move todir="${jboss.home}/server/${config.name}/lib">
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+            <include name="jboss-messaging.jar"/>
+            <include name="javassist.jar"/>
+            <include name="jboss-aop.jar"/>
+            <include name="jboss-aspect-library.jar"/>
+            <include name="jboss-common-softvaluehashmap.jar"/>
+            <include name="jboss-common-stream.jar"/>
+            <include name="jboss-remoting.jar"/>
+            <include name="jboss-serialization.jar"/>
+            <include name="jboss-unified-invocation.jar"/>
+            <include name="trove.jar"/>
+         </fileset>
+      </move>
+
+      <unjar src="${jboss.home}/server/${config.name}/lib/jboss-messaging.jar"
+             dest="${jboss.home}/server/${config.name}/conf">
+         <patternset>
+            <include name="xmdesc/**"/>
+         </patternset>
+      </unjar>
+
+      <move todir="${jboss.home}/server/${config.name}/conf">
+         <fileset dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging">
+            <include name="messaging-*.properties"/>
+         </fileset>
+      </move>
+
+      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/xmdesc"/>
+      <delete dir="${jboss.home}/server/${config.name}/deploy/jboss-messaging/META-INF"/>
+      <delete file="${jboss.home}/server/${config.name}/deploy/jboss-messaging/jms-ds.xml"/>
+
+   </target>
+
+   <target name="create-cluster-node-server-config">
+
+      <!--
+           Create the non-clustered configuration first.
+      -->
+      <antcall target="create-server-config"/>
+
+      <!--
+           Configure the apropriate port range.
+      -->
+      <antcall target="configure-service-binding-manager"/>
+
+      <!--
+           Adjust the node id
+      -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/messaging-service.xml" flags="s"
+         match="(\x3carg[ \t]type=\x22int\x22[ \t]*value=\x22).+?(\x22.*)" replace="\1${id}\2"/>
+
+      <!--
+           Replace HSQLDB with a LAN-shareable database.
+      -->
+      <echo message="Enabling ${database}"/>
+
+      <delete file="${jboss.home}/server/${config.name}/deploy/hsqldb-ds.xml" quiet="false" failonerror="true"/>
+      <copy file="${auxiliary.artifacts.location}/${database}-ds.xml" todir="${jboss.home}/server/${config.name}/deploy/"/>
+
+      <!--
+           We may not distribute the driver for availability or copyright reasons, so the driver
+           may not be under lib. We need to check and issue a warning if it isn't.
+      -->
+      <copy todir="${jboss.home}/server/${config.name}/lib">
+         <fileset dir="${auxiliary.lib.location}">
+            <include name="${database}-driver*.jar"/>
+         </fileset>
+      </copy>
+
+      <!--
+           Use clustered persistence configuration file.
+      -->
+
+      <delete file="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml" quiet="false" failonerror="true"/>
+      <copy file="${auxiliary.artifacts.location}/clustered-${database}-persistence-service.xml" todir="${jboss.home}/server/${config.name}/deploy/jboss-messaging.sar/"/>
+
+      <antcall target="warn-check-database-drivers"/>
+      <antcall target="warn-no-database-drivers"/>
+   </target>
+
+   <target name="warn-check-database-drivers" if="database.drivers.provided.by.us">
+<echo>
+
+
+
+                    ##########################
+                    #                        #
+                    #        WARNING!        #
+                    #                        #
+                    ##########################
+
+
+ The configuration that has just been created uses a generic ${database} service descriptor!
+
+ Check
+
+      ${jboss.home}/server/${config.name}/deploy/${database}-ds.xml
+
+ and make sure that:
+
+ 1. Your database is indeed ${database}.
+ 2. It is accessible from every physical node you installed Messaging on.
+ 3. Contains a schema (database/tablespace) named 'messaging'.
+ 4. The URL (hostname and port), username and password and other connect information are correct.
+ 5. The installed ${database}-driver.jar's version maches your database.
+
+
+
+
+</echo>
+   </target>
+
+   <target name="warn-no-database-drivers" unless="database.drivers.provided.by.us">
+<echo>
+
+
+
+                    ##########################
+                    #                        #
+                    #        WARNING!        #
+                    #                        #
+                    ##########################
+
+
+ The configuration that has just been created uses a generic ${database} service descriptor!
+
+ Check
+
+      ${jboss.home}/server/${config.name}/deploy/${database}-ds.xml
+
+ and make sure that:
+
+ 1. Your database is indeed ${database}.
+ 2. It is accessible from every physical node you installed Messaging on.
+ 3. Contains a schema (database/tablespace) named 'messaging'.
+ 4. The URL (hostname and port), username and password and other connect information are correct.
+
+
+                    ##########################
+                    #                        #
+                    #    ANOTHER WARNING!    #
+                    #                        #
+                    ##########################
+
+
+
+       NO DATABASE DRIVERS HAVE BEEN INSTALLED! YOU STILL NEED
+       T0 INSTALL THE APROPRIATE ${database} DATABASE DRIVERS IN
+       ${jboss.home}/server/${config.name}/lib
+
+
+
+
+</echo>
+   </target>
+
+   <target name="configure-service-binding-manager" if="ports">
+
+      <!--
+          Enable the service binding manager, by deleting XML comment tags.
+      -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean[ \t]*code=\x22org.jboss.services.binding.ServiceBindingManager\x22.+org.jboss.services.binding.XMLServicesStoreFactory[ \t\n\r]*\x3c/attribute\x3e[ \t\n\r]*\x3c/mbean\x3e[ \t\n\r]*)--\x3e"/>
+         <substitution expression="--&gt;&#013;&#010;&#013;&#010;   \1"/>
+      </replaceregexp>
+
+      <!--
+          Use the server configuration specified as "ports" system property
+      -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cattribute[ \t]*name=\x22ServerName\x22\x3e)ports-01(\x3c/attribute\x3e)"/>
+         <substitution expression="\1${ports}\2"/>
+      </replaceregexp>
+
+      <!--
+          Configure jboss-service.xml to use a local copy of sample-bindings.xml
+      -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cattribute[ \t]*name=\x22StoreURL\x22\x3e)\x24\x7bjboss.home.url\x7d/docs/examples/binding-manager/sample-bindings.xml(\x3c/attribute\x3e)"/>
+         <substitution expression="\1${jboss.server.config.url}/binding-manager.xml\2"/>
+      </replaceregexp>
+
+      <!--
+          The above regular expression won't match some older JBoss configurations (such as
+          4.0.1sp1), so trying with an alternate expression.
+      -->
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cattribute[ \t]*name=\x22StoreURL\x22\x3e)../docs/examples/binding-manager/sample-bindings.xml(\x3c/attribute\x3e)"/>
+         <substitution expression="\1../server/${config.name}/conf/binding-manager.xml\2"/>
+      </replaceregexp>
+
+      <!--
+          Some installer-generated installations (JBoss 4.0.3, JBoss 4.0.3.SP1) do not contain
+          a BindingManager declaration at all, so we need to insert it by ourselves.
+      -->
+      <loadfile property="jboss-service.xml-content"
+                srcFile="${jboss.home}/server/${config.name}/conf/jboss-service.xml"/>
+
+      <condition property="binding.manager.declared">
+         <contains string="${jboss-service.xml-content}" substring="org.jboss.services.binding.ServiceBindingManager"/>
+      </condition>
+
+      <antcall target="insert-service-binding-manager-configuration"/>
+
+      <!--
+          Actually copy the file
+      -->
+      <copy file="${jboss.home}/docs/examples/binding-manager/sample-bindings.xml"
+            tofile="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
+
+      <!--
+          Add remoting binding manager overrides in ${config.name}/conf/binding-manager.xml
+      -->
+      <replace-messaging-connector-override server-name="ports-default" port="4457" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
+      <replace-messaging-connector-override server-name="ports-01" port="4557" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
+      <replace-messaging-connector-override server-name="ports-02" port="4657" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
+      <replace-messaging-connector-override server-name="ports-03" port="4757" binding-manager-file="${jboss.home}/server/${config.name}/conf/binding-manager.xml"/>
+
+   </target>
+
+   <target name="insert-service-binding-manager-configuration" unless="binding.manager.declared">
+
+      <replaceregexp file="${jboss.home}/server/${config.name}/conf/jboss-service.xml" flags="s">
+         <regexp pattern="(\x3cmbean[ \t]*code=\x22org.jboss.logging.Log4jService\x22.*?\x3c/mbean\x3e)"/>
+         <substitution expression="\1
+&#013;&#010;&#013;&#010;
+  &lt;mbean code=&quot;org.jboss.services.binding.ServiceBindingManager&quot;&#013;&#010;
+         name=&quot;jboss.system:service=ServiceBindingManager&quot;&gt;&#013;&#010;
+     &lt;attribute name=&quot;ServerName&quot;&gt;${ports}&lt;/attribute&gt;&#013;&#010;
+     &lt;attribute name=&quot;StoreURL&quot;&gt;${jboss.server.config.url}/binding-manager.xml&lt;/attribute&gt;&#013;&#010;
+     &lt;attribute name=&quot;StoreFactoryClassName&quot;&gt;&#013;&#010;
+        org.jboss.services.binding.XMLServicesStoreFactory&#013;&#010;
+     &lt;/attribute&gt;&#013;&#010;
+  &lt;/mbean&gt;"/>
+      </replaceregexp>
+
+   </target>
+
+   <macrodef name="replace-messaging-connector-override">
+      <attribute name="server-name"/>
+      <attribute name="port"/>
+      <attribute name="binding-manager-file"/>
+      <sequential>
+         <!--
+             If configuration override already exists, replace it with the correct one.
+         -->
+         <replaceregexp file="@{binding-manager-file}" flags="s">
+            <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3cservice-config[ \t]*name=\x22jboss.messaging:service=Connector,transport=)(.*?)(\x3c/service-config\x3e)(.*?)(\x3c/server\x3e)"/>
+            <substitution expression="\1\2&#013;&#010;      &lt;service-config name=&quot;jboss.messaging:service=Connector,transport=bisocket&quot;&#013;&#010;
+                     delegateClass=&quot;org.jboss.services.binding.AttributeMappingDelegate&quot;&gt;&#013;&#010;
+        &lt;delegate-config&gt;&#013;&#010;
+           &lt;attribute name=&quot;InvokerLocator&quot;&gt;bisocket://${jboss.bind.address}:@{port}/?NumberOfCallRetries=2&#038;amp;clientMaxPoolSize=50&#038;amp;clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&#038;amp;dataType=jms&#038;amp;marshaller=org.jboss.jms.server.remoting.JMSWireFormat&#038;amp;numberOfRetries=1&#038;amp;serializationtype=jms&#038;amp;socket.check_connection=false&#038;amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&lt;/attribute&gt;&#010;
+        &lt;/delegate-config&gt;&#013;&#010;
+        &lt;binding port=&quot;@{port}&quot;/&gt;&#013;&#010;
+    &lt;/service-config&gt;\6\7"/>
+         </replaceregexp>
+
+         <!--
+             If we don't find any configuration after replacement, then it means it didn't exist
+             in the first place, so add a new one
+         -->
+
+         <loadfile property="binding.manager.xml.content"
+                   srcFile="@{binding-manager-file}"/>
+
+         <condition property="messaging.connector.override.exists">
+            <matches string="${binding.manager.xml.content}" singleline="true">
+               <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3cservice-config[ \t]*name=\x22jboss.messaging:service=Connector,transport=)(.*?)@{port}(.*?)(\x3c/service-config\x3e)(.*?)(\x3c/server\x3e)"/>
+            </matches>
+         </condition>
+         <echo message="override exists: ${messaging.connector.override.exists}"/>
+
+         <antcall target="add-messaging-connector-override-if-not-already-there">
+            <param name="local.server.name" value="@{server-name}"/>
+            <param name="local.port" value="@{port}"/>
+            <param name="local.binding.manager.file" value="@{binding-manager-file}"/>
+         </antcall>
+
+      </sequential>
+   </macrodef>
+
+   <macrodef name="add-messaging-connector-override">
+      <attribute name="server-name"/>
+      <attribute name="port"/>
+      <attribute name="binding-manager-file"/>
+      <sequential>
+         <replaceregexp file="@{binding-manager-file}" flags="s">
+            <regexp pattern="(\x3cserver[ \t]*name=\x22@{server-name}\x22\x3e)(.*?)(\x3c/server\x3e)"/>
+            <!--
+                 note: substitution expression mst be identical with the one in
+                 replace-messaging-connector-override, with &#013;&#010;   \3 at the end instead of
+                 \6\7
+            -->
+            <substitution expression="\1\2&#013;&#010;      &lt;service-config name=&quot;jboss.messaging:service=Connector,transport=bisocket&quot;&#013;&#010;
+                     delegateClass=&quot;org.jboss.services.binding.AttributeMappingDelegate&quot;&gt;&#013;&#010;
+        &lt;delegate-config&gt;&#013;&#010;
+           &lt;attribute name=&quot;InvokerLocator&quot;&gt;bisocket://${jboss.bind.address}:@{port}/?NumberOfCallRetries=2&#038;amp;clientMaxPoolSize=50&#038;amp;clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&#038;amp;dataType=jms&#038;amp;marshaller=org.jboss.jms.server.remoting.JMSWireFormat&#038;amp;numberOfRetries=1&#038;amp;serializationtype=jms&#038;amp;socket.check_connection=false&#038;amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat&lt;/attribute&gt;&#010;
+        &lt;/delegate-config&gt;&#013;&#010;
+        &lt;binding port=&quot;@{port}&quot;/&gt;&#013;&#010;
+    &lt;/service-config&gt;&#013;&#010;   \3"/>
+         </replaceregexp>
+      </sequential>
+   </macrodef>
+
+   <target name="add-messaging-connector-override-if-not-already-there" unless="messaging.connector.override.exists">
+      <add-messaging-connector-override server-name="${local.server.name}" port="${local.port}" binding-manager-file="${local.binding.manager.file}"/>
+   </target>
+
+   <macrodef name="set-config-name">
+      <attribute name="base"/>
+      <attribute name="suffix"/>
+      <sequential>
+         <condition property="config.name" value="@{base}-@{suffix}" else="@{base}">
+            <length string="@{suffix}" when="greater" length="0"/>
+         </condition>
+      </sequential>
+   </macrodef>
+
+   <target name="dump">
+      <echo message="jboss.home=${jboss.home}"/>
+      <echo message="messaging.config.name=${messaging.config.name}"/>
+      <echo message="main.artifact.location=${main.artifact.location}"/>
+   </target>
+
+   <target name="test" depends="validate-ant">
+   </target>
+
+</project>
+




More information about the jboss-cvs-commits mailing list