[Jboss-cvs] JBossAS SVN: r56316 - in branches/JBoss_4_0_3_SP1_CP: common/src/main/org/jboss/util/threadpool common/src/main/org/jboss/util/timeout messaging/src/main/org/jboss/mq messaging/src/main/org/jboss/mq/il/http messaging/src/main/org/jboss/mq/il/jvm messaging/src/main/org/jboss/mq/il/uil2 messaging/src/main/org/jboss/mq/il/uil2/msgs messaging/src/main/org/jboss/mq/pm messaging/src/main/org/jboss/mq/pm/jdbc2 messaging/src/main/org/jboss/mq/server messaging/src/main/org/jboss/mq/server/jmx server/src/main/org/jboss/jms testsuite/imports testsuite/src/main/org/jboss/test/jbossmq/test testsuite/src/resources/jbossmq varia/src/main/org/jboss/mq/il/http/servlet

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Aug 27 22:08:17 EDT 2006


Author: ryan.campbell at jboss.com
Date: 2006-08-27 22:08:12 -0400 (Sun, 27 Aug 2006)
New Revision: 56316

Removed:
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/HashedTimeoutPriorityQueueImpl.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutExt.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueue.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueueImpl.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Recoverable.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/RecoverMsg.java
   branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/jms/recovery/
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicReceiveUnitTestCase.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicSendUnitTestCase.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueReceiveUnitTestCase.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueSendUnitTestCase.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryTest.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/resources/jbossmq/jbossmq-recovery-service.xml
Modified:
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicTaskWrapper.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPool.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPoolMBean.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BlockingMode.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/MinPooledExecutor.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/RunnableTaskWrapper.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/StartTimeoutException.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/Task.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskStoppedException.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskWrapper.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPool.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolFullException.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolMBean.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolStoppedException.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/Timeout.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutFactory.java
   branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutTarget.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/AcknowledgementRequest.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Connection.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/JBossMQXid.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyConnection.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyJMSException.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyMessage.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAConnection.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAException.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResource.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResourceManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/http/HTTPServerIL.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/jvm/JVMServerIL.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManagerHandler.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientIL.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientILService.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerIL.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILFactory.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILServiceMBean.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AcknowledgementRequestMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AddMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BaseMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BrowseMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckIDMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckUserMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CloseMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ConnectionTokenMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CreateDestMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteSubscriptionMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteTemporaryDestMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DynCircularBuffer.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/EnableConnectionMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/GetIDMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/MsgTypes.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/PingMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveRequestMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/SubscribeMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TemporaryDestMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TransactMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/UnsubscribeMsg.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/Tx.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/TxManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueue.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueueParameters.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestination.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSQueue.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInterceptorSupport.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInvoker.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSTopic.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/TracingInterceptor.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManager.java
   branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManagerMBean.java
   branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml
   branches/JBoss_4_0_3_SP1_CP/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java
Log:
revert JBAS-3259: JBossMQ XA Recovery

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicTaskWrapper.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicTaskWrapper.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicTaskWrapper.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 import org.jboss.logging.Logger;
@@ -427,30 +413,4 @@
    // Private -------------------------------------------------------
 
    // Inner classes -------------------------------------------------
-   
-   /**
-    * Get the state as a string
-    * 
-    * @return the state string
-    */
-   protected String getStateString()
-   {
-      switch (state)
-      {
-         case TASK_NOT_ACCEPTED:
-            return "NOT_ACCEPTED";
-         case TASK_REJECTED:
-            return "REJECTED";
-         case TASK_ACCEPTED:
-            return "ACCEPTED";
-         case TASK_STARTED:
-            return "STARTED";
-         case TASK_STOPPED:
-            return "STOPPED";
-         case TASK_COMPLETED:
-            return "COMPLETED";
-         default:
-            return "???";
-      }
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPool.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPool.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPool.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 import java.util.Collections;
@@ -73,7 +59,7 @@
    private BoundedLinkedQueue queue;
 
    /** The thread group */
-   private ThreadGroup threadGroup;
+   private ThreadGroup threadGroup = JBOSS_THREAD_GROUP;
 
    /** The last thread number */
    private SynchronizedInt lastThreadNumber = new SynchronizedInt(0);
@@ -92,7 +78,7 @@
    // Constructors --------------------------------------------------
 
    /**
-    * Constructs a new thread pool
+    * Create a new thread pool
     */
    public BasicThreadPool()
    {
@@ -100,25 +86,13 @@
    }
 
    /**
-    * Constructs a new thread pool with a default queue size of 1024, max pool
-    * size of 100, min pool size of 100, and a keep alive of 60 seconds.
+    * Create a new thread pool with a default queue size of 1024, min/max pool
+    * sizes of 100 and a keep alive of 60 seconds.
     *
     * @param name the pool name
     */
    public BasicThreadPool(String name)
    {
-      this(name, JBOSS_THREAD_GROUP);
-   }
-
-   /**
-    * Constructs a new thread pool with a default queue size of 1024, max pool
-    * size of 100, min pool size of 100, and a keep alive of 60 seconds.
-    *
-    * @param name the pool name
-    * @param threadGroup threadGroup
-    */
-   public BasicThreadPool(String name, ThreadGroup threadGroup)
-   {
       trace = log.isTraceEnabled();
       ThreadFactory factory = new ThreadPoolThreadFactory();
 
@@ -132,7 +106,6 @@
 
       poolNumber = lastPoolNumber.increment();
       setName(name);
-      this.threadGroup = threadGroup;
    }
 
    // Public --------------------------------------------------------
@@ -205,18 +178,12 @@
    {
       run(runnable, 0, 0);
    }
-
    public void run(Runnable runnable, long startTimeout, long completeTimeout)
    {
       RunnableTaskWrapper wrapper = new RunnableTaskWrapper(runnable, startTimeout, completeTimeout);
       runTaskWrapper(wrapper);      
    }
 
-   public ThreadGroup getThreadGroup()
-   {
-      return threadGroup;
-   }
-
    // ThreadPoolMBean implementation --------------------------------
 
    public String getName()

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPoolMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPoolMBean.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BasicThreadPoolMBean.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BlockingMode.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BlockingMode.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/BlockingMode.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource J2EE webOS
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.util.threadpool;
 

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/MinPooledExecutor.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/MinPooledExecutor.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/MinPooledExecutor.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource J2EE webOS
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.util.threadpool;
 
@@ -63,7 +48,7 @@
    /**
     * Construct a new executor
     * 
-    * @param poolSize the maximum pool size
+    * @param poolSize the minimum pool size
     */
    public MinPooledExecutor(int poolSize)
    {
@@ -74,7 +59,7 @@
     * Construct a new executor
     * 
     * @param channel the queue for any requests
-    * @param poolSize the maximum pool size
+    * @param poolSize the minimum pool size
     */
    public MinPooledExecutor(Channel channel, int poolSize)
    {

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/RunnableTaskWrapper.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/RunnableTaskWrapper.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/RunnableTaskWrapper.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 import org.jboss.logging.Logger;

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/StartTimeoutException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/StartTimeoutException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/StartTimeoutException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/Task.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/Task.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/Task.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskStoppedException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskStoppedException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskStoppedException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskWrapper.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskWrapper.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/TaskWrapper.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPool.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPool.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPool.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolFullException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolFullException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolFullException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolMBean.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolMBean.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolStoppedException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolStoppedException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/threadpool/ThreadPoolStoppedException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,10 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ */
 package org.jboss.util.threadpool;
 
 /**

Deleted: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/HashedTimeoutPriorityQueueImpl.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/HashedTimeoutPriorityQueueImpl.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/HashedTimeoutPriorityQueueImpl.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,757 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.util.timeout;
-
-import org.jboss.util.JBossStringBuilder;
-
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
-/**
- * HashedTimeoutPriorityQueueImpl.
- *
- *  This is a balanced binary tree. If nonempty, the root is at index 1,
- *  and all nodes are at indices 1..size. Nodes with index greater than
- *  size are null. Index 0 is never used.
- *  Children of the node at index <code>j</code> are at <code>j*2</code>
- *  and <code>j*2+1</code>. The children of a node always fire the timeout
- *  no earlier than the node.
- *
- *
- *  Or, more formally:
- *
- *  Only indices <code>1</code>..<code>size</code> of this array are used.
- *  All other indices contain the null reference.
- *  This array represent a balanced binary tree.
- *
- *  If <code>size</code> is <code>0</code> the tree is empty, otherwise
- *  the root of the tree is at index <code>1</code>.
- *
- *  Given an arbitrary node at index <code>n</code> that is not the root
- *  node, the parent node of <code>n</code> is at index <code>n/2</code>.
- *
- *  Given an arbitrary node at index <code>n</code>; if
- *  <code>2*n <= size</code> the node at <code>n</code> has its left child
- *  at index <code>2*n</code>, otherwise the node at <code>n</code> has
- *  no left child.
- *
- *  Given an arbitrary node at index <code>n</code>; if
- *  <code>2*n+1 <= size</code> the node at <code>n</code> has its right child
- *  at index <code>2*n+1</code>, otherwise the node at <code>n</code> has
- *  no right child.
- *
- *  The priority function is called T. Given a node <code>n</code>,
- *  <code>T(n)</code> denotes the absolute time (in milliseconds since
- *  the epoch) that the timeout for node <code>n</code> should happen.
- *  Smaller values of <code>T</code> means higher priority.
- *
- *  The tree satisfies the following invariant:
- *  <i>
- *  For any node <code>n</code> in the tree:
- *  If node <code>n</code> has a left child <code>l</code>,
- *  <code>T(n) <= T(l)</code>.
- *  If node <code>n</code> has a right child <code>r</code>,
- *  <code>T(n) <= T(r)</code>.
- *  </i>
- *
- *
- *  The invariant may be temporarily broken while executing synchronized
- *  on <code>this</code> instance, but is always reestablished before
- *  leaving the synchronized code.
- *
- *  The node at index <code>1</code> is always the first node to timeout,
- *  as can be deduced from the invariant.
- *
- *  For the following algorithm pseudocode, the operation
- *  <code>swap(n,m)</code> denotes the exchange of the nodes at indices
- *  <code>n</code> and <code>m</code> in the tree.
- *
- *  Insertion of a new node happend as follows:
- *  <pre>
- *    IF size = q.length THEN
- *      "expand q array to be larger";
- *    ENDIF
- *    size <- size + 1;
- *    q[size] <- "new node";
- *    n <- size;
- *    WHILE n > 1 AND T(n/2) > T(n) DO
- *      swap(n/2, n);
- *      n <- n/2;
- *    ENDWHILE
- *  </pre>
- *  Proof that this insertion algorithm respects the invariant is left to
- *  the interested reader.
- *
- *  The removal algorithm is a bit more complicated. To remove the node
- *  at index <code>n</code>:
- *  <pre>
- *    swap(n, size);
- *    size <- size - 1;
- *    IF n > 1 AND T(n/2) > T(n) THEN
- *      WHILE n > 1 AND T(n/2) > T(n) DO
- *        swap(n/2, n);
- *        n <- n/2;
- *      ENDWHILE
- *    ELSE
- *      WHILE 2*n <= size DO
- *        IF 2*n+1 <= size THEN
- *          // Both children present
- *          IF T(2*n) <= T(2*n+1) THEN
- *            IF T(n) <= T(2*n) THEN
- *              EXIT;
- *            ENDIF
- *            swap(n, 2*n);
- *            n <- 2*n;
- *          ELSE
- *            IF T(n) <= T(2*n+1) THEN
- *              EXIT;
- *            ENDIF
- *            swap(n, 2*n+1);
- *            n <- 2*n+1;
- *          ENDIF
- *        ELSE
- *          // Only left child, right child not present.
- *          IF T(n) <= T(2*n) THEN
- *            EXIT;
- *          ENDIF
- *          swap(n, 2*n);
- *          n <- 2*n;
- *        ENDIF
- *      ENDWHILE
- *    ENDIF
- *  </pre>
- *  Proof that this removal algorithm respects the invariant is left to
- *  the interested reader. Really, I am not going to prove it here.
- *
- *  If you are interested, you can find this data structure and its
- *  associated operations in most textbooks on algorithmics.
- *
- *  @see checkTree
- * 
- * @author <a href="osh at sparre.dk">Ole Husgaard</a>
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="genman at maison-otaku.net">Elias Ross</a>  
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class HashedTimeoutPriorityQueueImpl implements TimeoutPriorityQueue
-{
-   //  Code commented out with the mark "INV:" are runtime checks
-   //  of invariants that are not needed for a production system.
-   //  For problem solving, you can remove these comments.
-   //  Multithreading notes:
-   //
-   //  While a TimeoutImpl is enqueued, its index field contains the index
-   //  of the instance in the queue; that is, for 1 <= n <= size,
-   //  q[n].index = n.
-   //  Modifications of an enqueued TimeoutImpl instance may only happen
-   //  in code synchronized on the TimeoutFactory instance that has it
-   //  enqueued.
-   //  Modifications on the priority queue may only happen while running in
-   //  code synchronized on the TimeoutFactory instance that holds the queue.
-   //  When a TimeoutImpl instance is no longer enqueued, its index field
-   //  changes to one of the negative constants declared in the TimeoutImpl
-   //  class.
-   //
-   //  Cancellation may race with the timeout.
-   //  To avoid problems with this, the TimeoutImpl index field is set to
-   //  TimeoutImpl.TIMEOUT when the TimeoutImpl is taken out of the queue.
-   //  Finally the index field is set to TimeoutImpl.DONE, and
-   //  the TimeoutImpl instance is discarded.
-
-   /** The lock object */
-   private Object topLock = new Object();
-
-   /** The top element */
-   private TimeoutExtImpl top;
-   
-   /** The hashed queues */
-   private InternalPriorityQueue[] queues;
-
-   private SynchronizedBoolean cancelled = new SynchronizedBoolean(false);
-   
-   /**
-    * Create a new TimeoutPriorityQueueImpl.
-    */
-   public HashedTimeoutPriorityQueueImpl()
-   {
-      queues = new InternalPriorityQueue[40];
-      for (int i = 0; i < queues.length; ++ i)
-         queues[i] = new InternalPriorityQueue();
-   }
-
-   public TimeoutExt offer(long time, TimeoutTarget target)
-   {
-      if (cancelled.get())
-         throw new IllegalStateException("TimeoutPriorityQueue has been cancelled");
-      if (time < 0)
-         throw new IllegalArgumentException("Negative time");
-      if (target == null)
-         throw new IllegalArgumentException("Null timeout target");
-
-      TimeoutExtImpl timeout = new TimeoutExtImpl();
-      timeout.time = time;
-      timeout.target = target;
-      int index = timeout.hashCode() % queues.length;
-      return queues[index].offer(timeout);
-   }
-
-   public TimeoutExt take()
-   {
-      return poll(-1);
-   }
-
-   public TimeoutExt poll()
-   {
-      return poll(1);
-   }
-   
-   public TimeoutExt poll(long wait)
-   {
-      long endWait = -1;
-      if (wait > 0)
-         endWait = System.currentTimeMillis() + wait;
-      // Look for work
-      synchronized (topLock)
-      {
-         while (cancelled.get() == false && (wait >= 0 || endWait == -1))
-         {
-            if (top == null)
-            {
-               try
-               {
-                  if (endWait == -1)
-                     topLock.wait();
-                  else
-                     topLock.wait(wait);
-               }
-               catch (InterruptedException ex)
-               {
-               }
-            }
-            else
-            {
-               long now = System.currentTimeMillis();
-               if (top.time > now)
-               {
-                  long waitForFirst = top.time - now;
-                  if (endWait != -1 && waitForFirst > wait)
-                     waitForFirst = wait;
-                  try
-                  {
-                     topLock.wait(waitForFirst);
-                  }
-                  catch (InterruptedException ex)
-                  {
-                  }
-               }
-               if (cancelled.get() == false && top != null && top.time <= System.currentTimeMillis())
-               {
-                  TimeoutExtImpl result = top;
-                  result.queue = null;
-                  result.index = TimeoutExtImpl.TIMEOUT;
-                  top = null;
-                  recalculateTop(false);
-                  return result;
-               }
-            }
-            if (endWait != -1)
-               wait = endWait - System.currentTimeMillis();
-         }
-      }
-      return null;
-   }
-   
-   public TimeoutExt peek()
-   {
-      synchronized (topLock)
-      {
-         return top;
-      }
-   }
-
-   public boolean remove(TimeoutExt timeout)
-   {
-      TimeoutExtImpl timeoutImpl = (TimeoutExtImpl) timeout;
-      
-      // Fast way of doing it
-      InternalPriorityQueue queue = timeoutImpl.queue;
-      if (queue != null && queue.remove(timeoutImpl))
-         return true;
-
-      synchronized (topLock)
-      {
-         // Check the top element
-         if (top == timeout)
-         {
-            top.done();
-            top = null;
-            recalculateTop(true);
-            return true;
-         }
-         
-         // Double check, it might have been the top then
-         // just got moved back into the queue
-         queue = timeoutImpl.queue;
-         if (queue != null)
-            return queue.remove(timeoutImpl);
-      }
-      return false;
-   }
-
-   public void clear()
-   {
-      synchronized (topLock)
-      {
-         if (cancelled.get())
-            return;
-         
-         // cleanup queues
-         for (int i = 1; i < queues.length; ++i)
-            queues[i].clear();
-
-         // cleanup the top
-         top = cleanupTimeoutExtImpl(top);
-      }
-   }
-
-   public void cancel()
-   {
-      synchronized (topLock)
-      {
-         if (cancelled.get())
-            return;
-
-         clear();
-         topLock.notifyAll();
-      }
-   }
-
-   public int size()
-   {
-      int size = 0; 
-      if (top != null)
-         size =1;
-      for (int i = 0; i < queues.length; ++i)
-         size += queues[i].size();
-      return size;
-   }
-   
-   /**
-    * Whether the queue is cancelled
-    * 
-    * @return true when cancelled
-    */
-   public boolean isCancelled()
-   {
-      return cancelled.get();
-   }
-
-   private void recalculateTop(boolean notify)
-   {
-      for (int i = 0; i < queues.length; ++i)
-         queues[i].compareAndSwapWithTop(notify);
-   }
-
-   /**
-    * Recursive cleanup of a TimeoutImpl
-    * 
-    * @return null
-    */
-   private TimeoutExtImpl cleanupTimeoutExtImpl(TimeoutExtImpl timeout)
-   {
-      if (timeout != null)
-         timeout.target = null;
-      return null;
-   }
-
-   /**
-    * Debugging helper.
-    */
-   private void assertExpr(boolean expr)
-   {
-      if (!expr)
-         throw new IllegalStateException("***** assert failed *****");
-   }
-
-   /**
-    * Internal priority queue
-    */
-   private class InternalPriorityQueue
-   {
-      /** The lock object */
-      private Object lock = new Object();
-
-      /** The size of the timeout queue. */
-      private int size;
-
-      /** The timeouts */
-      private TimeoutExtImpl[] queue;
-
-      /**
-       * Create a new InternalPriorityQueue.
-       */
-      InternalPriorityQueue()
-      {
-         queue = new TimeoutExtImpl[16];
-         size = 0;
-      }
-
-      TimeoutExt offer(TimeoutExtImpl timeout)
-      {
-         boolean checkTop = false;
-         synchronized (lock)
-         {
-            // INV: checkTree();
-            // INV: assertExpr(size < queue.length);
-            if (++size == queue.length)
-            {
-               TimeoutExtImpl[] newQ = new TimeoutExtImpl[2 * queue.length];
-               System.arraycopy(queue, 0, newQ, 0, queue.length);
-               queue = newQ;
-            }
-            // INV: assertExpr(size < queue.length);
-            // INV: assertExpr(queue[size] == null);
-            queue[size] = timeout;
-            timeout.queue = this;
-            timeout.index = size;
-            normalizeUp(size);
-            if (timeout.index == 1)
-               checkTop = true;
-            // INV: checkTree();
-         }
-         if (checkTop)
-         {
-            synchronized (topLock)
-            {
-               compareAndSwapWithTop(true);
-            }
-         }
-         return timeout;
-      }
-
-      boolean compareAndSwapWithTop(boolean notify)
-      {
-         synchronized (lock)
-         {
-            if (size == 0)
-               return false;
-
-            if (top == null)
-            {
-               top = removeNode(1);
-               top.queue = null;
-               top.index = TimeoutExtImpl.TOP;
-               if (notify)
-                  topLock.notify();
-               return top != null;
-            }
-            
-            if (top.time > queue[1].time)
-            {
-               TimeoutExtImpl temp = top;
-               top = queue[1];
-               top.queue = null;
-               top.index = TimeoutExtImpl.TOP;
-               queue[1] = temp;
-               temp.queue = this;
-               temp.index = 1;
-               if (size > 1)
-                  normalizeDown(1);
-               if (notify)
-                  topLock.notify();
-            }
-         }
-         return false;
-      }
-      
-      boolean remove(TimeoutExt timeout)
-      {
-         synchronized (lock)
-         {
-            TimeoutExtImpl timeoutImpl = (TimeoutExtImpl) timeout;
-            if (timeoutImpl.queue == this && timeoutImpl.index > 0)
-            {
-               // Active timeout, remove it.
-               // INV: assertExpr(queue[timeoutImpl.index] == timeout);
-               // INV: checkTree();
-               removeNode(timeoutImpl.index);
-               // INV: checkTree();
-               timeoutImpl.queue = null;
-               timeoutImpl.index = TimeoutExtImpl.DONE;
-
-               // execution cancelled
-               return true;
-            }
-            else
-            {
-               // has already been executed (DONE) or
-               // is currently executing (TIMEOUT)
-               return false;
-            }
-         }
-      }
-
-      public void clear()
-      {
-         synchronized (lock)
-         {
-            if (cancelled.get())
-               return;
-
-            // cleanup queue
-            for (int i = 1; i <= size; ++i)
-               queue[i] = cleanupTimeoutExtImpl(queue[i]);
-         }
-      }
-
-      public void cancel()
-      {
-         synchronized (lock)
-         {
-            if (cancelled.get())
-               return;
-            clear();
-         }
-      }
-
-      public int size()
-      {
-         return size;
-      }
-
-      /**
-       *  A new node has been added at index <code>index</code>.
-       *  Normalize the tree by moving the new node up the tree.
-       *
-       *  @return true if the tree was modified.
-       */
-      private boolean normalizeUp(int index)
-      {
-         // INV: assertExpr(index > 0);
-         // INV: assertExpr(index <= size);
-         // INV: assertExpr(queue[index] != null);
-         if (index == 1)
-            return false; // at root
-         boolean ret = false;
-         long t = queue[index].time;
-         int p = index >> 1;
-         while (queue[p].time > t)
-         {
-            // INV: assertExpr(queue[index].time == t);
-            swap(p, index);
-            ret = true;
-            if (p == 1)
-               break; // at root
-            index = p;
-            p >>= 1;
-         }
-         return ret;
-      }
-      
-      void normalizeDown(int index)
-      {
-         long t = queue[index].time;
-         int c = index << 1;
-         while (c <= size)
-         {
-            // INV: assertExpr(q[index].time == t);
-            TimeoutExtImpl l = queue[c];
-            // INV: assertExpr(l != null);
-            // INV: assertExpr(l.index == c);
-            if (c + 1 <= size)
-            {
-               // two children, swap with smallest
-               TimeoutExtImpl r = queue[c + 1];
-               // INV: assertExpr(r != null);
-               // INV: assertExpr(r.index == c+1);
-               if (l.time <= r.time)
-               {
-                  if (t <= l.time)
-                     break; // done
-                  swap(index, c);
-                  index = c;
-               }
-               else
-               {
-                  if (t <= r.time)
-                     break; // done
-                  swap(index, c + 1);
-                  index = c + 1;
-               }
-            }
-            else
-            { // one child
-               if (t <= l.time)
-                  break; // done
-               swap(index, c);
-               index = c;
-            }
-            c = index << 1;
-         }
-      }
-
-      /**
-       * Swap two nodes in the tree.
-       * 
-       * @param a the first index
-       * @param b the second index
-       */
-      private void swap(int a, int b)
-      {
-         // INV: assertExpr(a > 0);
-         // INV: assertExpr(a <= size);
-         // INV: assertExpr(b > 0);
-         // INV: assertExpr(b <= size);
-         // INV: assertExpr(queue[a] != null);
-         // INV: assertExpr(queue[b] != null);
-         // INV: assertExpr(queue[a].index == a);
-         // INV: assertExpr(queue[b].index == b);
-         TimeoutExtImpl temp = queue[a];
-         queue[a] = queue[b];
-         queue[a].index = a;
-         queue[b] = temp;
-         queue[b].index = b;
-      }
-
-      /**
-       * Remove a node from the tree and normalize.
-       *
-       * @param index the index in the queue
-       * @return the removed node.
-       */
-      private TimeoutExtImpl removeNode(int index)
-      {
-         // INV: assertExpr(index > 0);
-         // INV: assertExpr(index <= size);
-         TimeoutExtImpl res = queue[index];
-         // INV: assertExpr(res != null);
-         // INV: assertExpr(res.index == index);
-         if (index == size)
-         {
-            --size;
-            queue[index] = null;
-            return res;
-         }
-         swap(index, size); // Exchange removed node with last leaf node
-         --size;
-         // INV: assertExpr(res.index == size + 1);
-         queue[res.index] = null;
-         if (normalizeUp(index))
-            return res; // Node moved up, so it shouldn't move down
-         normalizeDown(index);
-         return res;
-      }
-
-      /**
-       * Check invariants of the queue.
-       */
-      void checkTree()
-      {
-         assertExpr(size >= 0);
-         assertExpr(size < queue.length);
-         assertExpr(queue[0] == null);
-         if (size > 0)
-         {
-            assertExpr(queue[1] != null);
-            assertExpr(queue[1].index == 1);
-            assertExpr(queue[1].queue == this);
-            for (int i = 2; i <= size; ++i)
-            {
-               assertExpr(queue[i] != null);
-               assertExpr(queue[i].index == i);
-               assertExpr(queue[i].queue == this);
-               assertExpr(queue[i >> 1].time <= queue[i].time); // parent fires first
-            }
-            for (int i = size + 1; i < queue.length; ++i)
-               assertExpr(queue[i] == null);
-         }
-      }
-      
-   }
-   
-   /**
-    *  Our private Timeout implementation.
-    */
-   private class TimeoutExtImpl implements TimeoutExt
-   {
-      /** Top */
-      static final int TOP = 0;
-
-      /** Done */
-      static final int DONE = -1;
-
-      /** In timeout */
-      static final int TIMEOUT = -2;
-
-      /** The internal priority queue */
-      InternalPriorityQueue queue;
-      
-      /** Index in the queue */
-      int index;
-
-      /** Time of the timeout */
-      long time;
-
-      /** The timeout target */
-      TimeoutTarget target;
-
-      public long getTime()
-      {
-         return time;
-      }
-
-      public TimeoutTarget getTimeoutTarget()
-      {
-         return target;
-      }
-
-      public void done()
-      {
-         queue = null;
-         index = DONE;
-      }
-      
-      public boolean cancel()
-      {
-         return remove(this);
-      }
-   }
-   
-   public String dump()
-   {
-      JBossStringBuilder buffer = new JBossStringBuilder();
-      buffer.append("TOP=");
-      if (top == null)
-         buffer.append("null");
-      else
-         buffer.append(top.time);
-      buffer.append(" size=").append(size()).append('\n');
-      for (int i = 0; i < queues.length; ++i)
-      {
-         buffer.append(i).append("=");
-         for (int j = 1; j <= queues[i].size; ++j)
-            buffer.append(queues[i].queue[j].time).append(',');
-         buffer.append('\n');
-      }
-      return buffer.toString();
-   }
-}

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/Timeout.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/Timeout.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/Timeout.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,46 +1,32 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, the OpenSource J2EE webOS
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
 package org.jboss.util.timeout;
 
+
 /**
- * The public interface of timeouts.
+ *  The public interface of timeouts.
  *   
- * @author <a href="osh at sparre.dk">Ole Husgaard</a>
- * @version $Revision$
+ *  @author <a href="osh at sparre.dk">Ole Husgaard</a>
+ *  @version $Revision$
 */
-public interface Timeout
-{
+public interface Timeout {
    /**
-    * Cancel this timeout.
+    *  Cancel this timeout.
     *
-    * It is guaranteed that on return from this method this timer is
-    * no longer active. This means that either it has been cancelled and
-    * the timeout will not happen, or (in case of late cancel) the
-    * timeout has happened and the timeout callback function has returned.
+    *  It is guaranteed that on return from this method this timer is
+    *  no longer active. This means that either it has been cancelled and
+    *  the timeout will not happen, or (in case of late cancel) the
+    *  timeout has happened and the timeout callback function has returned.
     *
-    * On return from this method this instance should no longer be
-    * used. The reason for this is that an implementation may reuse
-    * cancelled timeouts, and at return the instance may already be
-    * in use for another timeout.
+    *  On return from this method this instance should no longer be
+    *  used. The reason for this is that an implementation may reuse
+    *  cancelled timeouts, and at return the instance may already be
+    *  in use for another timeout.
     */
-   public boolean cancel();
-}
\ No newline at end of file
+   public void cancel();
+}
+

Deleted: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutExt.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutExt.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutExt.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,48 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.util.timeout;
-
-/**
- * Timeout Extension.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public interface TimeoutExt extends Timeout
-{
-   /**
-    * Get the target of this timeout
-    * 
-    * @return the target
-    */
-   TimeoutTarget getTimeoutTarget();
-   
-   /**
-    * Get the time of this timeout
-    */
-   long getTime();
-   
-   /**
-    * Mark the work as done
-    */
-   void done();
-}

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutFactory.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutFactory.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutFactory.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,222 +1,530 @@
 /*
- * 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.
+ * JBoss, the OpenSource J2EE webOS
  *
- * 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.
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
  */
 package org.jboss.util.timeout;
 
-import org.jboss.util.NestedRuntimeException;
 import org.jboss.util.ThrowableHandler;
 import org.jboss.util.threadpool.BasicThreadPool;
+import org.jboss.util.threadpool.ThreadPool;
 import org.jboss.util.threadpool.BlockingMode;
-import org.jboss.util.threadpool.ThreadPool;
+import org.jboss.logging.Logger;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
 /**
- * The timeout factory.
+ *  The timeout factory.
  *
- * @author <a href="osh at sparre.dk">Ole Husgaard</a>
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="genman at maison-otaku.net">Elias Ross</a>  
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
+ *  This is written with performance in mind. In case of <code>n</code>
+ *  active timeouts, creating, cancelling and firing timeouts all operate
+ *  in time <code>O(log(n))</code>.
+ *
+ *  If a timeout is cancelled, the timeout is not discarded. Instead the
+ *  timeout is saved to be reused for another timeout. This means that if
+ *  no timeouts are fired, this class will eventually operate without
+ *  allocating anything on the heap.
+ *
+ *  @author <a href="osh at sparre.dk">Ole Husgaard</a>
+ *  @version $Revision$
  */
 public class TimeoutFactory
 {
-   /** The priority queue property */
-   private static final String priorityQueueProperty = TimeoutPriorityQueue.class.getName();
 
-   /** The priority queue default */
-   private static final String priorityQueueName = TimeoutPriorityQueueImpl.class.getName();
-   
-   /** Our singleton instance */
-   private static TimeoutFactory singleton;
-   
-   /** Number of TimeoutFactories created */
-   private static int timeoutFactoriesCount = 0;
-   
-   /** The priority queue class */
-   private static Class priorityQueueClass;
-   
-   /** The default threadpool used to execute timeouts */
-   private static BasicThreadPool DEFAULT_TP = new BasicThreadPool("Timeouts");
-   static
+   private static Logger log = Logger.getLogger(BasicThreadPool.class);
+
+   //  Code commented out with the mark "INV:" are runtime checks
+   //  of invariants that are not needed for a production system.
+   //  For problem solving, you can remove these comments.
+   //  Multithreading notes:
+   //
+   //  While a TimeoutImpl is enqueued, its index field contains the index
+   //  of the instance in the queue; that is, for 1 <= n <= size,
+   //  q[n].index = n.
+   //  Modifications of an enqueued TimeoutImpl instance may only happen
+   //  in code synchronized on the TimeoutFactory instance that has it
+   //  enqueued.
+   //  Modifications on the priority queue may only happen while running in
+   //  code synchronized on the TimeoutFactory instance that holds the queue.
+   //  When a TimeoutImpl instance is no longer enqueued, its index field
+   //  changes to one of the negative constants declared in the TimeoutImpl
+   //  class.
+   //  When a TimeoutImpl is not in use, its index field is TimeoutImpl.DONE
+   //  and it is on the freeList.
+   //
+   //  Cancellation may race with the timeout.
+   //  To avoid problems with this, the TimeoutImpl index field is set to
+   //  TimeoutImpl.TIMEOUT when the TimeoutImpl is taken out of the queue.
+   //  Finally the index field is set to TimeoutImpl.DONE, and
+   //  the TimeoutImpl instance is discarded.
+
+   /** The threadpool used to invoke timeouts */
+   private BasicThreadPool threadPool = new BasicThreadPool("Timeouts");
    {
-      DEFAULT_TP.setBlockingMode(BlockingMode.RUN);
+      threadPool.setBlockingMode(BlockingMode.RUN);
+   }
 
-      String priorityQueueClassName = priorityQueueName;
-      ClassLoader cl = TimeoutFactory.class.getClassLoader();
-      try
+   /**
+    *  Our private Timeout implementation.
+    */
+   private class TimeoutImpl implements Timeout
+   {
+      static final int DONE = -1; // done, may be finalized or reused
+
+      static final int TIMEOUT = -2; // target being called
+
+      int index; // index in queue, or one of constants above.
+
+      long time; // time to fire
+
+      TimeoutTarget target; // target to fire at
+
+      TimeoutImpl nextFree; // next on free list
+
+      public void cancel()
       {
-         priorityQueueClassName = System.getProperty(priorityQueueProperty, priorityQueueName);
-         cl = Thread.currentThread().getContextClassLoader();
+         TimeoutFactory.this.dropTimeout(this);
       }
-      catch (Exception ignored)
+   }
+
+   /**
+    *  A worker thread that fires the timeout.
+    */
+   private static class TimeoutWorker implements Runnable
+   {
+      private TimeoutImpl work;
+
+      /**
+       *  Create a new instance.
+       *
+       *  @param work The timeout that should be fired.
+       */
+      TimeoutWorker(TimeoutImpl work)
       {
+         this.work = work;
       }
-      
-      try
+
+      /**
+       *  Override to fire the timeout.
+       */
+      public void run()
       {
-         priorityQueueClass = cl.loadClass(priorityQueueClassName);
+         try
+         {
+            work.target.timedOut(work);
+         }
+         catch (Throwable t)
+         {
+            ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
+         }
+         synchronized (work)
+         {
+            work.index = TimeoutImpl.DONE;
+         }
       }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e.toString(), e);
-      }
    }
 
-   /** Used for graceful exiting */
-   private SynchronizedBoolean cancelled = new SynchronizedBoolean(false);
-   
-   /** The daemon thread that dequeues timeouts tasks and issues
-       them for execution to the thread pool */ 
-   private Thread workerThread;
-   
-   /** Per TimeoutFactory thread pool used to execute timeouts */
-   private ThreadPool threadPool;
-   
-   /** The priority queue */
-   private TimeoutPriorityQueue queue;
+   /** Linked list of free TimeoutImpl instances. */
+   private TimeoutImpl freeList;
 
-   /** Lazy constructions of the TimeoutFactory singleton */
-   public synchronized static TimeoutFactory getSingleton()
+   /** The size of the timeout queue. */
+   private int size;
+
+   /**
+    *  Our priority queue.
+    *
+    *  This is a balanced binary tree. If nonempty, the root is at index 1,
+    *  and all nodes are at indices 1..size. Nodes with index greater than
+    *  size are null. Index 0 is never used.
+    *  Children of the node at index <code>j</code> are at <code>j*2</code>
+    *  and <code>j*2+1</code>. The children of a node always fire the timeout
+    *  no earlier than the node.
+    *
+    *
+    *  Or, more formally:
+    *
+    *  Only indices <code>1</code>..<code>size</code> of this array are used.
+    *  All other indices contain the null reference.
+    *  This array represent a balanced binary tree.
+    *
+    *  If <code>size</code> is <code>0</code> the tree is empty, otherwise
+    *  the root of the tree is at index <code>1</code>.
+    *
+    *  Given an arbitrary node at index <code>n</code> that is not the root
+    *  node, the parent node of <code>n</code> is at index <code>n/2</code>.
+    *
+    *  Given an arbitrary node at index <code>n</code>; if
+    *  <code>2*n <= size</code> the node at <code>n</code> has its left child
+    *  at index <code>2*n</code>, otherwise the node at <code>n</code> has
+    *  no left child.
+    *
+    *  Given an arbitrary node at index <code>n</code>; if
+    *  <code>2*n+1 <= size</code> the node at <code>n</code> has its right child
+    *  at index <code>2*n+1</code>, otherwise the node at <code>n</code> has
+    *  no right child.
+    *
+    *  The priority function is called T. Given a node <code>n</code>,
+    *  <code>T(n)</code> denotes the absolute time (in milliseconds since
+    *  the epoch) that the timeout for node <code>n</code> should happen.
+    *  Smaller values of <code>T</code> means higher priority.
+    *
+    *  The tree satisfies the following invariant:
+    *  <i>
+    *  For any node <code>n</code> in the tree:
+    *  If node <code>n</code> has a left child <code>l</code>,
+    *  <code>T(n) <= T(l)</code>.
+    *  If node <code>n</code> has a right child <code>r</code>,
+    *  <code>T(n) <= T(r)</code>.
+    *  </i>
+    *
+    *
+    *  The invariant may be temporarily broken while executing synchronized
+    *  on <code>this</code> instance, but is always reestablished before
+    *  leaving the synchronized code.
+    *
+    *  The node at index <code>1</code> is always the first node to timeout,
+    *  as can be deduced from the invariant.
+    *
+    *  For the following algorithm pseudocode, the operation
+    *  <code>swap(n,m)</code> denotes the exchange of the nodes at indices
+    *  <code>n</code> and <code>m</code> in the tree.
+    *
+    *  Insertion of a new node happend as follows:
+    *  <pre>
+    *    IF size = q.length THEN
+    *      "expand q array to be larger";
+    *    ENDIF
+    *    size <- size + 1;
+    *    q[size] <- "new node";
+    *    n <- size;
+    *    WHILE n > 1 AND T(n/2) > T(n) DO
+    *      swap(n/2, n);
+    *      n <- n/2;
+    *    ENDWHILE
+    *  </pre>
+    *  Proof that this insertion algorithm respects the invariant is left to
+    *  the interested reader.
+    *
+    *  The removal algorithm is a bit more complicated. To remove the node
+    *  at index <code>n</code>:
+    *  <pre>
+    *    swap(n, size);
+    *    size <- size - 1;
+    *    IF n > 1 AND T(n/2) > T(n) THEN
+    *      WHILE n > 1 AND T(n/2) > T(n) DO
+    *        swap(n/2, n);
+    *        n <- n/2;
+    *      ENDWHILE
+    *    ELSE
+    *      WHILE 2*n <= size DO
+    *        IF 2*n+1 <= size THEN
+    *          // Both children present
+    *          IF T(2*n) <= T(2*n+1) THEN
+    *            IF T(n) <= T(2*n) THEN
+    *              EXIT;
+    *            ENDIF
+    *            swap(n, 2*n);
+    *            n <- 2*n;
+    *          ELSE
+    *            IF T(n) <= T(2*n+1) THEN
+    *              EXIT;
+    *            ENDIF
+    *            swap(n, 2*n+1);
+    *            n <- 2*n+1;
+    *          ENDIF
+    *        ELSE
+    *          // Only left child, right child not present.
+    *          IF T(n) <= T(2*n) THEN
+    *            EXIT;
+    *          ENDIF
+    *          swap(n, 2*n);
+    *          n <- 2*n;
+    *        ENDIF
+    *      ENDWHILE
+    *    ENDIF
+    *  </pre>
+    *  Proof that this removal algorithm respects the invariant is left to
+    *  the interested reader. Really, I am not going to prove it here.
+    *
+    *  If you are interested, you can find this data structure and its
+    *  associated operations in most textbooks on algorithmics.
+    *
+    *  @see checkTree
+    */
+   private TimeoutImpl[] q;
+
+   /**
+    *  Debugging helper.
+    */
+   private void assertExpr(boolean expr)
    {
-      if (singleton == null)
+      if (!expr)
       {
-         singleton = new TimeoutFactory(DEFAULT_TP);
+         RuntimeException ex = new RuntimeException("***** assert failed *****");
+         try
+         {
+            Thread.sleep(30000);
+         }
+         catch (Exception e)
+         {
+         }
       }
-      return singleton;
    }
-   
+
    /**
-    *  Schedules a new timeout using the singleton TimeoutFactory
+    *  Check invariants of the queue.
     */
-   static public Timeout createTimeout(long time, TimeoutTarget target)
+   private void checkTree()
    {
-      return getSingleton().schedule(time, target);
+      assertExpr(size >= 0);
+      assertExpr(size < q.length);
+      assertExpr(q[0] == null);
+      if (size > 0)
+      {
+         assertExpr(q[1] != null);
+         assertExpr(q[1].index == 1);
+         for (int i = 2; i <= size; ++i)
+         {
+            assertExpr(q[i] != null);
+            assertExpr(q[i].index == i);
+            assertExpr(q[i >> 1].time <= q[i].time); // parent fires first
+         }
+         for (int i = size + 1; i < q.length; ++i)
+            assertExpr(q[i] == null);
+      }
    }
-   
+
    /**
-    * Constructs a new TimeoutFactory that uses the provided ThreadPool
+    *  Check invariants of the free list.
     */
-   public TimeoutFactory(ThreadPool threadPool)
+   private void checkFreeList()
    {
-      this.threadPool = threadPool;
-      try
+      TimeoutImpl to = freeList;
+      while (to != null)
       {
-         queue = (TimeoutPriorityQueue) priorityQueueClass.newInstance(); 
+         assertExpr(to.index == TimeoutImpl.DONE);
+         to = to.nextFree;
       }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Cannot instantiate " + priorityQueueClass,e);
-      }
-      
-      // setup the workerThread
-      workerThread = new Thread("TimeoutFactory-" + timeoutFactoriesCount++)
-      {
-         public void run()
-         {
-            doWork();
-         }
-      };
-      workerThread.setDaemon(true);
-      workerThread.start();
    }
-   
+
    /**
-    * Constructs a new TimeoutFactory that uses the default thread pool
+    *  Swap two nodes in the tree.
     */
-   public TimeoutFactory()
+   private void swap(int a, int b)
    {
-      this(DEFAULT_TP);
+      // INV: assertExpr(a > 0);
+      // INV: assertExpr(a <= size);
+      // INV: assertExpr(b > 0);
+      // INV: assertExpr(b <= size);
+      // INV: assertExpr(q[a] != null);
+      // INV: assertExpr(q[b] != null);
+      // INV: assertExpr(q[a].index == a);
+      // INV: assertExpr(q[b].index == b);
+      TimeoutImpl temp = q[a];
+      q[a] = q[b];
+      q[a].index = a;
+      q[b] = temp;
+      q[b].index = b;
    }
-   
+
    /**
-    * Schedules a new timeout.
-    * 
-    * @param time absolute time
-    * @param target target to fire
+    *  A new node has been added at index <code>index</code>.
+    *  Normalize the tree by moving the new node up the tree.
+    *
+    *  @return True iff the tree was modified.
     */
-   public Timeout schedule(long time, TimeoutTarget target)
+   private boolean normalizeUp(int index)
    {
-      if (cancelled.get())
-         throw new IllegalStateException("TimeoutFactory has been cancelled");      
-      if (time < 0)
-         throw new IllegalArgumentException("Negative time");
-      if (target == null)
-         throw new IllegalArgumentException("Null timeout target");
+      // INV: assertExpr(index > 0);
+      // INV: assertExpr(index <= size);
+      // INV: assertExpr(q[index] != null);
+      if (index == 1)
+         return false; // at root
+      boolean ret = false;
+      long t = q[index].time;
+      int p = index >> 1;
+      while (q[p].time > t)
+      {
+         // INV: assertExpr(q[index].time == t);
+         swap(p, index);
+         ret = true;
+         if (p == 1)
+            break; // at root
+         index = p;
+         p >>= 1;
+      }
+      return ret;
+   }
 
-      return queue.offer(time, target);
-   }
-   
    /**
-    * Schedules a new timeout.
-    * 
-    * @param time absolute time
-    * @param run runnable to run
+    *  Remove a node from the tree and normalize.
+    *
+    *  @return The removed node.
     */
-   public Timeout schedule(long time, Runnable run)
+   private TimeoutImpl removeNode(int index)
    {
-      return schedule(time, new TimeoutTargetImpl(run));
+      // INV: assertExpr(index > 0);
+      // INV: assertExpr(index <= size);
+      TimeoutImpl res = q[index];
+      // INV: assertExpr(res != null);
+      // INV: assertExpr(res.index == index);
+      if (index == size)
+      {
+         --size;
+         q[index] = null;
+         return res;
+      }
+      swap(index, size); // Exchange removed node with last leaf node
+      --size;
+      // INV: assertExpr(res.index == size + 1);
+      q[res.index] = null;
+      if (normalizeUp(index))
+         return res; // Node moved up, so it shouldn't move down
+      long t = q[index].time;
+      int c = index << 1;
+      while (c <= size)
+      {
+         // INV: assertExpr(q[index].time == t);
+         TimeoutImpl l = q[c];
+         // INV: assertExpr(l != null);
+         // INV: assertExpr(l.index == c);
+         if (c + 1 <= size)
+         {
+            // two children, swap with smallest
+            TimeoutImpl r = q[c + 1];
+            // INV: assertExpr(r != null);
+            // INV: assertExpr(r.index == c+1);
+            if (l.time <= r.time)
+            {
+               if (t <= l.time)
+                  break; // done
+               swap(index, c);
+               index = c;
+            }
+            else
+            {
+               if (t <= r.time)
+                  break; // done
+               swap(index, c + 1);
+               index = c + 1;
+            }
+         }
+         else
+         { // one child
+            if (t <= l.time)
+               break; // done
+            swap(index, c);
+            index = c;
+         }
+         c = index << 1;
+      }
+      return res;
    }
-   
+
    /**
-    * Cancels all submitted tasks, stops the worker
-    * thread and clean-ups everything except for the
-    * thread pool. Scheduling new timeouts after cancel
-    * is called results in a IllegalStateException.
+    *  Create a new timeout.
     */
-   public void cancel()
+   private synchronized Timeout newTimeout(long time, TimeoutTarget target)
    {
-      // obviously the singleton TimeoutFactory cannot
-      // be cancelled since its reference is not accessible
-      
-      // let the worker thread cleanup
-      if (cancelled.set(true) == false);
+      // INV: checkTree();
+      // INV: assertExpr(size < q.length);
+      if (++size == q.length)
       {
-         // Cancel the priority queue
-         queue.cancel();
+         TimeoutImpl[] newQ = new TimeoutImpl[2 * q.length];
+         System.arraycopy(q, 0, newQ, 0, q.length);
+         q = newQ;
       }
+      // INV: assertExpr(size < q.length);
+      // INV: assertExpr(q[size] == null);
+      TimeoutImpl timeout;
+      if (freeList != null)
+      {
+         timeout = q[size] = freeList;
+         freeList = timeout.nextFree;
+         // INV: checkFreeList();
+         // INV: assertExpr(timeout.index == TimeoutImpl.DONE);
+      }
+      else
+         timeout = q[size] = new TimeoutImpl();
+      timeout.index = size;
+      timeout.time = time;
+      timeout.target = target;
+      normalizeUp(size);
+      if (timeout.index == 1)
+         notify();
+      // INV: checkTree();
+      return timeout;
    }
-   
+
    /**
-    * Returns true if the TimeoutFactory has been cancelled,
-    * false if it is operational (i.e. accepts timeout schedules).
+    *  Cancel a timeout.
     */
-   public boolean isCancelled()
+   private void dropTimeout(TimeoutImpl timeout)
    {
-      return cancelled.get();
+      synchronized (this)
+      {
+         if (timeout.index > 0)
+         {
+            // Active timeout, remove it.
+            // INV: assertExpr(q[timeout.index] == timeout);
+            // INV: checkTree();
+            removeNode(timeout.index);
+            // INV: checkTree();
+            timeout.index = TimeoutImpl.DONE;
+            timeout.nextFree = freeList;
+            freeList = timeout;
+            // INV: checkFreeList();
+            return;
+         }
+      }
    }
 
    /**
     *  Timeout worker method.
+    *  This method never returns. Whenever it is time to do a timeout,
+    *  the callback method is called from here.
     */
    private void doWork()
    {
-      while (cancelled.get() == false)
+      while (true)
       {
-         TimeoutExt work = queue.take();
+         TimeoutImpl work = null;
+         // Look for work
+         synchronized (this)
+         {
+            if (size == 0)
+            {
+               try
+               {
+                  wait();
+               }
+               catch (InterruptedException ex)
+               {
+               }
+            }
+            else
+            {
+               long now = System.currentTimeMillis();
+               if (q[1].time > now)
+               {
+                  try
+                  {
+                     wait(q[1].time - now);
+                  }
+                  catch (InterruptedException ex)
+                  {
+                  }
+               }
+               if (size > 0 && q[1].time <= System.currentTimeMillis())
+               {
+                  work = removeNode(1);
+                  work.index = TimeoutImpl.TIMEOUT;
+               }
+            }
+         }
          // Do work, if any
          if (work != null)
          {
-            // Wrap the TimeoutExt with a runnable that invokes the target callback
+            // Create a new thread to do the callback.
             TimeoutWorker worker = new TimeoutWorker(work);
             try
             {
@@ -224,73 +532,58 @@
             }
             catch (Throwable t)
             {
-               // protect the worker thread from pool enqueue errors
-               ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
+               log.error(t, t);
             }
-            synchronized (work)
-            {
-               work.done();
-            }            
          }
       }
-      
-      // TimeoutFactory was cancelled
-      queue.cancel();
    }
-   
+
+   /** Our singleton instance. */
+   static private TimeoutFactory singleton;
+
+   /** Our private constructor. */
+   private TimeoutFactory()
+   {
+      freeList = null;
+      size = 0;
+      q = new TimeoutImpl[16];
+   }
+
    /**
-    *  A runnable that fires the timeout callback
+    *  Initialize class.
+    *  The will initialize the singleton and create a single
+    *  worker thread.
     */
-   private static class TimeoutWorker implements Runnable
+   static
    {
-      private TimeoutExt work;
-
-      /**
-       *  Create a new instance.
-       *
-       *  @param work The timeout that should be fired.
-       */
-      TimeoutWorker(TimeoutExt work)
+      singleton = new TimeoutFactory();
+      Thread thread = new Thread("TimeoutFactory")
       {
-         this.work = work;
-      }
-
-      /**
-       *  Override to fire the timeout.
-       */
-      public void run()
-      {
-         try
+         public void run()
          {
-            work.getTimeoutTarget().timedOut(work);
+            try
+            {
+               singleton.doWork();
+            }
+            catch (Throwable t)
+            {
+               log.error(t, t);
+            }
          }
-         catch (Throwable t)
-         {
-            // protect the thread pool thread from receiving this error
-            ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
-         }
-         synchronized (work)
-         {
-            work.done();
-         }
-      }
+      };
+      thread.setDaemon(true);
+      thread.start();
    }
-   
+
    /**
-    * Simple TimeoutTarget implementation that wraps a Runnable
+    *  Schedule a new timeout.
     */
-   private static class TimeoutTargetImpl implements TimeoutTarget
+   static public Timeout createTimeout(long time, TimeoutTarget target)
    {
-      Runnable runnable;
-      
-      TimeoutTargetImpl(Runnable runnable)
-      {
-         this.runnable = runnable;
-      }
-      
-      public void timedOut(Timeout ignored)
-      {
-         runnable.run();
-      }
+      if (time <= 0)
+         throw new IllegalArgumentException("Time not positive");
+      if (target == null)
+         throw new IllegalArgumentException("Null target");
+      return singleton.newTimeout(time, target);
    }
-}
\ No newline at end of file
+}

Deleted: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueue.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueue.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueue.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,95 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.util.timeout;
-
-/**
- * TimeoutPriorityQueue.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public interface TimeoutPriorityQueue
-{
-   /**
-    * Add a timeout to the queue
-    * 
-    * @param time the time of the timeout
-    * @param target the timeout target
-    * @return timeout when it was added to the queue, false otherwise
-    */
-   TimeoutExt offer(long time, TimeoutTarget target);
-   
-   /**
-    * Take a timeout when it times out
-    * 
-    * @return the top the queue or null if the queue is cancelled
-    */
-   TimeoutExt take();
-   
-   /**
-    * Retrieves and removes the top of the queue if it times out
-    * or null if there is no such element
-    * 
-    * @return the top the queue or null if the queue is empty
-    */
-   TimeoutExt poll();
-   
-   /**
-    * Retrieves and removes the top of the queue if it times out
-    * or null if there is no such element
-    * 
-    * @param wait how to long to wait in milliseconds
-    *        if the queue is empty
-    * @return the top of the queue or null if the queue is empty
-    */
-   TimeoutExt poll(long wait);
-   
-   /**
-    * Retrieves but does not remove the top of the queue
-    * or null if there is no such element
-    * 
-    * @return the top of the queue or null if the queue is empty
-    */
-   TimeoutExt peek();
-   
-   /**
-    * Removes the passed timeout from the queue
-    * 
-    * @return true when the timeout was removed
-    */
-   boolean remove(TimeoutExt timeout);
-   
-   /**
-    * Clears the queue
-    */
-   void clear();
-   
-   /**
-    * Cancels the queue
-    */
-   void cancel();
-   
-   /**
-    * The size of the queue
-    */
-   int size();
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueueImpl.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueueImpl.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutPriorityQueueImpl.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,571 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.util.timeout;
-
-/**
- * TimeoutPriorityQueueImpl.
- *
- *  This is a balanced binary tree. If nonempty, the root is at index 1,
- *  and all nodes are at indices 1..size. Nodes with index greater than
- *  size are null. Index 0 is never used.
- *  Children of the node at index <code>j</code> are at <code>j*2</code>
- *  and <code>j*2+1</code>. The children of a node always fire the timeout
- *  no earlier than the node.
- *
- *
- *  Or, more formally:
- *
- *  Only indices <code>1</code>..<code>size</code> of this array are used.
- *  All other indices contain the null reference.
- *  This array represent a balanced binary tree.
- *
- *  If <code>size</code> is <code>0</code> the tree is empty, otherwise
- *  the root of the tree is at index <code>1</code>.
- *
- *  Given an arbitrary node at index <code>n</code> that is not the root
- *  node, the parent node of <code>n</code> is at index <code>n/2</code>.
- *
- *  Given an arbitrary node at index <code>n</code>; if
- *  <code>2*n <= size</code> the node at <code>n</code> has its left child
- *  at index <code>2*n</code>, otherwise the node at <code>n</code> has
- *  no left child.
- *
- *  Given an arbitrary node at index <code>n</code>; if
- *  <code>2*n+1 <= size</code> the node at <code>n</code> has its right child
- *  at index <code>2*n+1</code>, otherwise the node at <code>n</code> has
- *  no right child.
- *
- *  The priority function is called T. Given a node <code>n</code>,
- *  <code>T(n)</code> denotes the absolute time (in milliseconds since
- *  the epoch) that the timeout for node <code>n</code> should happen.
- *  Smaller values of <code>T</code> means higher priority.
- *
- *  The tree satisfies the following invariant:
- *  <i>
- *  For any node <code>n</code> in the tree:
- *  If node <code>n</code> has a left child <code>l</code>,
- *  <code>T(n) <= T(l)</code>.
- *  If node <code>n</code> has a right child <code>r</code>,
- *  <code>T(n) <= T(r)</code>.
- *  </i>
- *
- *
- *  The invariant may be temporarily broken while executing synchronized
- *  on <code>this</code> instance, but is always reestablished before
- *  leaving the synchronized code.
- *
- *  The node at index <code>1</code> is always the first node to timeout,
- *  as can be deduced from the invariant.
- *
- *  For the following algorithm pseudocode, the operation
- *  <code>swap(n,m)</code> denotes the exchange of the nodes at indices
- *  <code>n</code> and <code>m</code> in the tree.
- *
- *  Insertion of a new node happend as follows:
- *  <pre>
- *    IF size = q.length THEN
- *      "expand q array to be larger";
- *    ENDIF
- *    size <- size + 1;
- *    q[size] <- "new node";
- *    n <- size;
- *    WHILE n > 1 AND T(n/2) > T(n) DO
- *      swap(n/2, n);
- *      n <- n/2;
- *    ENDWHILE
- *  </pre>
- *  Proof that this insertion algorithm respects the invariant is left to
- *  the interested reader.
- *
- *  The removal algorithm is a bit more complicated. To remove the node
- *  at index <code>n</code>:
- *  <pre>
- *    swap(n, size);
- *    size <- size - 1;
- *    IF n > 1 AND T(n/2) > T(n) THEN
- *      WHILE n > 1 AND T(n/2) > T(n) DO
- *        swap(n/2, n);
- *        n <- n/2;
- *      ENDWHILE
- *    ELSE
- *      WHILE 2*n <= size DO
- *        IF 2*n+1 <= size THEN
- *          // Both children present
- *          IF T(2*n) <= T(2*n+1) THEN
- *            IF T(n) <= T(2*n) THEN
- *              EXIT;
- *            ENDIF
- *            swap(n, 2*n);
- *            n <- 2*n;
- *          ELSE
- *            IF T(n) <= T(2*n+1) THEN
- *              EXIT;
- *            ENDIF
- *            swap(n, 2*n+1);
- *            n <- 2*n+1;
- *          ENDIF
- *        ELSE
- *          // Only left child, right child not present.
- *          IF T(n) <= T(2*n) THEN
- *            EXIT;
- *          ENDIF
- *          swap(n, 2*n);
- *          n <- 2*n;
- *        ENDIF
- *      ENDWHILE
- *    ENDIF
- *  </pre>
- *  Proof that this removal algorithm respects the invariant is left to
- *  the interested reader. Really, I am not going to prove it here.
- *
- *  If you are interested, you can find this data structure and its
- *  associated operations in most textbooks on algorithmics.
- *
- *  @see checkTree
- * 
- * @author <a href="osh at sparre.dk">Ole Husgaard</a>
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="genman at maison-otaku.net">Elias Ross</a>  
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class TimeoutPriorityQueueImpl implements TimeoutPriorityQueue
-{
-   //  Code commented out with the mark "INV:" are runtime checks
-   //  of invariants that are not needed for a production system.
-   //  For problem solving, you can remove these comments.
-   //  Multithreading notes:
-   //
-   //  While a TimeoutImpl is enqueued, its index field contains the index
-   //  of the instance in the queue; that is, for 1 <= n <= size,
-   //  q[n].index = n.
-   //  Modifications of an enqueued TimeoutImpl instance may only happen
-   //  in code synchronized on the TimeoutFactory instance that has it
-   //  enqueued.
-   //  Modifications on the priority queue may only happen while running in
-   //  code synchronized on the TimeoutFactory instance that holds the queue.
-   //  When a TimeoutImpl instance is no longer enqueued, its index field
-   //  changes to one of the negative constants declared in the TimeoutImpl
-   //  class.
-   //
-   //  Cancellation may race with the timeout.
-   //  To avoid problems with this, the TimeoutImpl index field is set to
-   //  TimeoutImpl.TIMEOUT when the TimeoutImpl is taken out of the queue.
-   //  Finally the index field is set to TimeoutImpl.DONE, and
-   //  the TimeoutImpl instance is discarded.
-
-   /** The lock object */
-   private Object lock = new Object();
-
-   /** The size of the timeout queue. */
-   private int size;
-
-   /** The timeouts */
-   private TimeoutExtImpl[] queue;
-
-   /**
-    * Create a new TimeoutPriorityQueueImpl.
-    */
-   public TimeoutPriorityQueueImpl()
-   {
-      queue = new TimeoutExtImpl[16];
-      size = 0;
-   }
-
-   public TimeoutExt offer(long time, TimeoutTarget target)
-   {
-      if (queue == null)
-         throw new IllegalStateException("TimeoutPriorityQueue has been cancelled");
-      if (time < 0)
-         throw new IllegalArgumentException("Negative time");
-      if (target == null)
-         throw new IllegalArgumentException("Null timeout target");
-
-      synchronized (lock)
-      {
-         // INV: checkTree();
-         // INV: assertExpr(size < queue.length);
-         if (++size == queue.length)
-         {
-            TimeoutExtImpl[] newQ = new TimeoutExtImpl[2 * queue.length];
-            System.arraycopy(queue, 0, newQ, 0, queue.length);
-            queue = newQ;
-         }
-         // INV: assertExpr(size < queue.length);
-         // INV: assertExpr(queue[size] == null);
-         TimeoutExtImpl timeout;
-         timeout = queue[size] = new TimeoutExtImpl();
-         timeout.index = size;
-         timeout.time = time;
-         timeout.target = target;
-         normalizeUp(size);
-         if (timeout.index == 1)
-            lock.notify();
-         // INV: checkTree();
-         return timeout;
-      }
-   }
-
-   public TimeoutExt take()
-   {
-      return poll(-1);
-   }
-
-   public TimeoutExt poll()
-   {
-      return poll(1);
-   }
-
-   public TimeoutExt poll(long wait)
-   {
-      long endWait = -1;
-      if (wait > 0)
-         endWait = System.currentTimeMillis() + wait;
-      // Look for work
-      synchronized (lock)
-      {
-         while (queue != null && (wait >= 0 || endWait == -1))
-         {
-            if (size == 0)
-            {
-               try
-               {
-                  if (endWait == -1)
-                     lock.wait();
-                  else
-                     lock.wait(wait);
-               }
-               catch (InterruptedException ex)
-               {
-               }
-            }
-            else
-            {
-               long now = System.currentTimeMillis();
-               if (queue[1].time > now)
-               {
-                  long waitForFirst = queue[1].time - now;
-                  if (endWait != -1 && waitForFirst > wait)
-                     waitForFirst = wait;
-                  try
-                  {
-                     lock.wait(waitForFirst);
-                  }
-                  catch (InterruptedException ex)
-                  {
-                  }
-               }
-               if (size > 0 && queue != null && queue[1].time <= System.currentTimeMillis())
-               {
-                  TimeoutExtImpl result = removeNode(1);
-                  result.index = TimeoutExtImpl.TIMEOUT;
-                  return result;
-               }
-            }
-            if (endWait != -1)
-               wait = endWait - System.currentTimeMillis();
-         }
-      }
-      return null;
-   }
-
-   public TimeoutExt peek()
-   {
-      synchronized (lock)
-      {
-         if (size > 0)
-            return queue[1];
-         else
-            return null;
-      }
-   }
-
-   public boolean remove(TimeoutExt timeout)
-   {
-      TimeoutExtImpl timeoutImpl = (TimeoutExtImpl) timeout;
-      synchronized (lock)
-      {
-         if (timeoutImpl.index > 0)
-         {
-            // Active timeout, remove it.
-            // INV: assertExpr(queue[timeoutImpl.index] == timeout);
-            // INV: checkTree();
-            removeNode(timeoutImpl.index);
-            // INV: checkTree();
-            timeoutImpl.index = TimeoutExtImpl.DONE;
-
-            // execution cancelled
-            return true;
-         }
-         else
-         {
-            // has already been executed (DONE) or
-            // is currently executing (TIMEOUT)
-            return false;
-         }
-      }
-   }
-
-   public void clear()
-   {
-      synchronized (lock)
-      {
-         if (queue == null)
-            return;
-
-         // cleanup queue
-         for (int i = 1; i <= size; ++i)
-            queue[i] = cleanupTimeoutExtImpl(queue[i]);
-      }
-   }
-
-   public void cancel()
-   {
-      synchronized (lock)
-      {
-         if (queue == null)
-            return;
-         clear();
-         queue = null;
-         size = 0;
-         lock.notifyAll();
-      }
-   }
-
-   public int size()
-   {
-      return size;
-   }
-   
-   /**
-    * Whether the queue is cancelled
-    * 
-    * @return true when cancelled
-    */
-   public boolean isCancelled()
-   {
-      return queue == null;
-   }
-
-   /**
-    *  A new node has been added at index <code>index</code>.
-    *  Normalize the tree by moving the new node up the tree.
-    *
-    *  @return true if the tree was modified.
-    */
-   private boolean normalizeUp(int index)
-   {
-      // INV: assertExpr(index > 0);
-      // INV: assertExpr(index <= size);
-      // INV: assertExpr(queue[index] != null);
-      if (index == 1)
-         return false; // at root
-      boolean ret = false;
-      long t = queue[index].time;
-      int p = index >> 1;
-      while (queue[p].time > t)
-      {
-         // INV: assertExpr(queue[index].time == t);
-         swap(p, index);
-         ret = true;
-         if (p == 1)
-            break; // at root
-         index = p;
-         p >>= 1;
-      }
-      return ret;
-   }
-
-   /**
-    * Swap two nodes in the tree.
-    * 
-    * @param a the first index
-    * @param b the second index
-    */
-   private void swap(int a, int b)
-   {
-      // INV: assertExpr(a > 0);
-      // INV: assertExpr(a <= size);
-      // INV: assertExpr(b > 0);
-      // INV: assertExpr(b <= size);
-      // INV: assertExpr(queue[a] != null);
-      // INV: assertExpr(queue[b] != null);
-      // INV: assertExpr(queue[a].index == a);
-      // INV: assertExpr(queue[b].index == b);
-      TimeoutExtImpl temp = queue[a];
-      queue[a] = queue[b];
-      queue[a].index = a;
-      queue[b] = temp;
-      queue[b].index = b;
-   }
-
-   /**
-    * Remove a node from the tree and normalize.
-    *
-    * @param index the index in the queue
-    * @return the removed node.
-    */
-   private TimeoutExtImpl removeNode(int index)
-   {
-      // INV: assertExpr(index > 0);
-      // INV: assertExpr(index <= size);
-      TimeoutExtImpl res = queue[index];
-      // INV: assertExpr(res != null);
-      // INV: assertExpr(res.index == index);
-      if (index == size)
-      {
-         --size;
-         queue[index] = null;
-         return res;
-      }
-      swap(index, size); // Exchange removed node with last leaf node
-      --size;
-      // INV: assertExpr(res.index == size + 1);
-      queue[res.index] = null;
-      if (normalizeUp(index))
-         return res; // Node moved up, so it shouldn't move down
-      long t = queue[index].time;
-      int c = index << 1;
-      while (c <= size)
-      {
-         // INV: assertExpr(q[index].time == t);
-         TimeoutExtImpl l = queue[c];
-         // INV: assertExpr(l != null);
-         // INV: assertExpr(l.index == c);
-         if (c + 1 <= size)
-         {
-            // two children, swap with smallest
-            TimeoutExtImpl r = queue[c + 1];
-            // INV: assertExpr(r != null);
-            // INV: assertExpr(r.index == c+1);
-            if (l.time <= r.time)
-            {
-               if (t <= l.time)
-                  break; // done
-               swap(index, c);
-               index = c;
-            }
-            else
-            {
-               if (t <= r.time)
-                  break; // done
-               swap(index, c + 1);
-               index = c + 1;
-            }
-         }
-         else
-         { // one child
-            if (t <= l.time)
-               break; // done
-            swap(index, c);
-            index = c;
-         }
-         c = index << 1;
-      }
-      return res;
-   }
-
-   /**
-    * Recursive cleanup of a TimeoutImpl
-    * 
-    * @return null
-    */
-   private TimeoutExtImpl cleanupTimeoutExtImpl(TimeoutExtImpl timeout)
-   {
-      if (timeout != null)
-         timeout.target = null;
-      return null;
-   }
-
-   /**
-    * Check invariants of the queue.
-    */
-   void checkTree()
-   {
-      assertExpr(size >= 0);
-      assertExpr(size < queue.length);
-      assertExpr(queue[0] == null);
-      if (size > 0)
-      {
-         assertExpr(queue[1] != null);
-         assertExpr(queue[1].index == 1);
-         for (int i = 2; i <= size; ++i)
-         {
-            assertExpr(queue[i] != null);
-            assertExpr(queue[i].index == i);
-            assertExpr(queue[i >> 1].time <= queue[i].time); // parent fires first
-         }
-         for (int i = size + 1; i < queue.length; ++i)
-            assertExpr(queue[i] == null);
-      }
-   }
-
-   /**
-    * Debugging helper.
-    */
-   private void assertExpr(boolean expr)
-   {
-      if (!expr)
-         throw new IllegalStateException("***** assert failed *****");
-   }
-
-   /**
-    *  Our private Timeout implementation.
-    */
-   private class TimeoutExtImpl implements TimeoutExt
-   {
-      /** Done */
-      static final int DONE = -1;
-
-      /** In timeout */
-      static final int TIMEOUT = -2;
-
-      /** Index in the queue */
-      int index;
-
-      /** Time of the timeout */
-      long time;
-
-      /** The timeout target */
-      TimeoutTarget target;
-
-      public long getTime()
-      {
-         return time;
-      }
-
-      public TimeoutTarget getTimeoutTarget()
-      {
-         return target;
-      }
-
-      public void done()
-      {
-         index = DONE;
-      }
-      
-      public boolean cancel()
-      {
-         return remove(this);
-      }
-   }
-}

Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutTarget.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutTarget.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/timeout/TimeoutTarget.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,36 +1,22 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, the OpenSource J2EE webOS
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
 package org.jboss.util.timeout;
 
+
 /**
- * The interface of objects that can receive timeouts.
+ *  The interface of objects that can receive timeouts.
  *   
- * @author <a href="osh at sparre.dk">Ole Husgaard</a>
- * @version $Revision$
+ *  @author <a href="osh at sparre.dk">Ole Husgaard</a>
+ *  @version $Revision$
 */
-public interface TimeoutTarget
-{
+public interface TimeoutTarget {
    /**
     *  The timeout callback function is invoked when the timeout expires.
     */
    public void timedOut(Timeout timeout);
 }
+

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/AcknowledgementRequest.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/AcknowledgementRequest.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/AcknowledgementRequest.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.Externalizable;
@@ -58,23 +42,8 @@
    
    // Constructors --------------------------------------------------
    
-   public AcknowledgementRequest()
-   {
-      this(false);
-   }
-
-   public AcknowledgementRequest(boolean ack)
-   {
-      this.isAck = ack;
-   }
-   
    // Public --------------------------------------------------------
    
-   public boolean isAck()
-   {
-      return isAck;
-   }
-   
    // Object overrides ----------------------------------------------
    
    public boolean equals(Object o)
@@ -97,8 +66,7 @@
 
    public String toString()
    {
-      return "AcknowledgementRequest:" +
-         ((isAck) ? "ACK" : "NACK") + "," + destination + "," + messageID;
+      return "AcknowledgementRequest:" + (isAck ? "ACK" : "NACK") + "," + destination + "," + messageID;
    }
 
    public void readExternal(java.io.ObjectInput in) throws java.io.IOException
@@ -126,4 +94,4 @@
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------
-}
+}
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Connection.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Connection.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Connection.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,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.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.IOException;
@@ -37,7 +21,6 @@
 import javax.jms.Queue;
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.il.ClientILService;
@@ -46,7 +29,6 @@
 
 import EDU.oswego.cs.dl.util.concurrent.ClockDaemon;
 import EDU.oswego.cs.dl.util.concurrent.Semaphore;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
 import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
 
 /**
@@ -101,6 +83,8 @@
  */
 public abstract class Connection implements Serializable, javax.jms.Connection
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    private static final long serialVersionUID = 87938199839407082L;
 
@@ -113,44 +97,71 @@
    /** Whether trace is enabled */
    static boolean trace = log.isTraceEnabled();
 
-   /** Manages the thread that pings the connection to see if it is 'alive' */
+   /**
+	 * Manages the thread that pings the connection to see if it is 'alive'
+	 */
    static protected ClockDaemon clockDaemon = new ClockDaemon();
 
-   /** Maps a destination to a LinkedList of Subscriptions */
+   // Attributes ----------------------------------------------------
+
+   /**
+	 * Maps a destination to a LinkedList of Subscriptions
+	 */
    public HashMap destinationSubscriptions = new HashMap();
 
-   /** Maps a subscription id to a Subscription */
+   /**
+	 * Maps a a subsction id to a Subscription
+	 */
    public HashMap subscriptions = new HashMap();
-
-   /** Is the connection stopped ? */
+   /**
+	 * Is the connection stopped ?
+	 */
    public boolean modeStop;
 
-   /** This is our connection to the JMS server */
+   /**
+	 * This is our connection to the JMS server
+	 */
    protected ServerIL serverIL;
 
-   /** This is the clientID */
+   /**
+	 * This is the clientID
+	 */
    protected String clientID;
 
-   /** The connection token is used to identify our connection to the server. */
+   /**
+	 * The connection token is used to identify our connection to the server.
+	 */
    protected ConnectionToken connectionToken;
 
-   /** The object that sets up the client IL */
+   /**
+	 * The object that sets up the client IL
+	 */
    protected ClientILService clientILService;
 
-   /** How often to ping the connection */
+   /**
+	 * How often to ping the connection
+	 */
    protected long pingPeriod = 1000 * 60;
 
-   /** This field is reset when a ping is sent, set when ponged. */
+   /**
+	 * This feild is reset when a ping is sent, set when ponged.
+	 */
    protected boolean ponged = true;
 
-   /** This is used to know when the PingTask is running */
+   /**
+	 * This is used to know when the PingTask is running
+	 */
    Semaphore pingTaskSemaphore = new Semaphore(1);
 
-   /** Identifies the PinkTask in the ClockDaemon */
+   /**
+	 * Identifies the PinkTask in the ClockDaemon
+	 */
    Object pingTaskId;
 
-   /** Set a soon as close() is called on the connection. */
-   private SynchronizedBoolean closing = new SynchronizedBoolean(false);
+   /**
+	 * Set a soon as close() is called on the connection.
+	 */
+   protected volatile boolean closing = false;
 
    /** Whether setClientId is Allowed */
    private volatile boolean setClientIdAllowed = true;
@@ -160,13 +171,11 @@
 
    /** Numbers subscriptions */
    int subscriptionCounter = Integer.MIN_VALUE;
-
    /** The lock for subscriptionCounter */
    Object subCountLock = new Object();
 
    /** Is the connection closed */
-   private SynchronizedBoolean closed = new SynchronizedBoolean(false);
-
+   boolean closed;
    /** Used to control tranactions */
    SpyXAResourceManager spyXAResourceManager;
 
@@ -196,7 +205,9 @@
 
    /** Temporary destinations created by this connection */
    protected HashSet temps = new HashSet();
-   
+
+   // Static --------------------------------------------------------
+
    static
    {
       log.debug("Setting the clockDaemon's thread factory");
@@ -217,6 +228,8 @@
          threadGroup = new ThreadGroup("JBossMQ Client Threads");
       return threadGroup;
    }
+   
+   // Constructors --------------------------------------------------
 
    /**
 	 * Create a new Connection
@@ -228,9 +241,11 @@
 	 */
    Connection(String userName, String password, GenericConnectionFactory genericConnectionFactory) throws JMSException
    {
+
       //Set the attributes
       createdSessions = new HashSet();
       connectionToken = null;
+      closed = false;
       lastMessageID = 0;
       modeStop = true;
 
@@ -323,6 +338,8 @@
       this(null, null, genericConnectionFactory);
    }
 
+   // Public --------------------------------------------------------
+
    /**
 	 * Gets the ServerIL attribute of the Connection object
 	 * 
@@ -368,7 +385,7 @@
    public void asynchDeliver(ReceiveRequest requests[])
    {
       // If we are closing the connection, the server will nack the messages
-      if (closing.get())
+      if (closing)
          return;
 
       if (trace)
@@ -378,24 +395,23 @@
       {
          for (int i = 0; i < requests.length; i++)
          {
-            ReceiveRequest r = requests[i];
             if (trace)
-               log.trace("Processing request=" + r + " " + this);
+               log.trace("Processing request=" + requests[i] + " " + this);
             
-            SpyConsumer consumer = (SpyConsumer) subscriptions.get(r.subscriptionId);
-            r.message.createAcknowledgementRequest(r.subscriptionId.intValue());
+            SpyConsumer consumer = (SpyConsumer) subscriptions.get(requests[i].subscriptionId);
+            requests[i].message.createAcknowledgementRequest(requests[i].subscriptionId.intValue());
 
             if (consumer == null)
             {
-               send(r.message.getAcknowledgementRequest(false));
-               log.debug("WARNING: NACK issued due to non existent subscription " + r.message.header.messageId);
+               send(requests[i].message.getAcknowledgementRequest(false));
+               log.debug("WARNING: NACK issued due to non existent subscription " + requests[i].message.header.messageId);
                continue;
             }
 
             if (trace)
-               log.trace("Delivering messageid=" + r.message.header.messageId + " to consumer=" + consumer);
+               log.trace("Delivering messageid=" + requests[i].message.header.messageId + " to consumer=" + consumer);
             
-            consumer.addMessage(r.message);
+            consumer.addMessage(requests[i].message);
          }
       }
       catch (Throwable t)
@@ -415,7 +431,7 @@
          log.trace("Notified of failure reason=" + reason + " " + this, t);
 
       // Exceptions due to closing will be ignored.
-      if (closing.get())
+      if (closing)
          return;
 
       JMSException excep = SpyJMSException.getAsJMSException(reason, t);
@@ -465,7 +481,9 @@
 	 */
    public void deleteTemporaryDestination(SpyDestination dest) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("DeleteDestination dest=" + dest + " " + this);
       try
@@ -492,9 +510,12 @@
       }
    }
 
+   // Connection implementation -------------------------------------
+
    public void setClientID(String cID) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       if (clientID != null)
          throw new IllegalStateException("The connection has already a clientID");
       if (setClientIdAllowed == false)
@@ -518,20 +539,24 @@
 
    public String getClientID() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       return clientID;
    }
 
    public ExceptionListener getExceptionListener() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
       return exceptionListener;
    }
 
    public void setExceptionListener(ExceptionListener listener) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       exceptionListener = listener;
@@ -539,7 +564,8 @@
 
    public ConnectionMetaData getMetaData() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       return new SpyConnectionMetaData();
@@ -547,12 +573,12 @@
 
    public synchronized void close() throws JMSException
    {
-      if (closed.get())
+      if (closed)
          return;
       if (trace)
          log.trace("Closing connection " + this);
       
-      closing.set(true);
+      closing = true;
 
       // We don't want to notify the exception listener
       exceptionListener = null;
@@ -566,7 +592,7 @@
       }
       catch (Throwable t)
       {
-         log.trace("Error during stop", t);
+         exception = SpyJMSException.getAsJMSException("Error duing stop", t);
       }
       
       if (trace)
@@ -578,15 +604,14 @@
       }
       for (int i = 0; i < vect.length; i++)
       {
-         SpySession session = (SpySession) vect[i];
          try
          {
-            session.close();
+            ((SpySession) vect[i]).close();
          }
          catch (Throwable t)
          {
-            if (trace)
-               log.trace("Error closing session " + session, t);
+            if (exception == null)
+               exception = SpyJMSException.getAsJMSException("Error closing sessions", t);
          }
       }
       if (trace)
@@ -600,7 +625,8 @@
       }
       catch (Throwable t)
       {
-         log.trace("Cannot close properly the connection", t);
+         if (exception == null)
+            exception = SpyJMSException.getAsJMSException("Cannot close properly the connection", t);
       }
 
       if (trace)
@@ -623,12 +649,13 @@
       }
       catch (Throwable t)
       {
-         log.trace("Cannot stop the client il service", t);
+         if (exception == null)
+            exception = SpyJMSException.getAsJMSException("Cannot stop the client il service", t);
       }
 
       // Only set the closed flag after all the objects that depend
       // on this connection have been closed.
-      closed.set(true);
+      closed = true;
 
       if (trace)
          log.trace("Disconnected from server " + this);
@@ -640,7 +667,8 @@
 
    public void start() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       if (modeStop == false)
@@ -662,11 +690,14 @@
 
    public void stop() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
       doStop();
    }
 
+   // Object overrides ----------------------------------------------
+
    public String toString()
    {
       StringBuffer buffer = new StringBuffer();
@@ -676,9 +707,9 @@
          buffer.append("token=").append(connectionToken);
       else
          buffer.append("clientID=").append(clientID);
-      if (closed.get())
+      if (closed)
          buffer.append(" CLOSED");
-      else if (closing.get())
+      else if (closing)
          buffer.append(" CLOSING");
       buffer.append(" rcvstate=");
       if (modeStop)
@@ -689,6 +720,8 @@
       return buffer.toString();
    }
 
+   // Package protected ---------------------------------------------
+
    /**
 	 * Get the next message id
 	 * <p>
@@ -705,7 +738,9 @@
 	 */
    String getNewMessageID() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       synchronized (sb)
       {
          sb.setLength(0);
@@ -760,7 +795,9 @@
 	 */
    void addConsumer(SpyConsumer consumer) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       Subscription req = consumer.getSubscription();
       synchronized (subCountLock)
       {
@@ -809,7 +846,9 @@
 	 */
    SpyMessage[] browse(Queue queue, String selector) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("Browsing queue=" + queue + " selector=" + selector + " " + this);
 
@@ -832,7 +871,9 @@
 	 */
    void pingServer(long clientTime) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       trace = log.isTraceEnabled();
       if (trace)
          log.trace("PING " + clientTime + " " + this);
@@ -857,7 +898,9 @@
 	 */
    SpyMessage receive(Subscription sub, long wait) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("Receive subscription=" + sub + " wait=" + wait);
 
@@ -883,7 +926,9 @@
     */
    void removeConsumer(SpyConsumer consumer) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       Subscription req = consumer.getSubscription();
       if (trace)
          log.trace("removeConsumer req=" + req);
@@ -909,7 +954,9 @@
     */
    void sendToServer(SpyMessage mes) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("SendToServer message=" + mes.header.jmsMessageID + " " + this);
       
@@ -974,6 +1021,8 @@
       }
    }
 
+   // Protected -----------------------------------------------------
+
    /**
 	 * Check that a clientID exists. If not get one from server.
 	 * 
@@ -1079,7 +1128,9 @@
 	 */
    protected void send(AcknowledgementRequest item) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("Acknowledge item=" + item + " " + this);
 
@@ -1101,7 +1152,9 @@
 	 */
    protected void send(TransactionRequest transaction) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (trace)
          log.trace("Transact request=" + transaction + " " + this);
 
@@ -1113,35 +1166,7 @@
       {
          SpyJMSException.rethrowAsJMSException("Cannot process a transaction", t);
       }
-   }
 
-   /**
-    * Recover
-    * 
-    * @param flags the flags
-    * @throws JMSException for any error
-    */
-   protected Xid[] recover(int flags) throws JMSException
-   {
-      checkClosed();
-      if (trace)
-         log.trace("Recover flags=" + flags + " " + this);
-
-      try
-      {
-         if (serverIL instanceof Recoverable)
-         {
-            Recoverable recoverableIL = (Recoverable) serverIL;
-            return recoverableIL.recover(connectionToken, flags);
-         }
-      }
-      catch (Throwable t)
-      {
-         SpyJMSException.rethrowAsJMSException("Cannot recover", t);
-      }
-      
-      log.warn(serverIL + " does not implement " + Recoverable.class.getName());
-      return new Xid[0];
    }
 
    /**
@@ -1184,6 +1209,8 @@
          SpyJMSException.rethrowAsJMSException("Cannot stop a the client IL service", t);
       }
    }
+
+   // Private -------------------------------------------------------
    
    /**
     * Stop delivery
@@ -1232,17 +1259,6 @@
          }
       }
    }
-   
-   /**
-    * Check whether we are closed
-    * 
-    * @throws IllegalStateException when the session is closed
-    */
-   protected void checkClosed() throws IllegalStateException
-   {
-      if (closed.get())
-         throw new IllegalStateException("The connection is closed");
-   }
 
    /**
     * Start the ping thread
@@ -1277,6 +1293,8 @@
       }
    }
 
+   // Inner classes -------------------------------------------------
+
    /**
 	 * The ping task
 	 */
@@ -1343,7 +1361,7 @@
       {
          try
          {
-            synchronized (elLock)
+            synchronized (el)
             {
                el.onException(excep);
             }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/JBossMQXid.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/JBossMQXid.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/JBossMQXid.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.Serializable;
@@ -36,9 +20,13 @@
  */
 public class JBossMQXid implements Serializable, Xid
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    private static final long serialVersionUID = -2227021688745286343L;
 
+   // Attributes ----------------------------------------------------
+
    /** The format id */
    private int formatId;
 
@@ -54,6 +42,10 @@
    /** Cached hashCode() */
    private transient int cachedHashCode;
 
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
    /**
     * Create a new wrapper Xid
     * 
@@ -66,6 +58,10 @@
       branchQualifier = xid.getBranchQualifier();
    }
 
+   // Public --------------------------------------------------------
+
+   // Xid implementation --------------------------------------------
+
    public int getFormatId()
    {
       return formatId;
@@ -81,6 +77,8 @@
       return branchQualifier;
    }
 
+   // Object overrides ----------------------------------------------
+
    public boolean equals(Object object)
    {
       if (object == null || (object instanceof Xid) == false)
@@ -113,15 +111,18 @@
          StringBuffer buffer = new StringBuffer();
          buffer.append("JBossMQXid[FormatId=").append(getFormatId());
          buffer.append(" GlobalId=").append(new String(getGlobalTransactionId()).trim());
-         byte[] branchQualifer = getBranchQualifier();
-         buffer.append(" BranchQual=");
-         if (branchQualifer == null)
-            buffer.append("null");
-         else
-            buffer.append(new String(getBranchQualifier()).trim());
+         buffer.append(" BranchQual=").append(new String(getBranchQualifier()).trim());
          buffer.append(']');
          cachedToString = buffer.toString();
       }
       return cachedToString;
    }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Deleted: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Recoverable.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Recoverable.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/Recoverable.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,44 +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.mq;
-
-import javax.transaction.xa.Xid;
-
-
-/**
-* Adds the ability to recover() for this serverIL
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public interface Recoverable
-{
-   /**
-    * Recover
-    * 
-    * @param dc the connnection token
-    * @param flags the recovery flags
-    * @return the xids
-    * @throws Exception for any error
-    */
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception;
-}
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyConnection.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyConnection.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyConnection.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.Serializable;
@@ -52,20 +36,14 @@
  */
 public class SpyConnection extends Connection implements Serializable, TopicConnection, QueueConnection
 {
+   // Constants -----------------------------------------------------
+
    private static final long serialVersionUID = -6227193901482445607L;
 
-   /** Unified */
-   public static final int UNIFIED = 0; 
+   // Attributes ----------------------------------------------------
 
-   /** Queue */
-   public static final int QUEUE = 1; 
+   // Constructor ---------------------------------------------------
 
-   /** Topic */
-   public static final int TOPIC = 2; 
-   
-   /** The type of connection */
-   private int type = UNIFIED;
-   
    /**
 	 * Create a new SpyConnection
 	 * 
@@ -90,47 +68,26 @@
       super(gcf);
    }
 
-   /**
-    * Create a new SpyConnection
-    * 
-    * @param type the type of connection 
-    * @param userId the user
-    * @param password the password
-    * @param gcf the constructing class
-    * @throws JMSException for any error
-    */
-   public SpyConnection(int type, String userId, String password, GenericConnectionFactory gcf) throws JMSException
-   {
-      super(userId, password, gcf);
-      this.type = type;
-   }
+   // Public --------------------------------------------------------
 
-   /**
-    * Create a new SpyConnection
-    * @param type the type of connection 
-    * @param gcf the constructing class
-    * @throws JMSException for any error
-    */
-   public SpyConnection(int type, GenericConnectionFactory gcf) throws JMSException
-   {
-      super(gcf);
-      this.type = type;
-   }
+   // Connection implementation -------------------------------------
 
    public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector,
          ServerSessionPool sessionPool, int maxMessages) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (destination == null)
          throw new InvalidDestinationException("Null destination");
-      checkTemporary(destination);
-      
+
       return new SpyConnectionConsumer(this, destination, messageSelector, sessionPool, maxMessages);
    }
 
    public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       if (transacted)
@@ -146,9 +103,12 @@
       return session;
    }
 
+   // TopicConnection implementation --------------------------------
+
    public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       if (transacted)
@@ -167,13 +127,13 @@
    public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector,
          ServerSessionPool sessionPool, int maxMessages) throws JMSException
    {
-      checkClosed();
-      if (type == QUEUE)
-         throw new IllegalStateException("Cannot create a topic consumer on a QueueConnection");
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (topic == null)
          throw new InvalidDestinationException("Null topic");
+
       checkClientID();
-      checkTemporary(topic);
 
       return new SpyConnectionConsumer(this, topic, messageSelector, sessionPool, maxMessages);
    }
@@ -181,9 +141,9 @@
    public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName,
          String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
    {
-      checkClosed();
-      if (type == QUEUE)
-         throw new IllegalStateException("Cannot create a topic consumer on a QueueConnection");
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (topic == null)
          throw new InvalidDestinationException("Null topic");
       if (topic instanceof TemporaryTopic)
@@ -199,20 +159,23 @@
    public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector,
          ServerSessionPool sessionPool, int maxMessages) throws JMSException
    {
-      checkClosed();
-      if (type == TOPIC)
-         throw new IllegalStateException("Cannot create a queue consumer on a TopicConnection");
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
+
       if (queue == null)
          throw new InvalidDestinationException("Null queue");
-      checkTemporary(queue);
 
       return new SpyConnectionConsumer(this, queue, messageSelector, sessionPool, maxMessages);
    }
 
+   // QueueConnection implementation --------------------------------
+
    public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
+
       if (transacted)
          acknowledgeMode = 0;
       QueueSession session = new SpyQueueSession(this, transacted, acknowledgeMode);
@@ -226,10 +189,14 @@
       return session;
    }
    
+   // Package protected ---------------------------------------------
+   
    TemporaryTopic getTemporaryTopic() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
+
       try
       {
          SpyTemporaryTopic temp = (SpyTemporaryTopic) serverIL.getTemporaryTopic(connectionToken);
@@ -249,10 +216,12 @@
 
    Topic createTopic(String name) throws JMSException
    {
-      checkClosed();
-      checkClientID();
       try
       {
+         if (closed)
+            throw new IllegalStateException("The connection is closed");
+         checkClientID();
+
          return serverIL.createTopic(connectionToken, name);
       }
       catch (Throwable t)
@@ -264,8 +233,12 @@
 
    TemporaryQueue getTemporaryQueue() throws JMSException
    {
-      checkClosed();
+      if (closed)
+      {
+         throw new IllegalStateException("The connection is closed");
+      }
       checkClientID();
+
       try
       {
          SpyTemporaryQueue temp = (SpyTemporaryQueue) serverIL.getTemporaryQueue(connectionToken);
@@ -285,10 +258,11 @@
 
    Queue createQueue(String name) throws JMSException
    {
-      checkClosed();
-      checkClientID();
       try
       {
+         if (closed)
+            throw new IllegalStateException("The connection is closed");
+         checkClientID();
 
          return serverIL.createQueue(connectionToken, name);
       }
@@ -298,4 +272,10 @@
          throw new UnreachableStatementException();
       }
    }
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyJMSException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyJMSException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyJMSException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,12 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/***************************************
+ *                                     *
+ *  JBoss: The OpenSource J2EE WebOS   *
+ *                                     *
+ *  Distributable under LGPL license.  *
+ *  See terms of license at gnu.org.   *
+ *                                     *
+ ***************************************/
+
 package org.jboss.mq;
 
 import java.io.PrintWriter;
@@ -39,12 +27,18 @@
  */
 public class SpyJMSException extends JMSException implements NestedThrowable
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    static final long serialVersionUID = 5216406958161784593L;
 
+   // Attributes ----------------------------------------------------
+
    /** The nested throwable */
    protected Throwable nested;
 
+   // Static --------------------------------------------------------
+
    /**
     * Converts a throwable to a JMSException if it is not already
     * 
@@ -71,6 +65,8 @@
       else
          return new SpyJMSException(message, t);
    }
+   
+   // Constructors --------------------------------------------------
 
    /**
 	 * Construct a <tt>SpyJMSException</tt> with the specified detail message.
@@ -110,6 +106,8 @@
       NestedThrowable.Util.checkNested(this, nested);
    }
 
+   // Public --------------------------------------------------------
+
    /**
 	 * Construct a <tt>SpyJMSException</tt> with the specified nested <tt>Throwable</tt>.
 	 * 
@@ -120,6 +118,8 @@
       this(nested.getMessage(), nested);
    }
 
+   // NestedException implementation --------------------------------
+
    public void setLinkedException(final Exception e)
    {
       this.nested = e;
@@ -136,6 +136,8 @@
       return new NestedException(nested);
    }
 
+   // Throwable overrides -------------------------------------------
+
    public Throwable getNested()
    {
       return nested;
@@ -169,4 +171,12 @@
    {
       printStackTrace(System.err);
    }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyMessage.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyMessage.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyMessage.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.Externalizable;
@@ -33,6 +17,7 @@
 import java.util.Map;
 
 import javax.jms.Destination;
+import javax.jms.IllegalStateException;
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageFormatException;
@@ -59,11 +44,6 @@
    private final static long serialVersionUID = 467206190892964404L;
 
    /**
-    * Standard property for delivery count
-    */
-   public static final String PROPERTY_DELIVERY_COUNT = "JMSXDeliveryCount";
-
-   /**
 	 * JBoss-vendor specific property for scheduling a JMS message. In
 	 * milliseconds since January 1, 1970.
 	 */
@@ -89,21 +69,6 @@
 	 */
    public static final String PROPERTY_REDELIVERY_LIMIT = "JMS_JBOSS_REDELIVERY_LIMIT";
 
-   /** 
-   * JBoss-vendor property name holding original destination.
-   */
-   public static final String PROPERTY_ORIG_DESTINATION = "JBOSS_ORIG_DESTINATION";
-
-   /** 
-   * JBoss-vendor property name holding original expiration value.
-   */
-   public static final String PROPERTY_ORIG_EXPIRATION = "JBOSS_ORIG_EXPIRATION";
-
-   /** 
-   * JBoss-vendor property name holding original message ID value.
-   */
-   public static final String PROPERTY_ORIG_MESSAGEID = "JBOSS_ORIG_MESSAGEID";
-
    /** An object message */
    protected static final byte OBJECT_MESS = 1;
    /** An bytes message */
@@ -350,10 +315,26 @@
     */
    public void doAcknowledge() throws JMSException
    {
+      if (session.closed)
+         throw new IllegalStateException("Session is closed.");
       session.doAcknowledge(this, getAcknowledgementRequest(true));
    }
 
    /**
+    * Actually nack a message
+    *
+    * @throws JMSException for any error
+    */
+   public void doNegAcknowledge() throws JMSException
+   {
+      if (session.closed)
+      {
+         throw new IllegalStateException("Session is closed.");
+      }
+      session.doAcknowledge(this, getAcknowledgementRequest(false));
+   }
+
+   /**
     * Create an acknowledgement request for the message
     */
    public void createAcknowledgementRequest(int subscriptionId)
@@ -373,10 +354,11 @@
    public AcknowledgementRequest getAcknowledgementRequest(boolean isAck) throws JMSException
    {
       //don't know if we have to copy but to be on safe side...
-      AcknowledgementRequest item = new AcknowledgementRequest(isAck);
+      AcknowledgementRequest item = new AcknowledgementRequest();
       item.destination = ack.destination;
       item.messageID = ack.messageID;
       item.subscriberId = ack.subscriberId;
+      item.isAck = isAck;
       return item;
    }
 
@@ -953,6 +935,9 @@
       if (name.equals(""))
          throw new IllegalArgumentException("The name of a property must not be an empty String.");
 
+      if (Strings.isValidJavaIdentifier(name) == false)
+         throw new IllegalArgumentException("The property name '" + name + "' is not a valid java identifier.");
+
       if (reservedIdentifiers.contains(name))
          throw new IllegalArgumentException("The property name '" + name + "' is reserved due to selector syntax.");
 
@@ -978,19 +963,6 @@
             if (!(value instanceof Number))
                throw new JMSException(name + " must be Number: " + value);
          }
-         else if (name.equals(PROPERTY_ORIG_EXPIRATION))
-         {
-            if (!(value instanceof Long))
-               throw new JMSException(name + " must be Long: " + value);
-         }
-         else if (name.equals(PROPERTY_ORIG_DESTINATION))
-         {
-            // no validation
-         }
-         else if (name.equals(PROPERTY_ORIG_MESSAGEID))
-         {
-            // no validation
-         }
          else
          {
             throw new JMSException("Illegal property name: " + name);
@@ -1005,10 +977,6 @@
             return;
          throw new JMSException("Illegal property name: " + name);
       }
-
-      if (Strings.isValidJavaIdentifier(name) == false)
-         throw new IllegalArgumentException("The property name '" + name + "' is not a valid java identifier.");
-
    }
 
    /**

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAConnection.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAConnection.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAConnection.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,28 +1,13 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq;
 
 import java.io.Serializable;
 
+import javax.jms.IllegalStateException;
 import javax.jms.JMSException;
 import javax.jms.QueueSession;
 import javax.jms.Session;
@@ -43,8 +28,16 @@
  */
 public class SpyXAConnection extends SpyConnection implements Serializable, XAConnection, XATopicConnection, XAQueueConnection
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    static final long serialVersionUID = 1258716704996031025L;
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
 
    /**
     * Create a new SpyXAConnection
@@ -70,6 +63,10 @@
       super(gcf);
    }
    
+   // Public --------------------------------------------------------
+   
+   // Connection overrides ------------------------------------------
+   
    public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
       return createXASession();
@@ -84,10 +81,13 @@
    {
       return (TopicSession) createXATopicSession();
    }
+   
+   // XAConnection implementation -----------------------------------
 
    public XASession createXASession() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       XASession session = new SpySession(this, true, 0, true);
@@ -101,7 +101,8 @@
 
    public XAQueueSession createXAQueueSession() throws JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       XAQueueSession session = new SpyQueueSession(this, true, 0, true);
@@ -117,7 +118,8 @@
 
    public XATopicSession createXATopicSession() throws javax.jms.JMSException
    {
-      checkClosed();
+      if (closed)
+         throw new IllegalStateException("The connection is closed");
       checkClientID();
 
       XATopicSession session = new SpyTopicSession(this, true, 0, true);
@@ -128,4 +130,12 @@
       }
       return session;
    }
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAException.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAException.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAException.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,33 +1,21 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/***************************************
+ *                                     *
+ *  JBoss: The OpenSource J2EE WebOS   *
+ *                                     *
+ *  Distributable under LGPL license.  *
+ *  See terms of license at gnu.org.   *
+ *                                     *
+ ***************************************/
+
 package org.jboss.mq;
 
-import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.io.PrintStream;
 
 import javax.transaction.xa.XAException;
 
-import org.jboss.util.NestedException;
 import org.jboss.util.NestedThrowable;
+import org.jboss.util.NestedException;
 
 /**
  * An XAException with a nested throwable
@@ -37,43 +25,19 @@
  */
 public class SpyXAException extends XAException implements NestedThrowable
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    static final long serialVersionUID = 7814140228056884098L;
+   
+   // Attributes ----------------------------------------------------
 
    /** The nested throwable */
    protected Throwable nested;
-
-   /**
-    * Converts a throwable to an XAException if it is not already
-    * 
-    * @param message any message to add to a constructed XAException
-    * @param t the throwable
-    * @return XAException never (always throws)
-    * @throws XAException always
-    */
-   public static XAException rethrowAsXAException(String message, Throwable t) throws XAException
-   {
-      throw getAsXAException(message, t);
-   }
    
-   /**
-    * Converts a throwable to an XAException if it is not already
-    * 
-    * @param message any message to add to a constructed XAException
-    * @param t the throwable
-    * @return an XAException
-    */
-   public static XAException getAsXAException(String message, Throwable t)
-   {
-      if (t instanceof XAException)
-         return (XAException) t;
-      else
-      {
-         SpyXAException e = new SpyXAException(message, t);
-         e.errorCode = XAException.XAER_RMERR;
-         return e;
-      }
-   }
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
 
    /**
     * Construct a <tt>SpyXAException</tt>
@@ -142,11 +106,17 @@
       super(code);
       this.nested = t;
    }
+   
+   // Public --------------------------------------------------------
+   
+   // NestedException implementation --------------------------------
 
    public Throwable getNested()
    {
       return nested;
    }
+   
+   // Throwable overrides -------------------------------------------
 
    public Throwable getCause()
    {
@@ -167,7 +137,7 @@
       if (nested == null)
          return this;
       if (nested instanceof Exception)
-      {
+        {
          return (Exception) nested;
       }
       return new NestedException(nested);
@@ -181,7 +151,7 @@
    public void printStackTrace(final PrintStream stream)
    {
       if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED)
-      {
+        {
          super.printStackTrace(stream);
       }
       NestedThrowable.Util.print(nested, stream);
@@ -190,7 +160,7 @@
    public void printStackTrace(final PrintWriter writer)
    {
       if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED)
-      {
+        {
          super.printStackTrace(writer);
       }
       NestedThrowable.Util.print(nested, writer);
@@ -200,4 +170,13 @@
    {
       printStackTrace(System.err);
    }
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResource.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResource.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResource.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+
 package org.jboss.mq;
 
 import javax.transaction.xa.XAException;
@@ -36,14 +21,22 @@
  */
 public class SpyXAResource implements XAResource
 {
+   // Constants -----------------------------------------------------
+
    /** The log */
    private static final Logger log = Logger.getLogger(SpyXAResource.class);
    
    /** Whether trace is enabled */
    private static boolean trace = log.isTraceEnabled();
+   
+   // Attributes ----------------------------------------------------
 
    /** The session */
    SpySession session;
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
 
    /**
     * Create a new SpyXAResource
@@ -59,6 +52,10 @@
       if (trace)
          log.trace("Created " + this);
    }
+   
+   // Public --------------------------------------------------------
+   
+   // XAResource implementation -------------------------------------
 
    public boolean setTransactionTimeout(int arg1) throws XAException
    {
@@ -76,20 +73,18 @@
          return false;
       return ((SpyXAResource) arg1).session.connection.spyXAResourceManager == session.connection.spyXAResourceManager;
    }
-
    public void commit(Xid xid, boolean onePhase) throws XAException
    {
       if (trace)
          log.trace("Commit xid=" + xid + ", onePhase=" + onePhase + " " + this);
 
-      xid = convertXid(xid);
       try
       {
          session.connection.spyXAResourceManager.commit(xid, onePhase);
       }
       catch (Throwable t)
       {
-         throw SpyXAException.getAsXAException("Resource manager error during commit", t);
+         throw new SpyXAException(XAException.XAER_RMERR, t);
       }
    }
 
@@ -98,7 +93,6 @@
       if (trace)
          log.trace("End xid=" + xid + ", flags=" + flags + " " +this);
 
-      xid = convertXid(xid);
       synchronized (session.runLock)
       {
 
@@ -124,72 +118,51 @@
    {
       if (trace)
          log.trace("Forget xid=" + xid + " " + this);
-      
-      xid = convertXid(xid);
-      try
-      {
-         session.connection.spyXAResourceManager.forget(xid);
-      }
-      catch (Throwable t)
-      {
-         throw SpyXAException.getAsXAException("Resource manager error during forget", t);
-      }
    }
 
    public int prepare(Xid xid) throws XAException
    {
-      if (trace)
+      if (log.isTraceEnabled())
          log.trace("Prepare xid=" + xid + " " + this);
 
-      xid = convertXid(xid);
       try
       {
          return session.connection.spyXAResourceManager.prepare(xid);
       }
       catch (Throwable t)
       {
-         throw SpyXAException.getAsXAException("Resource manager error during prepare", t);
+         throw new SpyXAException(XAException.XAER_RMERR, t);
       }
    }
 
    public Xid[] recover(int arg1) throws XAException
    {
-      if (trace)
+      if (log.isTraceEnabled())
          log.trace("Recover arg1=" + arg1 + " " + this);
 
-      try
-      {
-         return session.connection.spyXAResourceManager.recover(arg1);
-      }
-      catch (Throwable t)
-      {
-         throw SpyXAException.getAsXAException("Resource manager error during recover", t);
-      }
+      return new Xid[0];
    }
 
    public void rollback(Xid xid) throws XAException
    {
-      if (trace)
+      if (log.isTraceEnabled())
          log.trace("Rollback xid=" + xid + " " + this);
 
-      xid = convertXid(xid);
       try
       {
          session.connection.spyXAResourceManager.rollback(xid);
       }
       catch (Throwable t)
       {
-         throw SpyXAException.getAsXAException("Resource manager error during rollback", t);
+         throw new SpyXAException(XAException.XAER_RMERR, t);
       }
    }
 
    public void start(Xid xid, int flags) throws XAException
    {
-      if (trace)
+      if (log.isTraceEnabled())
          log.trace("Start xid=" + xid + ", flags=" + flags + " " + this);
 
-      xid = convertXid(xid);
-
       boolean convertTx = false;
       if (session.getCurrentTransactionId() != null)
       {
@@ -199,9 +172,7 @@
          }
          else
          {
-            XAException e = new XAException("Attempt to enlist in " + xid + " with TMNOFLAGS when already enlisted " + session.getCurrentTransactionId());
-            e.errorCode = XAException.XAER_OUTSIDE; // REVIEW: Is this the correct error code?
-            throw e;
+            throw new XAException(XAException.XAER_OUTSIDE);
          }
       }
 
@@ -234,30 +205,18 @@
       }
    }
    
+   // Object overrides ----------------------------------------------
+   
    public String toString()
    {
       return "SpyXAResource[session=" + session + ']';
    }
    
-   /**
-    * Convert the external xid to our internal one
-    * 
-    * @param xid the xid
-    * @return our internal xid
-    * @throws XAException for a null xid
-    */
-   protected Xid convertXid(Xid xid) throws XAException
-   {
-      if (xid == null)
-      {
-         XAException e = new XAException("Null xid");
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
-      
-      if (xid instanceof JBossMQXid)
-         return xid;
-      
-      return new JBossMQXid(xid);
-   }
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResourceManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResourceManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/SpyXAResourceManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+
 package org.jboss.mq;
 
 import java.io.Serializable;
@@ -29,7 +14,6 @@
 
 import javax.jms.JMSException;
 import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
@@ -44,6 +28,8 @@
  */
 public class SpyXAResourceManager implements Serializable
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    static final long serialVersionUID = -6268132972627753772L;
    /** The log */
@@ -57,7 +43,8 @@
    private final static byte TX_PREPARED = 3;
    private final static byte TX_COMMITED = 4;
    private final static byte TX_ROLLEDBACK = 5;
-   private final static byte TX_READONLY = 6;
+   
+   // Attributes ----------------------------------------------------
 
    /** The connection */
    private Connection connection;
@@ -65,7 +52,11 @@
    private Map transactions = new ConcurrentReaderHashMap();
    /** The next xid */
    private long nextInternalXid = Long.MIN_VALUE;
+
+   // Static --------------------------------------------------------
    
+   // Constructors --------------------------------------------------
+   
    /**
     * Create a new SpyXAResourceManager
     *
@@ -76,6 +67,8 @@
       super();
       connection = conn;
    }
+   
+   // Public --------------------------------------------------------
 
    /**
     * Acknowledge a message
@@ -134,20 +127,10 @@
 
       TXState state = (TXState) transactions.remove(xid);
       if (state == null)
-      {
-         XAException e = new XAException("Unknown transaction during commit " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
 
       if (onePhase)
-      {
-         if (state.isReadOnly())
-         {
-            if (trace)
-               log.trace("Nothing to do for " + xid);
-         }
-         
+        {
          TransactionRequest transaction = new TransactionRequest();
          transaction.requestType = TransactionRequest.ONE_PHASE_COMMIT_REQUEST;
          transaction.xid = null;
@@ -167,18 +150,8 @@
       }
       else
       {
-         if (state.txState == TX_READONLY)
-         {
-            if (trace)
-               log.trace("Nothing to do for " + xid);
-            return;
-         }
          if (state.txState != TX_PREPARED)
-         {
-            XAException e = new XAException("Cannot complete 2 phase commit, the transaction has not been prepared " + xid);
-            e.errorCode = XAException.XAER_PROTO;
-            throw e;
-         }
+            throw new XAException("The transaction had not been prepared");
          TransactionRequest transaction = new TransactionRequest();
          transaction.xid = xid;
          transaction.requestType = TransactionRequest.TWO_PHASE_COMMIT_COMMIT_REQUEST;
@@ -194,11 +167,7 @@
 
       TXState state = (TXState) transactions.get(xid);
       if (state == null)
-      {
-         XAException e = new XAException("Unknown transaction during delist " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       state.txState = TX_ENDED;
    }
 
@@ -208,11 +177,7 @@
          log.trace("Joining tx xid=" + xid);
 
       if (!transactions.containsKey(xid))
-      {
-         XAException e = new XAException("Unknown transaction during join " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       return xid;
    }
 
@@ -223,20 +188,7 @@
 
       TXState state = (TXState) transactions.get(xid);
       if (state == null)
-      {
-         XAException e = new XAException("Unknown transaction during prepare " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
-
-      if (state.isReadOnly())
-      {
-         if (trace)
-            log.trace("Vote read only for " + xid);
-         state.txState = TX_READONLY;
-         return XAResource.XA_RDONLY;
-      }
-      
+         throw new XAException(XAException.XAER_NOTA);
       TransactionRequest transaction = new TransactionRequest();
       transaction.requestType = TransactionRequest.TWO_PHASE_COMMIT_PREPARE_REQUEST;
       transaction.xid = xid;
@@ -254,7 +206,7 @@
       }
       connection.send(transaction);
       state.txState = TX_PREPARED;
-      return XAResource.XA_OK;
+      return javax.transaction.xa.XAResource.XA_OK;
    }
 
    public Object resumeTx(Xid xid) throws XAException
@@ -263,11 +215,7 @@
          log.trace("Resuming tx xid=" + xid);
 
       if (!transactions.containsKey(xid))
-      {
-         XAException e = new XAException("Unknown transaction during resume " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       return xid;
    }
 
@@ -278,17 +226,7 @@
 
       TXState state = (TXState) transactions.remove(xid);
       if (state == null)
-      {
-         XAException e = new XAException("Unknown transaction during rollback " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
-      if (state.txState == TX_READONLY)
-      {
-         if (trace)
-            log.trace("Nothing to do for " + xid);
-         return;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       if (state.txState != TX_PREPARED)
       {
          TransactionRequest transaction = new TransactionRequest();
@@ -301,7 +239,7 @@
             transaction.acks = job;
             //Neg Acknowlege all consumed messages
             for (int i = 0; i < transaction.acks.length; i++)
-            {
+              {
                transaction.acks[i].isAck = false;
             }
          }
@@ -317,39 +255,6 @@
       state.txState = TX_ROLLEDBACK;
    }
 
-   public Xid[] recover(int arg) throws XAException, JMSException
-   {
-      if (trace)
-         log.trace("Recover arg=" + arg);
-      
-      Xid[] xids = connection.recover(arg);
-
-      // Make sure we have a reference to each xid
-      for (int i = 0; i < xids.length; ++i)
-      {
-         if (transactions.containsKey(xids[i]) == false)
-         {
-            TXState state = new TXState();
-            state.txState = TX_PREPARED;
-            transactions.put(xids[i], state);
-         }
-      }
-      return xids;
-   }
-
-   public void forget(Xid xid) throws XAException, JMSException
-   {
-      if (trace)
-         log.trace("Forget xid=" + xid);
-
-      TXState state = (TXState) transactions.get(xid);
-      if (state == null)
-         return;
-      if (state.txState != TX_PREPARED)
-         transactions.remove(xid);
-      rollback(xid);
-   }
-   
    public synchronized Long getNewXid()
    {
       return new Long(nextInternalXid++);
@@ -372,11 +277,7 @@
          log.trace("Starting tx xid=" + xid);
 
       if (transactions.containsKey(xid))
-      {
-         XAException e = new XAException("Duplicate transaction id during enlist " + xid);
-         e.errorCode = XAException.XAER_DUPID;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_DUPID);
       transactions.put(xid, new TXState());
       return xid;
    }
@@ -387,11 +288,7 @@
          log.trace("Suppending tx xid=" + xid);
 
       if (!transactions.containsKey(xid))
-      {
-         XAException e = new XAException("Unknown transaction during suspend " + xid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       return xid;
    }
 
@@ -401,37 +298,32 @@
          log.trace("Converting tx anonXid=" + anonXid + ", xid=" + xid);
 
       if (!transactions.containsKey(anonXid))
-      {
-         XAException e = new XAException("Unknown transaction during convert " + anonXid);
-         e.errorCode = XAException.XAER_NOTA;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_NOTA);
       if (transactions.containsKey(xid))
-      {
-         XAException e = new XAException("Duplicate transaction during convert " + xid);
-         e.errorCode = XAException.XAER_DUPID;
-         throw e;
-      }
+         throw new XAException(XAException.XAER_DUPID);
       TXState s = (TXState) transactions.remove(anonXid);
 
       transactions.put(xid, s);
       return xid;
    }
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
 
    /**
-    * The transaction state
-	*/
+	  * The transaction state
+	  */
    static class TXState
    {
       byte txState = TX_OPEN;
       ArrayList sentMessages = new ArrayList();
       ArrayList ackedMessages = new ArrayList();
 
-      public boolean isReadOnly()
-      {
-         return sentMessages.size() == 0 && ackedMessages.size() == 0;
-      }
-      
       public String toString()
       {
          StringBuffer buffer = new StringBuffer(100);

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/http/HTTPServerIL.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/http/HTTPServerIL.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/http/HTTPServerIL.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.http;
 
 import java.io.Serializable;
@@ -29,13 +14,11 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.Subscription;
@@ -54,7 +37,7 @@
  * @version   $Revision$
  * @created   January 15, 2003
  */
-public class HTTPServerIL implements Serializable, ServerIL, Recoverable
+public class HTTPServerIL implements Serializable, ServerIL
 {
     static final long serialVersionUID = -864073076154976490L;
 
@@ -350,20 +333,6 @@
         this.postRequest(request);
     }
     
-    public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-    {
-        if (log.isTraceEnabled())
-            log.trace("recover(ConnectionToken " + dc + ", flags=" + flags + ")");
-        HTTPILRequest request = new HTTPILRequest();
-        request.setMethodName("recover");
-        request.setArguments
-        (
-           new Object[] { dc, new Integer(flags) }, 
-           new Class[]  { ConnectionToken.class, Integer.class }
-        );
-        return (Xid[]) this.postRequest(request);
-    }
-    
     public void unsubscribe(ConnectionToken dc, int subscriptionId) throws Exception
     {
         if (log.isTraceEnabled())

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/jvm/JVMServerIL.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/jvm/JVMServerIL.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/jvm/JVMServerIL.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+ * JBoss, the OpenSource J2EE webOS
  *
- * 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.
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
  */
 package org.jboss.mq.il.jvm;
 
@@ -27,12 +12,10 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.TransactionRequest;
@@ -45,11 +28,10 @@
  * @author    Hiram Chirino (Cojonudo14 at hotmail.com)
  * @author    Norbert Lataille (Norbert.Lataille at m4x.org)
  * @author    <a href="pra at tim.se">Peter Antman</a>
- * @author    <a href="adrian at jboss.org">Adrian Brock</a>
  * @version   $Revision$
  * @created   August 16, 2001
  */
-public class JVMServerIL implements ServerIL, Recoverable
+public class JVMServerIL implements org.jboss.mq.il.ServerIL
 {
    //The server implementation
    private final Invoker server;
@@ -61,132 +43,300 @@
     */
    public JVMServerIL(Invoker s)
    {
-      if (s == null)
+      if (s == null) 
+      {
          throw new IllegalArgumentException("JMSServer must be non null in constructor");
+      } // end of if ()
+      
       server = s;
    }
 
+   /**
+    * Sets the ConnectionToken attribute of the JVMServerIL object
+    *
+    * @param newConnectionToken  The new ConnectionToken value
+    */
    public void setConnectionToken(ConnectionToken newConnectionToken)
    {
       // We cannot try to cache the token since this IL is stateless
    }
 
-   public void setEnabled(ConnectionToken dc, boolean enabled) throws Exception
+   /**
+    * Sets the Enabled attribute of the JVMServerIL object
+    *
+    * @param dc             The new Enabled value
+    * @param enabled        The new Enabled value
+    * @exception Exception  Description of Exception
+    */
+   public void setEnabled(ConnectionToken dc, boolean enabled)
+          throws Exception
    {
       server.setEnabled(dc, enabled);
    }
 
-   public String getID() throws JMSException
+   /**
+    * Gets the ID attribute of the JVMServerIL object
+    *
+    * @return                  The ID value
+    * @exception JMSException  Description of Exception
+    */
+   public String getID()
+          throws JMSException
    {
       return server.getID();
    }
 
-   public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws JMSException
+   /**
+    * Gets the TemporaryQueue attribute of the JVMServerIL object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    */
+   public TemporaryQueue getTemporaryQueue(ConnectionToken dc)
+          throws JMSException
    {
       return server.getTemporaryQueue(dc);
    }
 
-   public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws JMSException
+   /**
+    * Gets the TemporaryTopic attribute of the JVMServerIL object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    */
+   public TemporaryTopic getTemporaryTopic(ConnectionToken dc)
+          throws JMSException
    {
       return server.getTemporaryTopic(dc);
    }
 
+   /**
+    * No need to clone because there are no instance variables tha can get
+    * clobbered. All Multiple connections can share the same JVMServerIL object
+    *
+    * @return   Description of the Returned Value
+    */
    public ServerIL cloneServerIL()
    {
       return this;
    }
 
-   public void addMessage(ConnectionToken dc, SpyMessage val) throws JMSException
+   /**
+    * Adds a feature to the Message attribute of the JVMServerIL object
+    *
+    * @param dc                The feature to be added to the Message attribute
+    * @param val               The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
+   public void addMessage(ConnectionToken dc, SpyMessage val)
+          throws JMSException
    {
       server.addMessage(dc, val.myClone());
    }
 
-   public Topic createTopic(ConnectionToken dc, String dest) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
+   public Topic createTopic(ConnectionToken dc, String dest)
+          throws JMSException
    {
       return server.createTopic(dc, dest);
    }
 
-   public Queue createQueue(ConnectionToken dc, String dest) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
+   public Queue createQueue(ConnectionToken dc, String dest)
+          throws JMSException
    {
       return server.createQueue(dc, dest);
    }
 
-   public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
+   public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest)
+          throws JMSException
    {
       server.deleteTemporaryDestination(dc, dest);
    }
 
-   public void checkID(String ID) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param ID                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
+   public void checkID(String ID)
+          throws JMSException
    {
       server.checkID(ID);
    }
 
-   public void connectionClosing(ConnectionToken dc) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
+   public void connectionClosing(ConnectionToken dc)
+          throws JMSException
    {
       server.connectionClosing(dc);
    }
 
-   public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param item           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void acknowledge(ConnectionToken dc, AcknowledgementRequest item)
+          throws Exception
    {
       server.acknowledge(dc, item);
    }
 
-   public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @param selector       Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception Exception  Description of Exception
+    */
+   public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector)
+          throws Exception
    {
       return server.browse(dc, dest, selector);
    }
 
-   public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param subscriberId   Description of Parameter
+    * @param wait           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception Exception  Description of Exception
+    */
+   public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait)
+          throws Exception
    {
       SpyMessage message = server.receive(dc, subscriberId, wait);
       //copy message to avoid server side problems with persisted message if message is edited client side.
-      if (message != null)
+      if(message != null)
          message = message.myClone();
       return message;
    }
 
-   public void unsubscribe(ConnectionToken dc, int subscriptionId) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param dc              Description of Parameter
+    * @param subscriptionId  Description of Parameter
+    * @exception Exception   Description of Exception
+    */
+   public void unsubscribe(ConnectionToken dc, int subscriptionId)
+          throws Exception
    {
       server.unsubscribe(dc, subscriptionId);
    }
 
-   public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param id             Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void destroySubscription(ConnectionToken dc,DurableSubscriptionID id)
+          throws Exception
    {
-      server.destroySubscription(dc, id);
+      server.destroySubscription(dc,id);
    }
 
-   public String checkUser(String userName, String password) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param userName          Description of Parameter
+    * @param password          Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
+   public String checkUser(String userName, String password)
+          throws JMSException
    {
       return server.checkUser(userName, password);
    }
-
-   public String authenticate(String userName, String password) throws JMSException
+   
+   /**
+    * Authenticate user
+    *
+    * @param userName          Description of Parameter
+    * @param password          Description of Parameter
+    * @return                  a sessionID
+    * @exception JMSException  Description of Exception
+    */
+   public String authenticate(String userName, String password)
+          throws JMSException
    {
       return server.authenticate(userName, password);
    }
 
-   public void subscribe(ConnectionToken dc, org.jboss.mq.Subscription s) throws Exception
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param s              Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void subscribe(ConnectionToken dc, org.jboss.mq.Subscription s)
+          throws Exception
    {
       server.subscribe(dc, s.myClone());
    }
 
-   public void transact(org.jboss.mq.ConnectionToken dc, TransactionRequest t) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param t                 Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
+   public void transact(org.jboss.mq.ConnectionToken dc, TransactionRequest t)
+          throws JMSException
    {
       server.transact(dc, t);
    }
 
-   public void ping(org.jboss.mq.ConnectionToken dc, long clientTime) throws JMSException
+   /**
+    * ping method comment.
+    *
+    * @param dc                Description of Parameter
+    * @param clientTime        Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
+   public void ping(org.jboss.mq.ConnectionToken dc, long clientTime)
+          throws JMSException
    {
       server.ping(dc, clientTime);
    }
-
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      if (server instanceof Recoverable)
-      {
-         Recoverable recoverable = (Recoverable) server;
-         return recoverable.recover(dc, flags);
-      }
-      throw new IllegalStateException("Invoker does not implement recoverable " + server);
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,34 +1,17 @@
 /*
-* 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.
+* JBoss, the OpenSource J2EE webOS
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.il.uil2;
 
 import java.rmi.RemoteException;
 import javax.jms.Destination;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.AcknowledgementRequest;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.TransactionRequest;
@@ -43,7 +26,6 @@
 import org.jboss.mq.il.uil2.msgs.CreateDestMsg;
 import org.jboss.mq.il.uil2.msgs.DeleteTemporaryDestMsg;
 import org.jboss.mq.il.uil2.msgs.GetIDMsg;
-import org.jboss.mq.il.uil2.msgs.RecoverMsg;
 import org.jboss.mq.il.uil2.msgs.TemporaryDestMsg;
 import org.jboss.mq.il.uil2.msgs.ReceiveMsg;
 import org.jboss.mq.il.uil2.msgs.EnableConnectionMsg;
@@ -103,7 +85,6 @@
             AcknowledgementRequestMsg ackmsg = (AcknowledgementRequestMsg) msg;
             AcknowledgementRequest ack = ackmsg.getAck();
             server.acknowledge(connectionToken, ack);
-            // We send the reply although on newer clients it is ignored.
             socketMgr.sendReply(msg);
             break;
          case m_addMessage:
@@ -191,18 +172,6 @@
             server.transact(connectionToken, trans);
             socketMgr.sendReply(msg);
             break;
-         case m_recover:
-            RecoverMsg recmsg = (RecoverMsg) msg;
-            int flags = recmsg.getFlags();
-            if (server instanceof Recoverable)
-            {
-               Recoverable recoverable = (Recoverable) server;
-               Xid[] xids = recoverable.recover(connectionToken, flags);
-               recmsg.setXids(xids);
-               socketMgr.sendReply(msg);
-               break;
-            }
-            throw new IllegalStateException("Invoker does not implement recoverable " + server);
          case m_unsubscribe:
             UnsubscribeMsg umsg = (UnsubscribeMsg) msg;
             server.unsubscribe(connectionToken, umsg.getSubscriptionID());

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.io.IOException;
@@ -39,7 +24,6 @@
 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
 import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
 import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
 
 /** Used to manage the client/server and server/client communication in an
@@ -57,7 +41,7 @@
    private static final int STOPPED = 0;
    private static final int STARTED = 1;
    private static final int STOPPING = 2;
-   private static SynchronizedInt taskID = new SynchronizedInt(0);
+   private static int taskID = 0;
 
    /** The socket created by the IL layer */
    private Socket socket;
@@ -127,12 +111,14 @@
          pool.setThreadFactory(new UILThreadFactory(id));
       }
 
+      taskID++;
       ReadTask readTask = new ReadTask();
-      readThread = new Thread(tg, readTask, "UIL2.SocketManager.ReadTask#" + taskID.increment() + " client=" +  ipAddress);
+      readThread = new Thread(tg, readTask, "UIL2.SocketManager.ReadTask#" + taskID + " client=" +  ipAddress);
       readThread.setDaemon(true);
 
+      taskID++;
       WriteTask writeTask = new WriteTask();
-      writeThread = new Thread(tg, writeTask, "UIL2.SocketManager.WriteTask#" + taskID.increment() + " client=" + ipAddress);
+      writeThread = new Thread(tg, writeTask, "UIL2.SocketManager.WriteTask#" + taskID + " client=" + ipAddress);
       writeThread.setDaemon(true);
       
       synchronized (running)
@@ -225,12 +211,12 @@
          throw msg.error;
       }
    }
-
-   /** 
-    * Send a reply.
+   /** Send a one-way message. Typically this is a reply message, but it
+    * could be an asynchronous msg that does not need a reply as it true
+    * for ping msgs.
     *
-    * @param msg the message
-    * @throws Exception for any error
+    * @param msg
+    * @throws Exception
     */
    public void sendReply(BaseMsg msg) throws Exception
    {
@@ -238,18 +224,6 @@
       internalSendMessage(msg, false);
    }
 
-   /** 
-    * Send a one-way.
-    *
-    * @param msg the message
-    * @throws Exception for any error
-    */
-   public void sendOneWay(BaseMsg msg) throws Exception
-   {
-      msg.getMsgID();
-      internalSendMessage(msg, false);
-   }
-
    /** This places the msg into the sendQueue and returns if waitOnReply
     * is false, or enques the msg to the sendQueue, places the msg
     * in the replyMap and waits on the msg.

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManagerHandler.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManagerHandler.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManagerHandler.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource J2EE webOS
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.il.uil2;
 

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientIL.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientIL.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientIL.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.io.Serializable;
@@ -47,13 +32,22 @@
 
    private transient SocketManager socketMgr;
 
+   /**
+    * #Description of the Method
+    *
+    * @exception Exception  Description of Exception
+    */
    public void close()
           throws Exception
    {
-      if (socketMgr != null)
-         socketMgr.stop();
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dest           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
    public void deleteTemporaryDestination(SpyDestination dest)
           throws Exception
    {
@@ -61,6 +55,12 @@
       socketMgr.sendReply(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param serverTime     Description of Parameter
+    * @exception Exception  Description of Exception
+    */
    public void pong(long serverTime)
           throws Exception
    {
@@ -69,6 +69,12 @@
       socketMgr.sendReply(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param messages       Description of Parameter
+    * @exception Exception  Description of Exception
+    */
    public void receive(ReceiveRequest messages[])
           throws Exception
    {

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientILService.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientILService.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILClientILService.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.lang.reflect.UndeclaredThrowableException;
@@ -109,9 +94,6 @@
          log.trace("Begin handleMsg, msgType: " + msgType);
       switch( msgType )
       {
-         case m_acknowledge:
-            // We have to ignore NACK replies because of backwards compatibility
-            break;
          case m_receiveRequest:
             ReceiveRequestMsg rmsg = (ReceiveRequestMsg) msg;
             ReceiveRequest[] messages = rmsg.getMessages();

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerIL.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerIL.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerIL.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.io.Serializable;
@@ -33,14 +18,12 @@
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
 import javax.net.SocketFactory;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.Connection;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.TransactionRequest;
@@ -49,7 +32,6 @@
 import org.jboss.mq.il.uil2.msgs.ConnectionTokenMsg;
 import org.jboss.mq.il.uil2.msgs.EnableConnectionMsg;
 import org.jboss.mq.il.uil2.msgs.GetIDMsg;
-import org.jboss.mq.il.uil2.msgs.RecoverMsg;
 import org.jboss.mq.il.uil2.msgs.TemporaryDestMsg;
 import org.jboss.mq.il.uil2.msgs.AcknowledgementRequestMsg;
 import org.jboss.mq.il.uil2.msgs.AddMsg;
@@ -74,7 +56,7 @@
  * @version $Revision$
  */
 public class UILServerIL
-   implements Cloneable, MsgTypes, Serializable, ServerIL, Recoverable
+   implements Cloneable, MsgTypes, Serializable, ServerIL
 {
    /** @since 1.7, at least jboss-3.2.5, jboss-4.0.0 */
    private static final long serialVersionUID = 853594001646066224L;
@@ -187,6 +169,12 @@
       this.connectPort = connectPort;
    }
 
+   /**
+    * Sets the ConnectionToken attribute of the UILServerIL object
+    *
+    * @param dest           The new ConnectionToken value
+    * @exception Exception  Description of Exception
+    */
    public void setConnectionToken(ConnectionToken dest)
           throws Exception
    {
@@ -194,6 +182,14 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * Sets the Enabled attribute of the UILServerIL object
+    *
+    * @param dc                The new Enabled value
+    * @param enabled           The new Enabled value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void setEnabled(ConnectionToken dc, boolean enabled)
           throws JMSException, Exception
    {
@@ -201,6 +197,12 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * Gets the ID attribute of the UILServerIL object
+    *
+    * @return               The ID value
+    * @exception Exception  Description of Exception
+    */
    public String getID()
           throws Exception
    {
@@ -210,6 +212,14 @@
       return id;
    }
 
+   /**
+    * Gets the TemporaryQueue attribute of the UILServerIL object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public TemporaryQueue getTemporaryQueue(ConnectionToken dc)
           throws JMSException, Exception
    {
@@ -219,6 +229,14 @@
       return dest;
    }
 
+   /**
+    * Gets the TemporaryTopic attribute of the UILServerIL object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public TemporaryTopic getTemporaryTopic(ConnectionToken dc)
           throws JMSException, Exception
    {
@@ -228,16 +246,28 @@
       return dest;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param item              Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item)
           throws JMSException, Exception
    {
       AcknowledgementRequestMsg msg = new AcknowledgementRequestMsg(item);
-      if (item.isAck())
-         getSocketMgr().sendMessage(msg);
-      else
-         getSocketMgr().sendOneWay(msg);
+      getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * Adds a feature to the Message attribute of the UILServerIL object
+    *
+    * @param dc             The feature to be added to the Message attribute
+    * @param val            The feature to be added to the Message attribute
+    * @exception Exception  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage val)
           throws Exception
    {
@@ -245,6 +275,16 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @param selector          Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector)
           throws JMSException, Exception
    {
@@ -254,6 +294,13 @@
       return msgs;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id                Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void checkID(String id)
           throws JMSException, Exception
    {
@@ -261,6 +308,15 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param username          Description of Parameter
+    * @param password          Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public String checkUser(String username, String password)
           throws JMSException, Exception
    {
@@ -270,6 +326,15 @@
       return clientID;
    }
 
+   /**
+    * Authenticate the user
+    *
+    * @param username          Description of Parameter
+    * @param password          Description of Parameter
+    * @return                  a sessionID
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public String authenticate(String username, String password)
           throws JMSException, Exception
    {
@@ -279,18 +344,38 @@
       return sessionID;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @return                                Description of the Returned Value
+    * @exception CloneNotSupportedException  Description of Exception
+    */
    public Object clone()
           throws CloneNotSupportedException
    {
       return super.clone();
    }
 
+   /**
+    * Need to clone because there are instance variables tha can get clobbered.
+    * All Multiple connections can NOT share the same JVMServerIL object
+    *
+    * @return               Description of the Returned Value
+    * @exception Exception  Description of Exception
+    */
    public ServerIL cloneServerIL()
           throws Exception
    {
       return (ServerIL)clone();
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void connectionClosing(ConnectionToken dc)
           throws JMSException, Exception
    {
@@ -305,6 +390,15 @@
       destroyConnection();
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc - the destination connection token
+    * @param destName - the name of the destination
+    * @return  
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public Queue createQueue(ConnectionToken dc, String destName)
           throws JMSException, Exception
    {
@@ -314,6 +408,15 @@
       return dest;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc - the destination connection token
+    * @param destName - the name of the destination
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public Topic createTopic(ConnectionToken dc, String destName)
           throws JMSException, Exception
    {
@@ -323,6 +426,14 @@
       return dest;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest)
           throws JMSException, Exception
    {
@@ -330,6 +441,13 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id                Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void destroySubscription(ConnectionToken dc,DurableSubscriptionID id)
           throws JMSException, Exception
    {
@@ -337,6 +455,13 @@
       getSocketMgr().sendMessage(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param clientTime     Description of Parameter
+    * @exception Exception  Description of Exception
+    */
    public void ping(ConnectionToken dc, long clientTime)
           throws Exception
    {
@@ -345,6 +470,15 @@
       getSocketMgr().sendReply(msg);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param subscriberId   Description of Parameter
+    * @param wait           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception Exception  Description of Exception
+    */
    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait)
           throws Exception, Exception
    {
@@ -354,6 +488,14 @@
       return reply;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param s                 Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void subscribe(ConnectionToken dc, org.jboss.mq.Subscription s)
           throws JMSException, Exception
    {
@@ -361,21 +503,29 @@
       getSocketMgr().sendMessage(msg);
    }
 
-   public void transact(ConnectionToken dc, TransactionRequest t)
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param t                 Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
+   public void transact(org.jboss.mq.ConnectionToken dc, TransactionRequest t)
           throws JMSException, Exception
    {
       TransactMsg msg = new TransactMsg(t);
       getSocketMgr().sendMessage(msg);
    }
 
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      RecoverMsg msg = new RecoverMsg(flags);
-      getSocketMgr().sendMessage(msg);
-      Xid[] reply = msg.getXids();
-      return reply;
-   }
-
+   /**
+    * #Description of the Method
+    *
+    * @param dc - the destination connection token
+    * @param subscriptionID    Description of Parameter
+    * @exception JMSException  Description of Exception
+    * @exception Exception     Description of Exception
+    */
    public void unsubscribe(ConnectionToken dc, int subscriptionID)
           throws JMSException, Exception
    {
@@ -391,6 +541,11 @@
       return socketMgr;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @exception Exception  Description of Exception
+    */
    protected void checkConnection()
           throws Exception
    {

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILFactory.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILFactory.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILFactory.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.util.Properties;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 import java.io.IOException;
@@ -51,6 +36,7 @@
 {
    final static int SO_TIMEOUT = 5000;
 
+   private Invoker server;
    /** The security domain name to use with SSL aware socket factories.
     */
    private String securityDomain;
@@ -154,12 +140,11 @@
             socket.setSoTimeout(readTimeout);
             socket.setTcpNoDelay(enableTcpNoDelay);
             socketMgr = new SocketManager(socket);
-            ServerSocketManagerHandler handler = new ServerSocketManagerHandler(lookupJMSServer(), socketMgr);
+            ServerSocketManagerHandler handler = new ServerSocketManagerHandler(server, socketMgr);
             socketMgr.setHandler(handler);
             socketMgr.setBufferSize(bufferSize);
             socketMgr.setChunkSize(chunkSize);
-            Invoker s = lookupJMSServer();
-            socketMgr.start(s.getThreadGroup());
+            socketMgr.start(server.getThreadGroup());
          }
          catch (IOException e)
          {
@@ -183,6 +168,7 @@
    {
       super.startService();
       running = true;
+      this.server = lookupJMSServer();
 
       // Use the default javax.net.ServerSocketFactory if none was set
       if (serverSocketFactory == null)
@@ -218,7 +204,7 @@
 
       InetAddress socketAddress = serverSocket.getInetAddress();
       log.info("JBossMQ UIL service available at : " + socketAddress + ":" + serverSocket.getLocalPort());
-      acceptThread = new Thread(lookupJMSServer().getThreadGroup(), this, "UILServerILService Accept Thread");
+      acceptThread = new Thread(server.getThreadGroup(), this, "UILServerILService Accept Thread");
       acceptThread.start();
 
       /* We need to check the socketAddress against "0.0.0.0/0.0.0.0"

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILServiceMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILServiceMBean.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILServiceMBean.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AcknowledgementRequestMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AcknowledgementRequestMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AcknowledgementRequestMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AddMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AddMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/AddMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BaseMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BaseMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BaseMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;
@@ -145,9 +130,6 @@
          case MsgTypes.m_transact:
             msg = new TransactMsg();
             break;
-         case MsgTypes.m_recover:
-            msg = new RecoverMsg();
-            break;
          case MsgTypes.m_unsubscribe:
             msg = new UnsubscribeMsg();
             break;
@@ -235,9 +217,6 @@
          case MsgTypes.m_transact:
             msgTypeString = "m_transact";
             break;
-         case MsgTypes.m_recover:
-            msgTypeString = "m_recover";
-            break;
          case MsgTypes.m_unsubscribe:
             msgTypeString = "m_unsubscribe";
             break;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BrowseMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BrowseMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/BrowseMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckIDMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckIDMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckIDMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckUserMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckUserMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CheckUserMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CloseMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CloseMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CloseMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 /**

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ConnectionTokenMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ConnectionTokenMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ConnectionTokenMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CreateDestMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CreateDestMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/CreateDestMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteSubscriptionMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteSubscriptionMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteSubscriptionMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteTemporaryDestMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteTemporaryDestMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DeleteTemporaryDestMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DynCircularBuffer.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DynCircularBuffer.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/DynCircularBuffer.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 /** A circular byte[] buffer capable of expanding its capacity

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/EnableConnectionMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/EnableConnectionMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/EnableConnectionMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/GetIDMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/GetIDMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/GetIDMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/MsgTypes.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/MsgTypes.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/MsgTypes.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 /**
@@ -51,5 +36,5 @@
    final static int m_close = 23;
    final static int m_pong = 24;
    final static int m_receiveRequest = 25;
-   final static int m_recover = 26;
+
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/PingMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/PingMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/PingMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectInputStream;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveRequestMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveRequestMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/ReceiveRequestMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.ObjectOutputStream;

Deleted: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/RecoverMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/RecoverMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/RecoverMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,83 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.mq.il.uil2.msgs;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import javax.transaction.xa.Xid;
-
-/**
- * RecoverMsg.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class RecoverMsg extends BaseMsg
-{
-   private int flags;
-   private Xid[] xids;
-
-   public RecoverMsg()
-   {
-      super(MsgTypes.m_recover);
-   }
-   
-   public RecoverMsg(int flags)
-   {
-      super(MsgTypes.m_recover);
-      this.flags = flags;
-   }
-
-   public int getFlags()
-   {
-      return flags;
-   }
-   
-   public Xid[] getXids()
-   {
-      return xids;
-   }
-   
-   public void setXids(Xid[] xids)
-   {
-      this.xids = xids;
-   }
-
-   public void write(ObjectOutputStream out) throws IOException
-   {
-      super.write(out);
-      int hasXids = xids != null ? 1 : 0;
-      out.writeByte(hasXids);
-      if (hasXids == 1)
-         out.writeObject(xids);
-   }
-   
-   public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
-   {
-      super.read(in);
-      int hasXids = in.readByte();
-      if (hasXids == 1)
-         xids = (Xid[]) in.readObject();
-   }
-}

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/SubscribeMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/SubscribeMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/SubscribeMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TemporaryDestMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TemporaryDestMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TemporaryDestMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TransactMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TransactMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/TransactMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/UnsubscribeMsg.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/UnsubscribeMsg.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/il/uil2/msgs/UnsubscribeMsg.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE WebOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.uil2.msgs;
 
 import java.io.IOException;

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/Tx.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/Tx.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/Tx.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource J2EE webOS
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.pm;
 
@@ -25,7 +10,6 @@
 import java.util.ArrayList;
 
 import javax.jms.JMSException;
-import javax.transaction.xa.Xid;
 
 /**
  * A transaction
@@ -35,6 +19,8 @@
  */
 public class Tx implements Comparable, Externalizable
 {
+   // Constants -----------------------------------------------------
+
    /** The serialVersionUID */
    static final long serialVersionUID = -5428592493990463362L;  
 
@@ -42,24 +28,15 @@
    private static final int OPEN = 0;
    /** Transaction ended */
    private static final int ENDED = 2;
-
-   /** Restore unknown */
-   public static final int UNKNOWN = 0;
-
-   /** Restore addition */
-   public static final int ADD = 1;
-
-   /** Restore remove */
-   public static final int REMOVE = -1;
    
+   // Attributes ----------------------------------------------------
+
    /** The transaction value */
    long value = 0;
    
    /** Whether the transaction has been persisted */
    boolean persisted = false;
 
-   transient Xid xid;
-   
    /** List of Runnable tasks */
    transient ArrayList postCommitTasks;
    /** List of Runnable tasks */
@@ -71,6 +48,10 @@
    /** The lock */
    transient Object lock = new Object();
    
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+   
    /**
     * Create a new Tx for externailzation
     */
@@ -88,6 +69,8 @@
       this.value = value;
    }
    
+   // Public --------------------------------------------------------
+   
    /**
     * Set the value
     *
@@ -109,26 +92,6 @@
    }
 
    /**
-    * Get the xid.
-    * 
-    * @return the xid.
-    */
-   public Xid getXid()
-   {
-      return xid;
-   }
-
-   /**
-    * Set the xid.
-    * 
-    * @param xid the xid.
-    */
-   public void setXid(Xid xid)
-   {
-      this.xid = xid;
-   }
-
-   /**
     * Get whether the transaction has been persisted
     *
     * @return true when persisted
@@ -163,11 +126,15 @@
       return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
    }
    
+   // Comparable implementation -------------------------------------
+   
    public int compareTo(Object o)
    {
       return compareTo((Tx) o);
    }
    
+   // Externalizable implementation ---------------------------------
+   
    public void readExternal(java.io.ObjectInput in) throws java.io.IOException
    {
       value = in.readLong();
@@ -178,6 +145,8 @@
       out.writeLong(value);
    }
    
+   // Object overrides ----------------------------------------------
+   
    public String toString()
    {
       return String.valueOf(value);
@@ -187,6 +156,8 @@
    {
       return (int) (value ^ (value >> 32));
    }
+   
+   // Package protected ---------------------------------------------
 
    /**
     * Commit the transaction
@@ -289,4 +260,10 @@
          postRollbackTasks.add(task);
       }
    }
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/TxManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/TxManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/TxManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,40 +1,16 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ * 
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
 package org.jboss.mq.pm;
 
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
 import javax.jms.JMSException;
-import javax.transaction.xa.Xid;
 
-import org.jboss.logging.Logger;
 import org.jboss.mq.ConnectionToken;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyJMSException;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet;
 
 /**
  * This class allows provides the base for user supplied persistence packages.
@@ -44,34 +20,37 @@
  * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
  * @version $Revision$
  */
-public class TxManager implements Recoverable
+public class TxManager
 {
-   /** The log */
-   private static final Logger log = Logger.getLogger(TxManager.class);
+   // Constants -----------------------------------------------------
    
+   // Attributes ----------------------------------------------------
+
    /** The persistence manager */
    PersistenceManager persistenceManager;
    
    /** Maps Global transactions to local transactions */
    ConcurrentHashMap globalToLocal = new ConcurrentHashMap();
    
-   /** Prepared Transactions Map<Xid, PreparedInfo<Tx>> */
-   ConcurrentHashMap prepared = new ConcurrentHashMap();
-   
    /**
     * Create a new TxManager
     *
     * @param pm the persistence manager
     */
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
    public TxManager(PersistenceManager pm)
    {
       persistenceManager = pm;
    }
+   
+   // Public --------------------------------------------------------
 
    /**
 	 * Return the local transaction id for a distributed transaction id.
 	 * 
-     * @deprecated
 	 * @param dc the connection
 	 * @param xid the transaction id
 	 * @return The Prepared transaction
@@ -107,48 +86,10 @@
 	 */
    public final void commitTx(Tx txId) throws JMSException
    {
-      boolean trace = log.isTraceEnabled();
-      if (trace)
-         log.trace("Commit branch=" + txId.longValue());
       txId.commit(persistenceManager);
    }
 
    /**
-    * Commit the transaction to the persistent store.
-    *
-    * @param dc the connection token
-    * @param xid the transaction
-    * @exception JMSException for any error
-    */
-   public final void commitTx(ConnectionToken dc, Object xid) throws JMSException
-   {
-      boolean trace = log.isTraceEnabled();
-      GlobalXID gxid = new GlobalXID(dc, xid);
-      Tx txid = (Tx) globalToLocal.get(gxid);
-      if (txid == null)
-      {
-         PreparedInfo preparedInfo = (PreparedInfo) prepared.get(xid);
-         if (preparedInfo == null)
-            throw new SpyJMSException("Transaction does not exist from: " + dc.getClientID() + " xid=" + xid);
-         Set txids = preparedInfo.getTxids();
-         for (Iterator i = txids.iterator(); i.hasNext();)
-         {
-            txid = (Tx) i.next();
-            if (trace)
-               log.trace("Commit xid=" + xid + " branch=" + txid.longValue());
-            txid.commit(persistenceManager);
-         }
-         prepared.remove(xid);
-      }
-      else
-      {
-         if (trace)
-            log.trace("Commit xid=" + xid + " branch=" + txid.longValue());
-         txid.commit(persistenceManager);
-      }
-   }
-   
-   /**
     * Add an operation for after a commit
     *
     * @param txId the transaction
@@ -174,48 +115,10 @@
 	 */
    public void rollbackTx(Tx txId) throws JMSException
    {
-      boolean trace = log.isTraceEnabled();
-      if (trace)
-         log.trace("Rollback branch=" + txId.longValue());
       txId.rollback(persistenceManager);
    }
 
    /**
-    * Rollback the transaction
-    *
-    * @param dc the connection token
-    * @param xid the transaction
-    * @exception JMSException for any error
-    */
-   public final void rollbackTx(ConnectionToken dc, Object xid) throws JMSException
-   {
-      boolean trace = log.isTraceEnabled();
-      GlobalXID gxid = new GlobalXID(dc, xid);
-      Tx txid = (Tx) globalToLocal.get(gxid);
-      if (txid == null)
-      {
-         PreparedInfo preparedInfo = (PreparedInfo) prepared.get(xid);
-         if (preparedInfo == null)
-            throw new SpyJMSException("Transaction does not exist from: " + dc.getClientID() + " xid=" + xid);
-         Set txids = preparedInfo.getTxids();
-         for (Iterator i = txids.iterator(); i.hasNext();)
-         {
-            txid = (Tx) i.next();
-            if (trace)
-               log.trace("Rolling back xid=" + xid + " branch=" + txid.longValue());
-            txid.rollback(persistenceManager);
-         }
-         prepared.remove(xid);
-      }
-      else
-      {
-         if (trace)
-            log.trace("Rolling back xid=" + xid + " branch=" + txid.longValue());
-         txid.rollback(persistenceManager);
-      }
-   }
-
-   /**
     * Add an operation for after a rollback
     *
     * @param txId the transaction
@@ -242,13 +145,12 @@
 	 */
    public Tx createTx(ConnectionToken dc, Object xid) throws JMSException
    {
+
       GlobalXID gxid = new GlobalXID(dc, xid);
       if (globalToLocal.containsKey(gxid))
          throw new SpyJMSException("Duplicate transaction from: " + dc.getClientID() + " xid=" + xid);
 
       Tx txId = createTx();
-      if (xid != null && xid instanceof Xid)
-         txId.setXid((Xid) xid);
       globalToLocal.put(gxid, txId);
 
       //Tasks to remove the global to local mappings on commit/rollback
@@ -257,77 +159,15 @@
 
       return txId;
    }
-
-   /**
-    * Restore a prepared transaction
-    * 
-    * @param txId the transaction id
-    * @throws JMSException for any error
-    */
-   public void restoreTx(Tx txId) throws JMSException
-   {
-      addPreparedTx(txId, txId.getXid(), true);
-   }
-
-   /**
-    * Add a prepared transactions
-    * 
-    * @param txId the transaction id
-    * @param xid the xid
-    * @param inDoubt whether it is in doubt
-    * @throws JMSException for any error
-    */
-   void addPreparedTx(Tx txId, Xid xid, boolean inDoubt) throws JMSException
-   {
-      PreparedInfo preparedInfo = (PreparedInfo) prepared.get(xid);
-      if (preparedInfo == null)
-      {
-         preparedInfo = new PreparedInfo(xid, false);
-         prepared.put(xid, preparedInfo);
-      }
-      preparedInfo.add(txId);
-      if (inDoubt)
-         preparedInfo.setInDoubt(true);
-   }
    
-   /**
-    * Mark the transaction branch as prepared
-    * 
-    * @param dc the connection token
-    * @param xid the xid
-    * @param txId the transaction
-    * @throws JMSException for any error
-    */
-   public void markPrepared(ConnectionToken dc, Object xid, Tx txId) throws JMSException
-   {
-      try
-      {
-         if (xid instanceof Xid)
-            addPreparedTx(txId, (Xid) xid, false);
-      }
-      catch (Throwable t)
-      {
-         SpyJMSException.rethrowAsJMSException("Error marking transaction as prepared xid=" + xid + " tx=" + txId, t);
-      }
-   }
-
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      Set preparedXids = prepared.keySet();
-      Xid[] xids = (Xid[]) preparedXids.toArray(new Xid[preparedXids.size()]);
-      return xids;
-   }
+   // Package protected ---------------------------------------------
    
-   /**
-    * Get the prepared transactions
-    * 
-    * @return
-    */
-   public Map getPreparedTransactions()
-   {
-      return prepared;
-   }
+   // Protected -----------------------------------------------------
    
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+   
    /**
 	 * A global transaction
 	 */
@@ -362,118 +202,7 @@
 
       public void run()
       {
-         Tx txId = (Tx) globalToLocal.remove(this);
-         // Tidyup the prepared transactions
-         if (txId != null)
-         {
-            PreparedInfo preparedInfo = (PreparedInfo) prepared.get(xid);
-            if (preparedInfo != null)
-            {
-               preparedInfo.remove(txId);
-               if (preparedInfo.isEmpty())
-                  prepared.remove(xid);
-            }
-         }
+         globalToLocal.remove(this);
       }
    }
-
-   /**
-    * Information about a prepared global transaction
-    * 
-    * @author <a href="adrian at jboss.com">Adrian Brock</a>
-    * @version $Revision$
-    */
-   public static class PreparedInfo
-   {
-      /** The XID */
-      private Xid xid;
-      
-      /** Whether the transaction is in doubt */
-      private boolean inDoubt;
-      
-      /** The local transaction branches */
-      private Set txids = new CopyOnWriteArraySet();
-
-      /**
-       * Create a new PreparedInfo.
-       * 
-       * @param xid the xid
-       * @param indoubt whether the transaction is in doubt
-       */
-      public PreparedInfo(Xid xid, boolean inDoubt)
-      {
-         this.xid = xid;
-         this.inDoubt = inDoubt;
-      }
-
-      /**
-       * Whether the transaction is in doubt
-       * 
-       * @return true when in doubt
-       */
-      public boolean isInDoubt()
-      {
-         return inDoubt;
-      }
-      
-      /**
-       * Set the in doubt
-       * 
-       * @param inDoubt the in doubt value
-       */
-      public void setInDoubt(boolean inDoubt)
-      {
-         this.inDoubt = inDoubt;
-      }
-      
-      /**
-       * Get the XID
-       * 
-       * @return
-       */
-      public Xid getXid()
-      {
-         return xid;
-      }
-
-      /**
-       * Get the local branches
-       * 
-       * @return the local branches
-       */
-      public Set getTxids()
-      {
-         return txids;
-      }
-      
-      /**
-       * Add a local branch
-       * 
-       * @param txid the local branch
-       */
-      public void add(Tx txid)
-      {
-         txids.add(txid);
-      }
-      
-      /**
-       * Remove a local branch
-       * 
-       * @param txid the local branch
-       */
-      public void remove(Tx txid)
-      {
-         txids.remove(txid);
-      }
-      
-      /**
-       * Whether there are no local branches
-       * 
-       * @return true when there no local branches
-       */
-      public boolean isEmpty()
-      {
-         return txids.isEmpty();
-      }
-   }
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.pm.jdbc2;
 
 import java.io.ByteArrayInputStream;
@@ -31,30 +16,20 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
 import java.util.Properties;
 
 import javax.jms.JMSException;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.sql.DataSource;
 import javax.transaction.Status;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
-import javax.transaction.xa.Xid;
 
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyJMSException;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.SpyTopic;
-import org.jboss.mq.pm.CacheStore;
 import org.jboss.mq.pm.Tx;
 import org.jboss.mq.pm.TxManager;
 import org.jboss.mq.server.JMSDestination;
@@ -70,13 +45,16 @@
  * This class manages all persistence related services for JDBC based
  * persistence.
  *
+ * @jmx:mbean extends="org.jboss.system.ServiceMBean, org.jboss.mq.pm.PersistenceManagerMBean, org.jboss.mq.pm.CacheStoreMBean"
+ *
  * @author Jayesh Parayali (jayeshpk1 at yahoo.com)
  * @author Hiram Chirino (cojonudo14 at hotmail.com)
- * @author Adrian Brock (adrian at jboss.com)
- * @version $Revision$
+ *
+ *  @version $Revision$
  */
-public class PersistenceManager extends ServiceMBeanSupport
-   implements PersistenceManagerMBean, org.jboss.mq.pm.PersistenceManager, CacheStore
+public class PersistenceManager
+   extends ServiceMBeanSupport
+   implements PersistenceManagerMBean, org.jboss.mq.pm.PersistenceManager, org.jboss.mq.pm.CacheStore
 {
 
    /////////////////////////////////////////////////////////////////////////////////
@@ -102,9 +80,6 @@
    
    /** The recovery retries */
    private int recoveryRetries = 0;
-   
-   /** The recover messages chunk  */
-   private int recoverMessagesChunk = 0;
 
    /////////////////////////////////////////////////////////////////////////////////
    //
@@ -113,26 +88,17 @@
    /////////////////////////////////////////////////////////////////////////////////
 
    protected String UPDATE_MARKED_MESSAGES = "UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?";
-   protected String UPDATE_MARKED_MESSAGES_XARECOVERY = "UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID NOT IN (SELECT TXID FROM JMS_TRANSACTIONS WHERE XID IS NOT NULL)";
    protected String UPDATE_MARKED_MESSAGES_WITH_TX = "UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?";
    protected String DELETE_MARKED_MESSAGES_WITH_TX =
       "DELETE FROM JMS_MESSAGES WHERE TXID IN (SELECT TXID FROM JMS_TRANSACTIONS) AND TXOP=?";
-   protected String DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY =
-      "DELETE FROM JMS_MESSAGES WHERE TXID IN (SELECT TXID FROM JMS_TRANSACTIONS WHERE XID = NULL) AND TXOP=?";
    protected String DELETE_TX = "DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?";
    protected String DELETE_MARKED_MESSAGES = "DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?";
    protected String DELETE_TEMPORARY_MESSAGES = "DELETE FROM JMS_MESSAGES WHERE TXOP = 'T'";
    protected String INSERT_TX = "INSERT INTO JMS_TRANSACTIONS (TXID) values(?)";
-   protected String INSERT_TX_XARECOVERY = "INSERT INTO JMS_TRANSACTIONS (TXID, XID) values(?, ?)";
    protected String DELETE_ALL_TX = "DELETE FROM JMS_TRANSACTIONS";
-   protected String DELETE_ALL_TX_XARECOVERY = "DELETE FROM JMS_TRANSACTIONS WHERE XID = NULL";
    protected String SELECT_MAX_TX = "SELECT MAX(TXID) FROM (SELECT MAX(TXID) FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) FROM JMS_MESSAGES)";
-   protected String SELECT_ALL_TX_XARECOVERY = "SELECT TXID, XID FROM JMS_TRANSACTIONS";
    protected String SELECT_MESSAGES_IN_DEST = "SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?";
-   protected String SELECT_MESSAGES_IN_DEST_XARECOVERY = "SELECT MESSAGEID, MESSAGEBLOB, TXID, TXOP FROM JMS_MESSAGES WHERE DESTINATION=?";
-   protected String SELECT_MESSAGE_KEYS_IN_DEST = "SELECT MESSAGEID FROM JMS_MESSAGES WHERE DESTINATION=?";
    protected String SELECT_MESSAGE = "SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?";
-   protected String SELECT_MESSAGE_XARECOVERY = "SELECT MESSAGEID, MESSAGEBLOB, TXID, TXOP FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?";
    protected String INSERT_MESSAGE =
       "INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)";
    protected String MARK_MESSAGE = "UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=?";
@@ -145,7 +111,6 @@
    protected String CREATE_IDX_MESSAGE_TXOP_TXID = "CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID)";
    protected String CREATE_IDX_MESSAGE_DESTINATION = "CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION)";
    protected String CREATE_TX_TABLE = "CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )";
-   protected String CREATE_TX_TABLE_XARECOVERY = "CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER, XID OBJECT, PRIMARY KEY (TXID) )";
 
    protected static final int OBJECT_BLOB = 0;
    protected static final int BYTES_BLOB = 1;
@@ -157,8 +122,6 @@
 
    protected  int connectionRetryAttempts = 5;
 
-   protected boolean xaRecovery = false;
-   
    /////////////////////////////////////////////////////////////////////////////////
    //
    // Constructor.
@@ -180,6 +143,7 @@
 
       void startTX() throws JMSException
       {
+         //log.debug("starting a new TM transaction");
          try
          {
             // Thread arriving must be clean (jboss doesn't set the thread
@@ -207,6 +171,7 @@
 
       void setRollbackOnly() throws JMSException
       {
+         //log.debug("rolling back a TM transaction");
          try
          {
             tm.setRollbackOnly();
@@ -219,6 +184,7 @@
 
       void endTX() throws JMSException
       {
+         //log.debug("ending TM transaction.");
          try
          {
             if (tm.getStatus() == Status.STATUS_MARKED_ROLLBACK)
@@ -340,17 +306,14 @@
                }
             }
 
-            String createTxTable = CREATE_TX_TABLE;
-            if (xaRecovery)
-               createTxTable = CREATE_TX_TABLE_XARECOVERY;
             try
             {
-               stmt = c.prepareStatement(createTxTable);
+               stmt = c.prepareStatement(CREATE_TX_TABLE);
                stmt.executeUpdate();
             }
             catch (SQLException e)
             {
-               log.debug("Could not create table with SQL: " + createTxTable, e);
+               log.debug("Could not create table with SQL: " + CREATE_TX_TABLE, e);
             }
             finally
             {
@@ -421,72 +384,38 @@
          rs = stmt.executeQuery();
          if (rs.next())
             nextTransactionId.set(rs.getLong(1) + 1);
-         rs.close();
-         rs = null;
          stmt.close();
-         stmt = null;
 
          // Delete all the temporary messages.
          stmt = c.prepareStatement(DELETE_TEMPORARY_MESSAGES);
          stmt.executeUpdate();
          stmt.close();
-         stmt = null;
 
          // Delete all the messages that were added but thier tx's were not commited.
-         String deleteMarkedMessagesWithTx = DELETE_MARKED_MESSAGES_WITH_TX;
-         if (xaRecovery)
-            deleteMarkedMessagesWithTx = DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY;
-         stmt = c.prepareStatement(deleteMarkedMessagesWithTx);
+         stmt = c.prepareStatement(DELETE_MARKED_MESSAGES_WITH_TX);
          stmt.setString(1, "A");
          stmt.executeUpdate();
          stmt.close();
-         stmt = null;
 
          // Restore all the messages that were removed but their tx's were not commited.
-         String updateMarkedMessages = UPDATE_MARKED_MESSAGES;
-         if (xaRecovery)
-            updateMarkedMessages = UPDATE_MARKED_MESSAGES_XARECOVERY;
-         stmt = c.prepareStatement(updateMarkedMessages);
+         stmt = c.prepareStatement(UPDATE_MARKED_MESSAGES);
          stmt.setNull(1, java.sql.Types.BIGINT);
          stmt.setString(2, "A");
          stmt.setString(3, "D");
          stmt.executeUpdate();
          stmt.close();
-         stmt = null;
 
          // Now recovery is complete, clear the transaction table.
-         String deleteAllTx = DELETE_ALL_TX;
-         if (xaRecovery)
-            deleteAllTx = DELETE_ALL_TX_XARECOVERY;
-         stmt = c.prepareStatement(deleteAllTx);
+         stmt = c.prepareStatement(DELETE_ALL_TX);
          stmt.execute();
          stmt.close();
-         stmt = null;
-
-         // If we are doing XARecovery restore the prepared transactions
-         if (xaRecovery)
-         {
-            stmt = c.prepareStatement(SELECT_ALL_TX_XARECOVERY);
-            rs = stmt.executeQuery();
-            while (rs.next())
-            {
-               long txid = rs.getLong(1);
-               Xid xid = extractXid(rs, 2);
-               Tx tx = new Tx(txid);
-               tx.setXid(xid);
-               tx.checkPersisted();
-               txManager.restoreTx(tx);
-            }
-            rs.close();
-            rs = null;
-            stmt.close();
-            stmt = null;
-         }
       }
-      catch (Exception e)
+      catch (SQLException e)
       {
          tms.setRollbackOnly();
-         throw new SpyJMSException("Could not resolve uncommited transactions.  Message recovery may not be accurate", e);
+         throw new SpyJMSException(
+            "Could not resolve uncommited transactions.  Message recovery may not be accurate",
+            e);
       }
       finally
       {
@@ -573,129 +502,32 @@
    
    synchronized protected void internalRestoreQueue(JMSDestination jmsDest, SpyDestination dest) throws JMSException
    {
-      // Work out the prepared transactions
-      Map prepared = null;
-      if (xaRecovery)
-      {
-         prepared = new HashMap();
-         Map map = txManager.getPreparedTransactions();
-         for (Iterator i = map.values().iterator(); i.hasNext();)
-         {
-            TxManager.PreparedInfo info = (TxManager.PreparedInfo) i.next();
-            for (Iterator j = info.getTxids().iterator(); j.hasNext();)
-            {
-               Tx tx = (Tx) j.next();
-               prepared.put(new Long(tx.longValue()), tx);
-            }
-         }
-      }
-      
       TransactionManagerStrategy tms = new TransactionManagerStrategy();
       tms.startTX();
       Connection c = null;
       PreparedStatement stmt = null;
-      PreparedStatement stmt2 = null; 
       ResultSet rs = null;
       boolean threadWasInterrupted = Thread.interrupted();
       try
       {
-         String selectMessagesInDest = SELECT_MESSAGES_IN_DEST;
-         String selectMessage = SELECT_MESSAGE;
-         if (xaRecovery)
-         {
-            selectMessagesInDest = SELECT_MESSAGES_IN_DEST_XARECOVERY;
-            selectMessage = SELECT_MESSAGE_XARECOVERY;
-         }
+
          c = this.getConnection();
-         if (recoverMessagesChunk == 0)
-            stmt = c.prepareStatement(selectMessagesInDest);
-         else
-         {
-            stmt = c.prepareStatement(SELECT_MESSAGE_KEYS_IN_DEST);
-            stmt2 = c.prepareStatement(selectMessage);
-         }
+         stmt = c.prepareStatement(SELECT_MESSAGES_IN_DEST);
          stmt.setString(1, dest.toString());
 
-         long txid = 0;
-         String txop = null;
          rs = stmt.executeQuery();
          int counter = 0;
-         int recovery = 0;
          while (rs.next())
          {
-            long msgid = rs.getLong(1);
-            SpyMessage message = null;
-            if (recoverMessagesChunk == 0)
-            {
-               message = extractMessage(rs);
-               if (xaRecovery)
-               {
-                  txid = rs.getLong(3);
-                  txop = rs.getString(4);
-               }
-            }
-            else
-            {
-               ResultSet rs2 = null;
-               try
-               {
-                  stmt2.setLong(1, msgid);
-                  stmt2.setString(2, dest.toString());
-                  rs2 = stmt2.executeQuery();
-                  if (rs2.next())
-                  {
-                     message = extractMessage(rs2);
-                     if (xaRecovery)
-                     {
-                        txid = rs.getLong(3);
-                        txop = rs.getString(4);
-                     }
-                  }
-                  else
-                     log.warn("Failed to find message msgid=" + msgid +" dest=" + dest);
-               }
-               finally
-               {
-                  if (rs2 != null)
-                  {
-                     try
-                     {
-                        rs2.close();
-                     }
-                     catch (Exception ignored)
-                     {
-                     }
-                  }
-               }
-            }
+            SpyMessage message = extractMessage(rs);
             // The durable subscription is not serialized
             if (dest instanceof SpyTopic)
                message.header.durableSubscriberID = ((SpyTopic) dest).getDurableSubscriptionID();
-
-            if (xaRecovery == false || txid == 0 || txop == null)
-               jmsDest.restoreMessage(message);
-            else
-            {
-               Tx tx = (Tx) prepared.get(new Long(txid));
-               if (tx == null)
-                  jmsDest.restoreMessage(message);
-               else if ("A".equals(txop))
-               {
-                  jmsDest.restoreMessage(message, tx, Tx.ADD);
-                  recovery++;
-               }
-               else if ("D".equals(txop))
-               {
-                  jmsDest.restoreMessage(message, tx, Tx.REMOVE);
-                  recovery++;
-               }
-               else
-                  throw new IllegalStateException("Unknown txop=" + txop + " for msg=" + msgid + " dest=" + dest);
-            }
+            jmsDest.restoreMessage(message);
             counter++;
          }
 
-         log.debug("Restored " + counter + " message(s) to: " + dest + " " + recovery + " need recovery.");
+         log.debug("Restored " + counter + " message(s) to: " + dest);
       }
       catch (IOException e)
       {
@@ -711,24 +543,21 @@
       {
          try
          {
-            if (rs != null)
-               rs.close();
+            rs.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -788,42 +617,6 @@
       }
    }
 
-   Xid extractXid(ResultSet rs, int column) throws SQLException, IOException, ClassNotFoundException
-   {
-      try
-      {
-         Xid xid = null;
-
-         if (blobType == OBJECT_BLOB)
-         {
-            xid = (Xid) rs.getObject(column);
-         }
-         else if (blobType == BYTES_BLOB)
-         {
-            byte[] st = rs.getBytes(column);
-            ByteArrayInputStream baip = new ByteArrayInputStream(st);
-            ObjectInputStream ois = new ObjectInputStream(baip);
-            xid = (Xid) ois.readObject();
-         }
-         else if (blobType == BINARYSTREAM_BLOB)
-         {
-            ObjectInputStream ois = new ObjectInputStream(rs.getBinaryStream(column));
-            xid = (Xid) ois.readObject();
-         }
-         else if (blobType == BLOB_BLOB)
-         {
-            ObjectInputStream ois = new ObjectInputStream(rs.getBlob(column).getBinaryStream());
-            xid = (Xid) ois.readObject();
-         }
-
-         return xid;
-      }
-      catch (StreamCorruptedException e)
-      {
-         throw new IOException("Could not load the message: " + e);
-      }
-   }
-
    /////////////////////////////////////////////////////////////////////////////////
    //
    // TX Commit
@@ -855,8 +648,7 @@
       {
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -883,8 +675,7 @@
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable e)
          {
@@ -892,32 +683,20 @@
       }
    }
 
-   public void addTXRecord(Connection c, Tx txid) throws SQLException, IOException
+   public void addTXRecord(Connection c, long txid) throws SQLException
    {
       PreparedStatement stmt = null;
       try
       {
-         String insertTx = INSERT_TX;
-         if (xaRecovery)
-            insertTx = INSERT_TX_XARECOVERY;
-         stmt = c.prepareStatement(insertTx);
-         stmt.setLong(1, txid.longValue());
-         if (xaRecovery)
-         {
-            Xid xid = txid.getXid();
-            if (xid != null)
-               setBlob(stmt, 2, xid);
-            else
-               stmt.setNull(2, java.sql.Types.BLOB);
-         }
+         stmt = c.prepareStatement(INSERT_TX);
+         stmt.setLong(1, txid);
          stmt.executeUpdate();
       }
       finally
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable e)
          {
@@ -938,8 +717,7 @@
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable e)
          {
@@ -977,7 +755,7 @@
          stmt.setLong(4, txId.longValue());
          stmt.executeUpdate();
          stmt.close();
-         stmt = null;
+
       }
       catch (SQLException e)
       {
@@ -990,12 +768,6 @@
          {
             if (stmt != null)
                stmt.close();
-         }
-         catch (Throwable ignore)
-         {
-         }
-         try
-         {
             if (c != null)
                c.close();
          }
@@ -1027,9 +799,9 @@
       try
       {
          if (tx != null && tx.checkPersisted() == false)
-            addTXRecord(c, tx);
+            addTXRecord(c, tx.longValue());
       }
-      catch (Exception e)
+      catch (SQLException e)
       {
          tms.setRollbackOnly();
          throw new SpyJMSException("Could not create tx: " + tx.longValue(), e);
@@ -1097,8 +869,7 @@
       {
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1131,13 +902,13 @@
          stmt.setString(5, mark);
 
          stmt.executeUpdate();
+
       }
       finally
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
@@ -1165,13 +936,13 @@
          stmt.setLong(3, messageid);
          stmt.setString(4, destination);
          stmt.executeUpdate();
+
       }
       finally
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
@@ -1220,46 +991,6 @@
       }
    }
 
-   public void setBlob(PreparedStatement stmt, int column, Xid xid) throws IOException, SQLException
-   {
-      if (blobType == OBJECT_BLOB)
-      {
-         stmt.setObject(column, xid);
-      }
-      else if (blobType == BYTES_BLOB)
-      {
-         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-         ObjectOutputStream oos = new ObjectOutputStream(baos);
-         oos.writeObject(xid);
-         oos.flush();
-         byte[] messageAsBytes = baos.toByteArray();
-         stmt.setBytes(column, messageAsBytes);
-      }
-      else if (blobType == BINARYSTREAM_BLOB)
-      {
-         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-         ObjectOutputStream oos = new ObjectOutputStream(baos);
-         oos.writeObject(xid);
-         oos.flush();
-         byte[] messageAsBytes = baos.toByteArray();
-         ByteArrayInputStream bais = new ByteArrayInputStream(messageAsBytes);
-         stmt.setBinaryStream(column, bais, messageAsBytes.length);
-      }
-      else if (blobType == BLOB_BLOB)
-      {
-
-         throw new RuntimeException("BLOB_TYPE: BLOB_BLOB is not yet implemented.");
-         /** TODO:
-         ByteArrayOutputStream baos= new ByteArrayOutputStream();
-         ObjectOutputStream oos= new ObjectOutputStream(baos);
-         oos.writeObject(xid);
-         byte[] messageAsBytes= baos.toByteArray();
-         ByteArrayInputStream bais= new ByteArrayInputStream(messageAsBytes);
-         stmt.setBsetBinaryStream(column, bais, messageAsBytes.length);
-         */
-      }
-   }
-
    /////////////////////////////////////////////////////////////////////////////////
    //
    // Updating a message
@@ -1314,16 +1045,14 @@
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1410,16 +1139,14 @@
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1444,11 +1171,17 @@
       return txManager;
    }
 
+   /*
+    * @see PersistenceManager#closeQueue(JMSDestination, SpyDestination)
+    */
    public void closeQueue(JMSDestination jmsDest, SpyDestination dest) throws JMSException
    {
       // Nothing to clean up, all the state is in the db.
    }
 
+   /*
+    * @see CacheStore#loadFromStorage(MessageReference)
+    */
    public SpyMessage loadFromStorage(MessageReference messageRef) throws JMSException
    {
       if (log.isTraceEnabled())
@@ -1489,24 +1222,21 @@
       {
          try
          {
-            if (rs != null)
-               rs.close();
+            rs.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1560,16 +1290,14 @@
       {
          try
          {
-            if (stmt != null)
-               stmt.close();
+            stmt.close();
          }
          catch (Throwable ignore)
          {
          }
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1582,6 +1310,9 @@
       }
    }
 
+   /*
+    * @see CacheStore#saveToStorage(MessageReference, SpyMessage)
+    */
    public void saveToStorage(MessageReference messageRef, SpyMessage message) throws JMSException
    {
       // Ignore save operations for persistent messages sent to persistent queues
@@ -1621,8 +1352,7 @@
       {
          try
          {
-            if (c != null)
-               c.close();
+            c.close();
          }
          catch (Throwable ignore)
          {
@@ -1707,28 +1437,18 @@
    public void startService() throws Exception
    {
       UPDATE_MARKED_MESSAGES = sqlProperties.getProperty("UPDATE_MARKED_MESSAGES", UPDATE_MARKED_MESSAGES);
-      UPDATE_MARKED_MESSAGES_XARECOVERY = 
-         sqlProperties.getProperty("UPDATE_MARKED_MESSAGES_XARECOVERY", UPDATE_MARKED_MESSAGES_XARECOVERY);
       UPDATE_MARKED_MESSAGES_WITH_TX =
          sqlProperties.getProperty("UPDATE_MARKED_MESSAGES_WITH_TX", UPDATE_MARKED_MESSAGES_WITH_TX);
       DELETE_MARKED_MESSAGES_WITH_TX =
          sqlProperties.getProperty("DELETE_MARKED_MESSAGES_WITH_TX", DELETE_MARKED_MESSAGES_WITH_TX);
-      DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY =
-         sqlProperties.getProperty("DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY", DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY);
       DELETE_TX = sqlProperties.getProperty("DELETE_TX", DELETE_TX);
       DELETE_MARKED_MESSAGES = sqlProperties.getProperty("DELETE_MARKED_MESSAGES", DELETE_MARKED_MESSAGES);
       DELETE_TEMPORARY_MESSAGES = sqlProperties.getProperty("DELETE_TEMPORARY_MESSAGES", DELETE_TEMPORARY_MESSAGES);
       INSERT_TX = sqlProperties.getProperty("INSERT_TX", INSERT_TX);
-      INSERT_TX_XARECOVERY = sqlProperties.getProperty("INSERT_TX_XARECOVERY", INSERT_TX_XARECOVERY);
       DELETE_ALL_TX = sqlProperties.getProperty("DELETE_ALL_TX", DELETE_ALL_TX);
-      DELETE_ALL_TX_XARECOVERY = sqlProperties.getProperty("DELETE_ALL_TX_XARECOVERY", DELETE_ALL_TX_XARECOVERY);
-      SELECT_ALL_TX_XARECOVERY = sqlProperties.getProperty("SELECT_ALL_TX_XARECOVERY", SELECT_ALL_TX_XARECOVERY);
       SELECT_MAX_TX = sqlProperties.getProperty("SELECT_MAX_TX", SELECT_MAX_TX);
       SELECT_MESSAGES_IN_DEST = sqlProperties.getProperty("SELECT_MESSAGES_IN_DEST", SELECT_MESSAGES_IN_DEST);
-      SELECT_MESSAGES_IN_DEST_XARECOVERY = sqlProperties.getProperty("SELECT_MESSAGES_IN_DEST_XARECOVERY", SELECT_MESSAGES_IN_DEST_XARECOVERY);
-      SELECT_MESSAGE_KEYS_IN_DEST = sqlProperties.getProperty("SELECT_MESSAGE_KEYS_IN_DEST", SELECT_MESSAGE_KEYS_IN_DEST);
       SELECT_MESSAGE = sqlProperties.getProperty("SELECT_MESSAGE", SELECT_MESSAGE);
-      SELECT_MESSAGE_XARECOVERY = sqlProperties.getProperty("SELECT_MESSAGE_XARECOVERY", SELECT_MESSAGE_XARECOVERY);
       INSERT_MESSAGE = sqlProperties.getProperty("INSERT_MESSAGE", INSERT_MESSAGE);
       MARK_MESSAGE = sqlProperties.getProperty("MARK_MESSAGE", MARK_MESSAGE);
       DELETE_MESSAGE = sqlProperties.getProperty("DELETE_MESSAGE", DELETE_MESSAGE);
@@ -1737,7 +1457,6 @@
       CREATE_IDX_MESSAGE_TXOP_TXID = sqlProperties.getProperty("CREATE_IDX_MESSAGE_TXOP_TXID", CREATE_IDX_MESSAGE_TXOP_TXID);
       CREATE_IDX_MESSAGE_DESTINATION = sqlProperties.getProperty("CREATE_IDX_MESSAGE_DESTINATION", CREATE_IDX_MESSAGE_DESTINATION);
       CREATE_TX_TABLE = sqlProperties.getProperty("CREATE_TX_TABLE", CREATE_TX_TABLE);
-      CREATE_TX_TABLE_XARECOVERY = sqlProperties.getProperty("CREATE_TX_TABLE_XARECOVERY", CREATE_TX_TABLE_XARECOVERY);
       createTables = sqlProperties.getProperty("CREATE_TABLES_ON_STARTUP", "true").equalsIgnoreCase("true");
       String s = sqlProperties.getProperty("BLOB_TYPE", "OBJECT_BLOB");
 
@@ -1758,10 +1477,16 @@
          blobType = BLOB_BLOB;
       }
 
+      //Find the ConnectionFactoryLoader MBean so we can find the datasource
+      String dsName = (String) getServer().getAttribute(connectionManagerName, "BindName");
+      //Get an InitialContext
 
-      // initialize tm and datasource
-      initializeFields();
+      InitialContext ctx = new InitialContext();
+      datasource = (DataSource) ctx.lookup(dsName);
 
+      //Get the Transaction Manager so we can control the jdbc tx
+      tm = (TransactionManager) ctx.lookup(TransactionManagerService.JNDI_NAME);
+
       log.debug("Creating Schema");
       createSchema();
       
@@ -1789,40 +1514,48 @@
          SpyJMSException.rethrowAsJMSException("Unable to resolve transactions retries=" + recoveryRetries, error);
    }
 
-   protected void initializeFields()
-           throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, NamingException
-   {
-      //Find the ConnectionFactoryLoader MBean so we can find the datasource
-      String dsName = (String) getServer().getAttribute(connectionManagerName, "BindName");
-      //Get an InitialContext
-
-      InitialContext ctx = new InitialContext();
-      datasource = (DataSource) ctx.lookup(dsName);
-
-      //Get the Transaction Manager so we can control the jdbc tx
-      tm = (TransactionManager) ctx.lookup(TransactionManagerService.JNDI_NAME);
-   }
-
+   /**
+    * Describe <code>getInstance</code> method here.
+    *
+    * @return an <code>Object</code> value
+    * @jmx:managed-attribute
+    */
    public Object getInstance()
    {
       return this;
    }
 
+   /**
+    * Describe <code>getMessageCache</code> method here.
+    *
+    * @return an <code>ObjectName</code> value
+    */
    public ObjectName getMessageCache()
    {
       throw new UnsupportedOperationException("This is now set on the destination manager");
    }
 
+   /**
+    * Describe <code>setMessageCache</code> method here.
+    *
+    * @param messageCache an <code>ObjectName</code> value
+    */
    public void setMessageCache(ObjectName messageCache)
    {
       throw new UnsupportedOperationException("This is now set on the destination manager");
    }
 
+   /**
+    * @jmx:managed-attribute
+    */
    public ObjectName getConnectionManager()
    {
       return connectionManagerName;
    }
 
+   /**
+    * @jmx:managed-attribute
+    */
    public void setConnectionManager(ObjectName connectionManagerName)
    {
       this.connectionManagerName = connectionManagerName;
@@ -1833,6 +1566,13 @@
       throw new UnsupportedOperationException("This is now set on the destination manager");
    }
 
+   /**
+    * Gets the sqlProperties.
+    *
+    * @jmx:managed-attribute
+    *
+    * @return Returns a Properties
+    */
    public String getSqlProperties()
    {
       try
@@ -1847,24 +1587,47 @@
       }
    }
 
+   /**
+    * Sets the sqlProperties.
+    *
+    * @jmx:managed-attribute
+    *
+    * @param sqlProperties The sqlProperties to set
+    */
    public void setSqlProperties(String value)
    {
       try
       {
+
          ByteArrayInputStream is = new ByteArrayInputStream(value.getBytes());
          sqlProperties = new Properties();
          sqlProperties.load(is);
+
       }
       catch (IOException shouldnothappen)
       {
       }
    }
 
+   /**
+    * Sets the ConnectionRetryAttempts.
+    *
+    * @jmx:managed-attribute
+    *
+    * @param connectionRetryAttempts value
+    */
    public void setConnectionRetryAttempts(int value)
    {
       this.connectionRetryAttempts = value;
    }
 
+   /**
+    * Gets the ConnectionRetryAttempts.
+    *
+    * @jmx:managed-attribute
+    *
+    * @return Returns a ConnectionRetryAttempt value
+    */
    public int getConnectionRetryAttempts()
    {
       return this.connectionRetryAttempts;
@@ -1889,29 +1652,4 @@
    {
       this.recoveryRetries = retries;
    }
-
-   public int getRecoverMessagesChunk()
-   {
-      return recoverMessagesChunk;
-   }
-
-   public void setRecoverMessagesChunk(int recoverMessagesChunk)
-   {
-      if (recoverMessagesChunk != 0 && recoverMessagesChunk != 1)
-      {
-         log.warn("Only the values 0 and 1 are currently support for chunk size, using chunk size=1");
-         recoverMessagesChunk = 1;
-      }
-      this.recoverMessagesChunk = recoverMessagesChunk;
-   }
-
-   public boolean isXARecovery()
-   {
-      return xaRecovery;
-   }
-
-   public void setXARecovery(boolean xaRecovery)
-   {
-      this.xaRecovery = xaRecovery;
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.pm.jdbc2;
 
 import javax.management.ObjectName;
@@ -28,11 +13,6 @@
 
 /**
  * MBean interface.
- * 
- * @author Jayesh Parayali (jayeshpk1 at yahoo.com)
- * @author Hiram Chirino (cojonudo14 at hotmail.com)
- * @author Adrian Brock (adrian at jboss.com)
- * @version $Revision$
  */
 public interface PersistenceManagerMBean extends ServiceMBean, org.jboss.mq.pm.PersistenceManagerMBean, CacheStoreMBean
 {
@@ -101,43 +81,11 @@
 
    /**
     * Returns the recovery retries
-    * 
-    * @return the retries
     */
-   int getRecoveryRetries();
+   public int getRecoveryRetries();
 
    /**
     * Set the recovery retries
-    * 
-    * @param retries the number of retries
     */
-   void setRecoveryRetries(int retries);
-
-   /**
-    * Returns the recover messages chunk
-    * 
-    * @return the chunk size
-    */
-   int getRecoverMessagesChunk();
-
-   /**
-    * Set the recover messages chunk
-    * 
-    * @param recoverMessagesChunk the chunk size
-    */
-   void setRecoverMessagesChunk(int recoverMessagesChunk);
-
-   /**
-    * Get the xaRecovery.
-    * 
-    * @return the xaRecovery.
-    */
-   boolean isXARecovery();
-
-   /**
-    * Set the xaRecovery.
-    * 
-    * @param xaRecovery the xaRecovery.
-    */
-   void setXARecovery(boolean xaRecovery);
+   public void setRecoveryRetries(int retries);
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueue.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueue.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueue.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server;
 
 import java.util.ArrayList;
@@ -28,7 +13,6 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -39,14 +23,12 @@
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.DestinationFullException;
 import org.jboss.mq.SpyJMSException;
-import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.Subscription;
 import org.jboss.mq.pm.Tx;
-import org.jboss.mq.pm.TxManager;
 import org.jboss.mq.selectors.Selector;
-import org.jboss.util.NestedRuntimeException;
 import org.jboss.util.timeout.Timeout;
+import org.jboss.util.timeout.TimeoutFactory;
 import org.jboss.util.timeout.TimeoutTarget;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
@@ -74,8 +56,12 @@
  */
 public class BasicQueue
 {
+   // Constants -----------------------------------------------------
+
    static final Logger log = Logger.getLogger(BasicQueue.class);
 
+   // Attributes ----------------------------------------------------
+
    /** List of messages waiting to be dispatched<p>
        synchronized access on itself */
    SortedSet messages = new TreeSet();
@@ -121,7 +107,11 @@
 
    /** Have we been stopped */
    boolean stopped = false;
+   
+   // Static --------------------------------------------------------
 
+   // Constructors --------------------------------------------------
+
    /**
     * Construct a new basic queue
     * 
@@ -150,6 +140,8 @@
       }
    }
 
+   // Public --------------------------------------------------------
+
    /**
     * Retrieve the unique description for this queue
     *
@@ -220,7 +212,9 @@
                   if (message.isExpired())
                   {
                      it.remove();
-                     expireMessageAsync(message);
+                     if (trace)
+                        log.trace("message expired: " + message);
+                     dropMessage(message);
                   }
                   else if (sub.accepts(message.getHeaders()))
                   {
@@ -244,19 +238,6 @@
    }
 
    /**
-    * Get the subscribers
-    * 
-    * @return the subscribers
-    */
-   public Set getSubscribers()
-   {
-      synchronized (receivers)
-      {
-         return (Set) subscribers.clone();
-      }
-   }
-   
-   /**
     * Add a subscription from the queue
     *
     * @param sub the subscription to add
@@ -360,7 +341,13 @@
             }
          }
 
-         performOrPerpareAddMessage(mes, txId);
+         // The message is removed from the cache on a rollback
+         Runnable task = new AddMessagePostRollBackTask(mes);
+         server.getPersistenceManager().getTxManager().addPostRollbackTask(txId, task);
+
+         // The message gets added to the queue after the transaction commits
+         task = new AddMessagePostCommitTask(mes);
+         server.getPersistenceManager().getTxManager().addPostCommitTask(txId, task);
       }
       catch (Throwable t)
       {
@@ -372,75 +359,14 @@
    }
 
    /**
-    * Either perform or prepare the add message 
-    * 
-    * @param mes the message reference
-    * @param txId the transaction id
-    * @throws Exception for any error
-    */
-   protected void performOrPerpareAddMessage(MessageReference mes, Tx txId) throws Exception
-   {
-      TxManager txManager = server.getPersistenceManager().getTxManager();
-      
-      // The message is removed from the cache on a rollback
-      Runnable task = new AddMessagePostRollBackTask(mes);
-      txManager.addPostRollbackTask(txId, task);
-
-      // The message gets added to the queue after the transaction commits
-      task = new AddMessagePostCommitTask(mes);
-      txManager.addPostCommitTask(txId, task);
-   }
-   
-   /**
     * Restores a message.
-    * 
-    * @param mes the message reference
     */
    public void restoreMessage(MessageReference mes)
    {
-      restoreMessage(mes, null, Tx.UNKNOWN);
-   }
-
-   /**
-    * Restores a message.
-    * 
-    * @param mes the message reference
-    * @param txid the transaction id
-    * @param type the type of restoration
-    */
-   public void restoreMessage(MessageReference mes, Tx txid, int type)
-   {
       boolean trace = log.isTraceEnabled();
       if (trace)
-         log.trace("restoreMessage " + mes + " " + this + " txid=" + txid + " type=" + type);
-
-      try
-      {
-         if (txid == null)
-         {
-            internalAddMessage(mes);
-         }
-         else if (type == Tx.ADD)
-         {
-            performOrPerpareAddMessage(mes, txid);
-         }
-         else if (type == Tx.REMOVE)
-         {
-            performOrPerpareAcknowledgeMessage(mes, txid);
-         }
-         else
-         {
-            throw new IllegalStateException("Unknown restore type " + type + " for message " + mes + " txid=" + txid);
-         }
-      }
-      catch (RuntimeException e)
-      {
-         throw e;
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("Unable to restore message " + mes, e);
-      }
+         log.trace("restoreMessage " + mes + " " + this);
+      internalAddMessage(mes);
    }
 
    /**
@@ -544,7 +470,9 @@
 
                   if (messageRef.isExpired())
                   {
-                     expireMessageAsync(messageRef);
+                     if (trace)
+                        log.trace("message expired: " + messageRef);
+                     dropMessage(messageRef);
                      messageRef = null;
                   }
                   else
@@ -564,7 +492,9 @@
                   if (mr.isExpired())
                   {
                      i.remove();
-                     expireMessageAsync(mr);
+                     if (trace)
+                        log.trace("message expired: " + mr);
+                     dropMessage(mr);
                   }
                   else if (sub.accepts(mr.getHeaders()))
                   {
@@ -599,7 +529,7 @@
     * @param txid the transaction
     * @throws JMSException for any error
     */
-   public void acknowledge(AcknowledgementRequest item, Tx txId) throws JMSException
+   public void acknowledge(AcknowledgementRequest item, Tx txId) throws javax.jms.JMSException
    {
       boolean trace = log.isTraceEnabled();
       if (trace)
@@ -624,16 +554,20 @@
       // Was it a negative acknowledge??
       if (!item.isAck)
       {
-         Runnable task;
-         task = new RestoreMessageTask(m);
+         Runnable task = new RestoreMessageTask(m);
          server.getPersistenceManager().getTxManager().addPostCommitTask(txId, task);
+
       }
       else
       {
          if (m.isPersistent())
             server.getPersistenceManager().remove(m, txId);
 
-         performOrPerpareAcknowledgeMessage(m, txId);
+         Runnable task = new RestoreMessageTask(m);
+         server.getPersistenceManager().getTxManager().addPostRollbackTask(txId, task);
+
+         task = new RemoveMessageTask(m);
+         server.getPersistenceManager().getTxManager().addPostCommitTask(txId, task);
       }
 
       synchronized (receivers)
@@ -646,26 +580,6 @@
    }
 
    /**
-    * Either perform or prepare the acknowledge message 
-    * 
-    * @param mes the message reference
-    * @param txId the transaction id
-    * @throws Exception for any error
-    */
-   protected void performOrPerpareAcknowledgeMessage(MessageReference mes, Tx txId) throws JMSException
-   {
-      TxManager txManager = server.getPersistenceManager().getTxManager();
-      
-      // The message is restored to the queue on a rollback
-      Runnable task = new RestoreMessageTask(mes);
-      txManager.addPostRollbackTask(txId, task);
-
-      // The message is fully removed after the transaction commits
-      task = new RemoveMessageTask(mes);
-      txManager.addPostCommitTask(txId, task);
-   }
-
-   /**
     * Nack all messages for a subscription
     *
     * @param sub the subscription
@@ -718,15 +632,12 @@
          Map.Entry entry = (Map.Entry) i.next();
          MessageReference message = (MessageReference) entry.getKey();
          Timeout timeout = (Timeout) entry.getValue();
-         if (timeout != null)
-         {
-            timeout.cancel();
-            i.remove();
-            dropMessage(message);
-         }
+         timeout.cancel();
+         i.remove();
+         dropMessage(message);
       }
       scheduledMessageCount.set(0);
-
+      
       synchronized (receivers)
       {
          synchronized (messages)
@@ -836,11 +747,15 @@
    {
       return counter;
    }
+
+   // Object overrides ----------------------------------------------
    
    public String toString()
    {
       return super.toString() + "{id=" + description + '}';
    }
+   
+   // Protected -----------------------------------------------------
 
    /**
     * Clear all the events
@@ -852,11 +767,8 @@
       {
          Map.Entry entry = (Map.Entry) i.next();
          Timeout timeout = (Timeout) entry.getValue();
-         if (timeout != null)
-         {
-            timeout.cancel();
-            i.remove();
-         }
+         timeout.cancel();
+         i.remove();
       }
    }
    
@@ -908,12 +820,6 @@
       }
    }
 
-   private void addTimeout(MessageReference message, TimeoutTarget t, long ts)
-   {
-      Timeout timeout = server.getTimeoutFactory().schedule(ts, t);
-      events.put(message, timeout);
-   }
-
    /**
     * Add a message
     *
@@ -929,7 +835,9 @@
       long ts = message.messageScheduledDelivery;
       if (ts > 0 && ts > System.currentTimeMillis())
       {
-         addTimeout(message, new EnqueueMessageTask(message), ts);
+         EnqueueMessageTask t = new EnqueueMessageTask(message);
+         Timeout timeout = TimeoutFactory.createTimeout(ts, t);
+         events.put(message, timeout);
          scheduledMessageCount.increment();
          if (trace)
             log.trace("scheduled message at " + new Date(ts) + ": " + message);
@@ -940,7 +848,9 @@
       // Don't bother with expired messages
       if (message.isExpired())
       {
-         expireMessageAsync(message);
+         if (trace)
+            log.trace("message expired: " + message);
+         dropMessage(message);
          return;
       }
 
@@ -973,7 +883,10 @@
                   // the timer queue 
                   if (message.messageExpiration > 0)
                   {
-                     addTimeout(message, new ExpireMessageTask(message), message.messageExpiration);
+                     // This could be a waste of memory for large numbers of expirations
+                     ExpireMessageTask t = new ExpireMessageTask(message);
+                     Timeout timeout = TimeoutFactory.createTimeout(message.messageExpiration, t);
+                     events.put(message, timeout);
                   }
                }
             }
@@ -1028,26 +941,26 @@
    protected void setupMessageAcknowledgement(Subscription sub, MessageReference messageRef) throws JMSException
    {
       SpyMessage message = messageRef.getMessage();
-      AcknowledgementRequest nack = new AcknowledgementRequest(false);
-      nack.destination = message.getJMSDestination();
-      nack.messageID = message.getJMSMessageID();
-      nack.subscriberId = sub.subscriptionId;
+      AcknowledgementRequest ack = new AcknowledgementRequest();
+      ack.destination = message.getJMSDestination();
+      ack.messageID = message.getJMSMessageID();
+      ack.subscriberId = sub.subscriptionId;
+      ack.isAck = false;
 
       synchronized (messages)
       {
          UnackedMessageInfo unacked = new UnackedMessageInfo(messageRef, sub);
-         unacknowledgedMessages.put(nack, unacked);
-         unackedByMessageRef.put(messageRef, nack);
+         unacknowledgedMessages.put(ack, unacked);
+         unackedByMessageRef.put(messageRef, ack);
          HashMap map = (HashMap) unackedBySubscription.get(sub);
          if (map == null)
          {
             map = new HashMap();
             unackedBySubscription.put(sub, map);
          }
-         map.put(messageRef, nack);
+         map.put(messageRef, ack);
       }
    }
-
    /**
     * Remove a message
     *
@@ -1099,66 +1012,10 @@
       }
    }
 
-   /**
-    * Expire a message asynchronously.
-    *
-    * @param messageRef the message to remove
-    */
-   protected void expireMessageAsync(MessageReference messageRef)
-   {
-      server.getThreadPool().run(new ExpireMessageTask(messageRef));
-   }
-   
-   /**
-    * Expire a message
-    *
-    * @param messageRef the message to remove
-    */
-   protected void expireMessage(MessageReference messageRef)
-   {
-      boolean trace = log.isTraceEnabled();
-      if (trace)
-         log.trace("message expired: " + messageRef);
+   // Package Private -----------------------------------------------
 
-      SpyDestination ed = parameters.expiryDestination;
-      if (ed == null)
-      {
-         dropMessage(messageRef);
-         return;
-      }
+   // Private -------------------------------------------------------
 
-      if (trace)
-         log.trace("sending to: " + ed);
-
-      try
-      {
-         SpyMessage orig = messageRef.getMessage();
-         SpyMessage copy = orig.myClone();
-         copy.header.jmsPropertiesReadWrite = true;
-         copy.setJMSExpiration(0);
-         copy.setJMSDestination(ed);
-         copy.setLongProperty(SpyMessage.PROPERTY_ORIG_EXPIRATION, orig.getJMSExpiration());
-         copy.setStringProperty(SpyMessage.PROPERTY_ORIG_DESTINATION, orig.getJMSDestination().toString());
-         TxManager tm = server.getPersistenceManager().getTxManager();
-         Tx tx = tm.createTx();
-         try 
-         {
-            server.addMessage(null, copy, tx);
-            dropMessage(messageRef, tx);
-            tm.commitTx(tx);
-         }
-         catch (JMSException e)
-         {
-            tm.rollbackTx(tx);
-            throw e;
-         }
-      }
-      catch (JMSException e)
-      {
-         log.error("Could not move expired message: " + messageRef, e);
-      }
-   }
-
    /**
     * Check whether a removed subscription can be permenantly removed.
     * This method is private because it assumes external synchronization
@@ -1190,6 +1047,8 @@
       return unackedBySubscription.containsKey(sub);
    }
 
+   // Inner classes -------------------------------------------------
+
    /**
     * Rollback an add message
     */
@@ -1308,7 +1167,7 @@
    /**
     * Drop a message when it expires
     */
-   private class ExpireMessageTask implements TimeoutTarget, Runnable
+   private class ExpireMessageTask implements TimeoutTarget
    {
       private MessageReference messageRef;
 
@@ -1327,13 +1186,10 @@
             if (messages.remove(messageRef) == false)
                return;
          }
-         expireMessage(messageRef);
+         if (log.isTraceEnabled())
+            log.trace("message expired: " + messageRef);
+         dropMessage(messageRef);
       }
-
-      public void run()
-      {
-         expireMessage(messageRef);
-      }
    }
 
    /**

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueueParameters.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueueParameters.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/BasicQueueParameters.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,28 +1,11 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server;
 
-import org.jboss.mq.SpyDestination;
-
 /**
  * Parameters controlling a basic queue
  *
@@ -53,11 +36,8 @@
    public Class receiversImpl;
    
    /** The message counter history */
-   public int messageCounterHistoryDayLimit = 0;
+   public int messageCounterHistoryDayLimit = -1;
    
    /** The number of retries when recovering a queue/durable subscription */
    public int recoveryRetries = 0;
-   
-   /** The destination that receives expired messages */
-   public SpyDestination expiryDestination = null;
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestination.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestination.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestination.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server;
 
 import javax.jms.JMSException;
@@ -27,7 +12,6 @@
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.Subscription;
-import org.jboss.mq.pm.Tx;
 
 /**
  *  This class is a message queue which is stored (hashed by Destination) on the
@@ -36,12 +20,12 @@
  * @author     Norbert Lataille (Norbert.Lataille at m4x.org)
  * @author     Hiram Chirino (Cojonudo14 at hotmail.com)
  * @author     David Maplesden (David.Maplesden at orion.co.nz)
- * @author     Adrian Brock (adrian at jboss.com)
  * @created    August 16, 2001
  * @version    $Revision$
  */
 public abstract class JMSDestination
 {
+
    //the Destination of this queue
    SpyDestination destination;
    //If this is a temporaryDestination, temporaryDestination=ClientConsumer of the owner, otherwise it's null
@@ -61,6 +45,7 @@
 
    static Logger cat = Logger.getLogger(JMSDestination.class);
 
+   // Constructor ---------------------------------------------------
    JMSDestination(SpyDestination dest, ClientConsumer temporary, JMSDestinationManager server, BasicQueueParameters parameters) throws JMSException
    {
       destination = dest;
@@ -88,19 +73,7 @@
 
    public abstract void restoreMessage(MessageReference message);
 
-   public void restoreMessage(SpyMessage message)
-   {
-      restoreMessage(message, null, Tx.UNKNOWN);
-   }
-   
-   /**
-    * Restore a message
-    * 
-    * @param message the message
-    * @param tx any transaction
-    * @param type the type of restoration
-    */
-   public abstract void restoreMessage(SpyMessage message, Tx tx, int type);
+   public abstract void restoreMessage(SpyMessage message);
 
    public abstract boolean isInUse();
 

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+ * JBoss, the OpenSource J2EE webOS
  *
- * 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.
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
  */
 package org.jboss.mq.server;
 
@@ -34,8 +19,8 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
+import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
@@ -51,10 +36,7 @@
 import org.jboss.mq.TransactionRequest;
 import org.jboss.mq.pm.PersistenceManager;
 import org.jboss.mq.pm.Tx;
-import org.jboss.mq.pm.TxManager;
 import org.jboss.mq.sm.StateManager;
-import org.jboss.util.threadpool.ThreadPool;
-import org.jboss.util.timeout.TimeoutFactory;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
 
@@ -69,47 +51,41 @@
  */
 public class JMSDestinationManager extends JMSServerInterceptorSupport
 {
-   /** The version */
-   public final static String JBOSS_VERSION = "JBossMQ Version 4.0";
+   static Logger log = Logger.getLogger(JMSDestinationManager.class);
 
-   /** Destinations SpyDestination -> JMSDestination */
+   /**
+    * Description of the Field
+    */
+   public final static String JBOSS_VESION = "JBossMQ Version 3.2";
+
+   /////////////////////////////////////////////////////////////////////
+   // Attributes
+   /////////////////////////////////////////////////////////////////////
+
+   /** Destinations SpyDestination -> JMSDestination */ 
    public Map destinations = new ConcurrentReaderHashMap();
-
-   /** Destinations being closed SpyDestination -> JMSDestination */
+   /** Destinations being closed SpyDestination -> JMSDestination */ 
    public Map closingDestinations = new ConcurrentReaderHashMap();
-
-   /** Thread pool */
-   public ThreadPool threadPool;
-
+   //Thread group for server side threads.
    /** Thread group */
-   public ThreadGroup threadGroup;
+   public ThreadGroup threadGroup = new ThreadGroup("JBossMQ Server Threads");
 
-   /** Timeout factory */
-   public TimeoutFactory timeoutFactory;
-
-   /** The list of ClientConsumers hased by ConnectionTokens */
+   //The list of ClientConsumers hased by ConnectionTokens
    Map clientConsumers = new ConcurrentReaderHashMap();
 
-   /** last id given to a client */
+   //last id given to a client
    private int lastID = 1;
-
-   /** last id given to a temporary topic */
+   //last id given to a temporary topic
    private int lastTemporaryTopic = 1;
-
    private Object lastTemporaryTopicLock = new Object();
-
-   /** last id given to a temporary queue */
+   //last id given to a temporary queue
    private int lastTemporaryQueue = 1;
-
    private Object lastTemporaryQueueLock = new Object();
-
-   /** The security manager */
+   //The security manager
    private StateManager stateManager;
-
-   /** The persistence manager */
+   //The persistence manager
    private PersistenceManager persistenceManager;
-
-   /** The Cache Used to hold messages */
+   //The Cache Used to hold messages
    private MessageCache messageCache;
 
    private Object stateLock = new Object();
@@ -126,6 +102,9 @@
    /** Temporary queue/topic parameters */
    BasicQueueParameters parameters;
 
+   /////////////////////////////////////////////////////////////////////
+   // Constructors
+   /////////////////////////////////////////////////////////////////////
    /**
     * Constructor for the JMSServer object
     */
@@ -167,10 +146,14 @@
       persistenceManager = newPersistenceManager;
    }
 
+   /////////////////////////////////////////////////////////////////////
+   // Public Methods
+   /////////////////////////////////////////////////////////////////////
+
    /**
     * Returns <code>false</code> if the JMS server is currently running and
     * handling requests, <code>true</code> otherwise.
-    *
+   *
     * @return   <code>false</code> if the JMS server is currently running and
     *      handling requests, <code>true</code> otherwise.
     */
@@ -182,12 +165,6 @@
       }
    }
 
-   protected void checkStopped() throws IllegalStateException
-   {
-      if (isStopped())
-         throw new IllegalStateException("Server is stopped.");
-   }
-   
    /**
     *
     * @return the current client count
@@ -196,10 +173,7 @@
    {
       return clientConsumers.size();
    }
-
-   /** 
-    * Obtain a copy of the current clients
-    * 
+   /** Obtain a copy of the current clients
     * @return a HashMap<ConnectionToken, ClientConsumer> of current clients
     */
    public HashMap getClients()
@@ -207,31 +181,12 @@
       return new HashMap(clientConsumers);
    }
 
-   public void setThreadPool(ThreadPool threadPool)
-   {
-      this.threadPool = threadPool;
-   }
-
-   public ThreadPool getThreadPool()
-   {
-      return threadPool;
-   }
-
-   public void setThreadGroup(ThreadGroup threadGroup)
-   {
-      this.threadGroup = threadGroup;
-   }
-
    public ThreadGroup getThreadGroup()
    {
       return threadGroup;
    }
 
-   public TimeoutFactory getTimeoutFactory()
-   {
-      return timeoutFactory;
-   }
-
+   //Get a new ClientID for a connection
    /**
     * Gets the ID attribute of the JMSServer object
     *
@@ -241,10 +196,8 @@
    {
       String ID = null;
 
-      while (isStopped() == false)
+      while (true)
       {
-         if (stateManager == null)
-            throw new IllegalStateException("No statemanager");
          try
          {
             synchronized (idLock)
@@ -259,15 +212,18 @@
          }
       }
 
-      checkStopped();
-      
       return ID;
    }
 
+   /**
+    * Gets the TemporaryTopic attribute of the JMSServer object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws JMSException
    {
-      checkStopped();
-      
       String topicName;
       synchronized (lastTemporaryTopicLock)
       {
@@ -282,10 +238,15 @@
       return topic;
    }
 
+   /**
+    * Gets the TemporaryQueue attribute of the JMSServer object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws JMSException
    {
-      checkStopped();
-      
       String queueName;
       synchronized (lastTemporaryQueueLock)
       {
@@ -300,6 +261,15 @@
       return newQueue;
    }
 
+   // Gets the ClientConsumers mapped the the connection
+   // If the connection is not mapped, a new ClientConsumer is created
+   /**
+    * Gets the ClientConsumer attribute of the JMSServer object
+    *
+    * @param dc                Description of Parameter
+    * @return                  The ClientConsumer value
+    * @exception JMSException  Description of Exception
+    */
    public ClientConsumer getClientConsumer(ConnectionToken dc) throws JMSException
    {
       ClientConsumer cq = (ClientConsumer) clientConsumers.get(dc);
@@ -311,6 +281,12 @@
       return cq;
    }
 
+   /**
+    * Gets the JMSDestination attribute of the JMSServer object
+    *
+    * @param dest  Description of Parameter
+    * @return      The JMSDestination value
+    */
    public JMSDestination getJMSDestination(SpyDestination dest)
    {
       return (JMSDestination) destinations.get(dest);
@@ -346,62 +322,68 @@
     *
     * @return   The PersistenceManager value
     */
-   public PersistenceManager getPersistenceManager()
+   public org.jboss.mq.pm.PersistenceManager getPersistenceManager()
    {
       return persistenceManager;
    }
 
    /**
-    * Start the server
+    * #Description of the Method
     */
    public void startServer()
    {
       synchronized (stateLock)
       {
          this.stopped = false;
-         this.timeoutFactory = new TimeoutFactory(this.threadPool);
       }
    }
 
    /**
-    * Stop the server
+    * #Description of the Method
     */
    public void stopServer()
    {
       synchronized (stateLock)
       {
          this.stopped = true;
-         this.timeoutFactory.cancel();
-         
-         for (Iterator i = clientConsumers.keySet().iterator(); i.hasNext();)
-         {
-            ConnectionToken token = (ConnectionToken) i.next();
-            try
-            {
-               connectionClosing(token);
-            }
-            catch (Throwable t)
-            {
-               log.trace("Ignored error closing client connection " + token, t);
-            }
-         }
       }
    }
 
+   /**
+    * Check a clienID set by the client.
+    *
+    * @param ID                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void checkID(String ID) throws JMSException
    {
-      checkStopped();
       stateManager.addLoggedOnClientId(ID);
    }
 
+   //A connection has sent a new message
+   /**
+    * Adds a feature to the Message attribute of the JMSServer object
+    *
+    * @param dc                The feature to be added to the Message attribute
+    * @param val               The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage val) throws JMSException
    {
       addMessage(dc, val, null);
    }
 
+   //A connection has sent a new message
+   /**
+    * Adds a feature to the Message attribute of the JMSServer object
+    *
+    * @param dc                The feature to be added to the Message attribute
+    * @param val               The feature to be added to the Message attribute
+    * @param txId              The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage val, Tx txId) throws JMSException
    {
-      checkStopped();
       JMSDestination queue = (JMSDestination) destinations.get(val.getJMSDestination());
       if (queue == null)
          throw new InvalidDestinationException("This destination does not exist! " + val.getJMSDestination());
@@ -415,18 +397,25 @@
       queue.addMessage(val, txId);
    }
 
+   /**
+    * The following function performs a Unit Of Work.
+    *
+    * @param dc                Description of Parameter
+    * @param t                 Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void transact(ConnectionToken dc, TransactionRequest t) throws JMSException
    {
-      checkStopped();
-      boolean trace = log.isTraceEnabled();
-      TxManager txManager = persistenceManager.getTxManager();
+
+      org.jboss.mq.pm.TxManager txManager = persistenceManager.getTxManager();
       if (t.requestType == TransactionRequest.ONE_PHASE_COMMIT_REQUEST)
       {
+
          Tx txId = txManager.createTx();
-         if (trace)
-            log.trace(dc + " 1PC " + t.xid + " txId=" + txId.longValue());
+
          try
          {
+
             if (t.messages != null)
             {
                for (int i = 0; i < t.messages.length; i++)
@@ -434,6 +423,7 @@
                   addMessage(dc, t.messages[i], txId);
                }
             }
+
             if (t.acks != null)
             {
                for (int i = 0; i < t.acks.length; i++)
@@ -441,7 +431,9 @@
                   acknowledge(dc, t.acks[i], txId);
                }
             }
+
             txManager.commitTx(txId);
+
          }
          catch (JMSException e)
          {
@@ -452,11 +444,11 @@
       }
       else if (t.requestType == TransactionRequest.TWO_PHASE_COMMIT_PREPARE_REQUEST)
       {
+
          Tx txId = txManager.createTx(dc, t.xid);
-         if (trace)
-            log.trace(dc + " 2PC PREPARE " + t.xid + " txId=" + txId.longValue());
          try
          {
+
             if (t.messages != null)
             {
                for (int i = 0; i < t.messages.length; i++)
@@ -464,6 +456,7 @@
                   addMessage(dc, t.messages[i], txId);
                }
             }
+
             if (t.acks != null)
             {
                for (int i = 0; i < t.acks.length; i++)
@@ -471,8 +464,7 @@
                   acknowledge(dc, t.acks[i], txId);
                }
             }
-            
-            txManager.markPrepared(dc, t.xid, txId);
+
          }
          catch (JMSException e)
          {
@@ -483,37 +475,58 @@
       }
       else if (t.requestType == TransactionRequest.TWO_PHASE_COMMIT_ROLLBACK_REQUEST)
       {
-         if (trace)
-            log.trace(dc + " 2PC ROLLBACK " + t.xid);
-         txManager.rollbackTx(dc, t.xid);
+
+         Tx txId = txManager.getPrepared(dc, t.xid);
+         txManager.rollbackTx(txId);
+
       }
       else if (t.requestType == TransactionRequest.TWO_PHASE_COMMIT_COMMIT_REQUEST)
       {
-         if (trace)
-            log.trace(dc + " 2PC COMMIT " + t.xid);
-         txManager.commitTx(dc, t.xid);
+
+         Tx txId = txManager.getPrepared(dc, t.xid);
+         txManager.commitTx(txId);
+
       }
-   }
 
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      checkStopped();
-      TxManager txManager = persistenceManager.getTxManager();
-      return txManager.recover(dc, flags);
    }
 
+   //Sent by a client to Ack or Nack a message.
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param item              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws JMSException
    {
       acknowledge(dc, item, null);
    }
 
+   //Sent by a client to Ack or Nack a message.
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param item              Description of Parameter
+    * @param txId              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item, Tx txId) throws JMSException
    {
-      checkStopped();
+
       ClientConsumer cc = getClientConsumer(dc);
       cc.acknowledge(item, txId);
+
    }
 
+   //A connection is closing [error or notification]
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void connectionClosing(ConnectionToken dc) throws JMSException
    {
       if (dc == null)
@@ -534,14 +547,11 @@
       {
          Map.Entry entry = (Map.Entry) i.next();
          JMSDestination sq = (JMSDestination) entry.getValue();
-         if (sq != null)
+         ClientConsumer cc = sq.temporaryDestination;
+         if (cc != null && dc.equals(cc.connectionToken))
          {
-            ClientConsumer cc = sq.temporaryDestination;
-            if (cc != null && dc.equals(cc.connectionToken))
-            {
-               i.remove();
-               deleteTemporaryDestination(dc, sq);
-            }
+            i.remove();
+            deleteTemporaryDestination(dc, sq);
          }
       }
       // Close the clientIL
@@ -552,12 +562,19 @@
       }
       catch (Exception ex)
       {
-         // We skip warning, to often the client will always
+         // We skipp warning, to often the client will allways
          // have gone when we get here
          //log.warn("Could not close clientIL: " +ex,ex);
       }
+
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void connectionFailure(ConnectionToken dc) throws JMSException
    {
       //We should try again :) This behavior should under control of a Failure-Plugin
@@ -565,29 +582,56 @@
       connectionClosing(dc);
    }
 
+   //A connection object wants to subscribe to a Destination
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param sub               Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void subscribe(ConnectionToken dc, Subscription sub) throws JMSException
    {
-      checkStopped();
       ClientConsumer clientConsumer = getClientConsumer(dc);
       clientConsumer.addSubscription(sub);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param subscriptionId    Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void unsubscribe(ConnectionToken dc, int subscriptionId) throws JMSException
    {
-      checkStopped();
       ClientConsumer clientConsumer = getClientConsumer(dc);
       clientConsumer.removeSubscription(subscriptionId);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws JMSException
    {
-      checkStopped();
       getStateManager().setDurableSubscription(this, id, null);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param dest              Description of Parameter
+    * @param selector          Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector) throws JMSException
    {
-      checkStopped();
+
       JMSDestination queue = (JMSDestination) destinations.get(dest);
       if (queue == null)
          throw new InvalidDestinationException("That destination does not exist! " + dest);
@@ -597,47 +641,80 @@
       return ((JMSQueue) queue).browse(selector);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param subscriberId      Description of Parameter
+    * @param wait              Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws JMSException
    {
-      checkStopped();
       ClientConsumer clientConsumer = getClientConsumer(dc);
       SpyMessage msg = clientConsumer.receive(subscriberId, wait);
       return msg;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param name              Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Queue createQueue(ConnectionToken dc, String name) throws JMSException
    {
-      checkStopped();
       SpyQueue newQueue = new SpyQueue(name);
       if (!destinations.containsKey(newQueue))
-         throw new JMSException("This destination does not exist !" + newQueue);
+      {
+         throw new JMSException("This destination does not exist !");
+      }
       return newQueue;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param name              Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Topic createTopic(ConnectionToken dc, String name) throws JMSException
    {
-      checkStopped();
       SpyTopic newTopic = new SpyTopic(name);
       if (!destinations.containsKey(newTopic))
-         throw new JMSException("This destination does not exist !" + newTopic);
+      {
+         throw new JMSException("This destination does not exist !");
+      }
       return newTopic;
    }
 
-   public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException
+   /**
+    * #Description of the Method
+    *
+    * @param dc    Description of Parameter
+    * @param dest  Description of Parameter
+    */
+   public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest)
+      throws JMSException
    {
-      checkStopped();
       JMSDestination destination = (JMSDestination) destinations.get(dest);
       if (destination == null)
          throw new InvalidDestinationException("That destination does not exist! " + destination);
 
       if (destination.isInUse())
          throw new JMSException("Cannot delete temporary queue, it is in use.");
-
+      
       destinations.remove(dest);
       deleteTemporaryDestination(dc, destination);
    }
 
-   protected void deleteTemporaryDestination(ConnectionToken dc, JMSDestination destination) throws JMSException
+   protected void deleteTemporaryDestination(ConnectionToken dc, JMSDestination destination)
+      throws JMSException
    {
       try
       {
@@ -645,25 +722,45 @@
       }
       catch (Exception e)
       {
-         log.error("An exception happened while removing all messages from temporary destination "
-               + destination.getSpyDestination().getName(), e);
+         log.error("An exception happened while removing all messages from temporary destination " 
+                   + destination.getSpyDestination().getName(), e);
       }
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param userName          Description of Parameter
+    * @param password          Description of Parameter
+    * @return                  Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public String checkUser(String userName, String password) throws JMSException
    {
-      checkStopped();
       return stateManager.checkUser(userName, password);
    }
-
+   /**
+    * authenticate user and return a session id. Same as checkID.
+    *
+    * @param ID                Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public String authenticate(String id, String password) throws JMSException
    {
-      checkStopped();
       // do nothing
       return null;
    }
-
+   // Administration calls
+   /**
+    * Adds a feature to the Destination attribute of the JMSServer object
+    *
+    * @param topic             The feature to be added to the Destination
+    *      attribute
+    * @param queue             The feature to be added to the Destination
+    *      attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addDestination(JMSDestination destination) throws JMSException
    {
       if (destinations.containsKey(destination.getSpyDestination()))
@@ -675,7 +772,8 @@
       // Restore the messages
       if (destination instanceof JMSTopic)
       {
-         Collection durableSubs = getStateManager().getDurableSubscriptionIdsForTopic((SpyTopic) destination.getSpyDestination());
+         Collection durableSubs =
+            getStateManager().getDurableSubscriptionIdsForTopic((SpyTopic) destination.getSpyDestination());
          for (Iterator i = durableSubs.iterator(); i.hasNext();)
          {
             DurableSubscriptionID sub = (DurableSubscriptionID) i.next();
@@ -698,7 +796,7 @@
          throw new InvalidDestinationException("This destination is not open! " + dest);
 
       log.debug("Closing destination " + dest);
-
+      
       // Add it to the closing list
       closingDestinations.put(dest, destination);
       try
@@ -711,14 +809,25 @@
       }
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @return   Description of the Returned Value
+    */
    public String toString()
    {
-      return JBOSS_VERSION;
+      return JBOSS_VESION;
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc                Description of Parameter
+    * @param clientTime        Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void ping(ConnectionToken dc, long clientTime) throws JMSException
    {
-      checkStopped();
       try
       {
          dc.clientIL.pong(System.currentTimeMillis());
@@ -749,13 +858,11 @@
 
    public SpyTopic getDurableTopic(DurableSubscriptionID sub) throws JMSException
    {
-      checkStopped();
       return getStateManager().getDurableTopic(sub);
    }
 
    public Subscription getSubscription(ConnectionToken dc, int subscriberId) throws JMSException
    {
-      checkStopped();
       ClientConsumer clientConsumer = getClientConsumer(dc);
       return clientConsumer.getSubscription(subscriberId);
    }
@@ -780,7 +887,11 @@
          for (int j = 0; j < counter.length; j++)
          {
             // sorting order name + subscription + type
-            String key = counter[j].getDestinationName() + "-" + counter[j].getDestinationSubscription() + "-"
+            String key =
+               counter[j].getDestinationName()
+                  + "-"
+                  + counter[j].getDestinationSubscription()
+                  + "-"
                   + (counter[j].getDestinationTopic() ? "Topic" : "Queue");
 
             map.put(key, counter[j]);
@@ -809,9 +920,4 @@
          }
       }
    }
-
-   public BasicQueueParameters getParameters()
-   {
-      return parameters;
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSQueue.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSQueue.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSQueue.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server;
 
 import java.util.ArrayList;
@@ -29,7 +14,6 @@
 import org.jboss.mq.SpyJMSException;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.Subscription;
-import org.jboss.mq.pm.Tx;
 
 /**
  *  This class is a message queue which is stored (hashed by Destination) on the
@@ -38,7 +22,6 @@
  * @author     Norbert Lataille (Norbert.Lataille at m4x.org)
  * @author     Hiram Chirino (Cojonudo14 at hotmail.com)
  * @author     David Maplesden (David.Maplesden at orion.co.nz)
- * @author     Adrian Brock (adrian at jboss.com)
  * @created    August 16, 2001
  * @version    $Revision$
  */
@@ -47,6 +30,7 @@
 
    public BasicQueue queue;
 
+   // Constructor ---------------------------------------------------
    public JMSQueue(SpyDestination dest, ClientConsumer temporary, JMSDestinationManager server, BasicQueueParameters parameters) throws JMSException
    {
       super(dest, temporary, server, parameters);
@@ -142,13 +126,13 @@
       }
    }
 
-   public void restoreMessage(SpyMessage message, Tx txid, int type)
+   public void restoreMessage(SpyMessage message)
    {
       try
       {
          updateNextMessageId(message);
          MessageReference messageRef = server.getMessageCache().add(message, queue, MessageReference.STORED);
-         queue.restoreMessage(messageRef, txid, type);
+         queue.restoreMessage(messageRef);
       }
       catch (JMSException e)
       {

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInterceptorSupport.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInterceptorSupport.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInterceptorSupport.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource EJB server
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.server;
 
@@ -27,13 +12,11 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.SpyTopic;
@@ -44,10 +27,10 @@
  * A pass through JMSServerInvoker.
  *
  * @author <a href="mailto:pra at tim.se">Peter Antman</a>
- * @author <a href="adrian at jboss.org">Adrian Brock</a>
  * @version $Revision$
  */
-public class JMSServerInterceptorSupport implements JMSServerInterceptor, Recoverable
+
+public class JMSServerInterceptorSupport implements JMSServerInterceptor
 {
    protected Logger log;
    /**
@@ -60,117 +43,267 @@
       log = Logger.getLogger(this.getClass().getName());
    }
 
+   /**
+    * Set next invoker in chain to be called. Is mot often the real JMSServer
+    */
    public void setNext(JMSServerInterceptor server)
    {
       this.nextInterceptor = server;
    }
 
+   /**
+    * @see JMSServerInterceptor#getNext()
+    */
    public JMSServerInterceptor getNext()
    {
       return this.nextInterceptor;
    }
 
+   /**
+    * Get the thread group of the server.
+    */
    public ThreadGroup getThreadGroup()
    {
       return nextInterceptor.getThreadGroup();
    }
-
+   /**
+    * Gets a clientID from server.
+    *
+    * @return               The ID value
+    * @exception JMSException  Description of Exception
+    */
    public String getID() throws JMSException
    {
       String ID = nextInterceptor.getID();
       return ID;
    }
 
+   /**
+    * Gets the TemporaryTopic attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws JMSException
    {
       return nextInterceptor.getTemporaryTopic(dc);
    }
 
+   /**
+    * Gets the TemporaryQueue attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws JMSException
    {
       return nextInterceptor.getTemporaryQueue(dc);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void connectionClosing(ConnectionToken dc) throws JMSException
    {
       nextInterceptor.connectionClosing(dc);
    }
 
+   /**
+    * Check id, must not be taken.
+    *
+    * @param ID             a clientID
+    * @exception JMSException if ID is already taken
+    */
    public void checkID(String ID) throws JMSException
    {
       nextInterceptor.checkID(ID);
    }
 
+   /**
+    * Add the message to the destination.
+    *
+    * @param dc             The feature to be added to the Message attribute
+    * @param message        The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage message) throws JMSException
    {
       nextInterceptor.addMessage(dc, message);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Queue createQueue(ConnectionToken dc, String dest) throws JMSException
    {
       return nextInterceptor.createQueue(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Topic createTopic(ConnectionToken dc, String dest) throws JMSException
    {
       return nextInterceptor.createTopic(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException
    {
       nextInterceptor.deleteTemporaryDestination(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param t              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void transact(ConnectionToken dc, TransactionRequest t) throws JMSException
    {
       nextInterceptor.transact(dc, t);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param item           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws JMSException
    {
       nextInterceptor.acknowledge(dc, item);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @param selector       Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector) throws JMSException
    {
       return nextInterceptor.browse(dc, dest, selector);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param subscriberId   Description of Parameter
+    * @param wait           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws JMSException
    {
       return nextInterceptor.receive(dc, subscriberId, wait);
    }
 
+   /**
+    * Sets the Enabled attribute of the ServerIL object
+    *
+    * @param dc             The new Enabled value
+    * @param enabled        The new Enabled value
+    * @exception JMSException  Description of Exception
+    */
    public void setEnabled(ConnectionToken dc, boolean enabled) throws JMSException
    {
       nextInterceptor.setEnabled(dc, enabled);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc              Description of Parameter
+    * @param subscriptionId  Description of Parameter
+    * @exception JMSException   Description of Exception
+    */
    public void unsubscribe(ConnectionToken dc, int subscriptionId) throws JMSException
    {
       nextInterceptor.unsubscribe(dc, subscriptionId);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws JMSException
    {
       nextInterceptor.destroySubscription(dc, id);
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a clientId.
+    * @exception JMSException  if user was not allowed to login
+    */
    public String checkUser(String userName, String password) throws JMSException
    {
       return nextInterceptor.checkUser(userName, password);
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a sessionId
+    * @exception JMSException  if user was not allowed to login
+    */
    public String authenticate(String userName, String password) throws JMSException
    {
       return nextInterceptor.authenticate(userName, password);
    }
 
+   /**
+    * @param dc                       org.jboss.mq.ConnectionToken
+    * @param s                        org.jboss.mq.Subscription
+    * @exception JMSException  The exception description.
+    */
    public void subscribe(org.jboss.mq.ConnectionToken dc, org.jboss.mq.Subscription s) throws JMSException
    {
       nextInterceptor.subscribe(dc, s);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param clientTime     Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void ping(ConnectionToken dc, long clientTime) throws JMSException
    {
       nextInterceptor.ping(dc, clientTime);
@@ -186,14 +319,4 @@
       return nextInterceptor.getSubscription(dc, subscriberId);
    }
 
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      JMSServerInterceptor next = nextInterceptor;
-      while (next != null && next instanceof Recoverable == false)
-         next = next.getNext();
-      if (next == null)
-         throw new IllegalStateException("No interceptor implements " + Recoverable.class.getName());
-      Recoverable recoverable = (Recoverable) next;
-      return recoverable.recover(dc, flags);
-   }
-}
+} // JMSServerInvokerSupport

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInvoker.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInvoker.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSServerInvoker.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource EJB server
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.server;
 
@@ -27,13 +12,11 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
-import org.jboss.mq.Recoverable;
 import org.jboss.mq.SpyDestination;
 import org.jboss.mq.SpyMessage;
 import org.jboss.mq.SpyTopic;
@@ -45,10 +28,10 @@
  * A pass through JMSServerInvoker.
  *
  * @author <a href="mailto:pra at tim.se">Peter Antman</a>
- * @author <a href="adrian at jboss.org">Adrian Brock</a>
  * @version $Revision$
  */
-public class JMSServerInvoker implements Invoker, Recoverable
+
+public class JMSServerInvoker implements Invoker
 {
    protected Logger log;
    /**
@@ -77,106 +60,250 @@
       return this.nextInterceptor;
    }
 
+   /**
+    * Get the thread group of the server.
+    */
    public ThreadGroup getThreadGroup()
    {
       return nextInterceptor.getThreadGroup();
    }
-
+   /**
+    * Gets a clientID from server.
+    *
+    * @return               The ID value
+    * @exception JMSException  Description of Exception
+    */
    public String getID() throws JMSException
    {
       return nextInterceptor.getID();
    }
 
+   /**
+    * Gets the TemporaryTopic attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws JMSException
    {
       return nextInterceptor.getTemporaryTopic(dc);
    }
 
+   /**
+    * Gets the TemporaryQueue attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws JMSException
    {
       return nextInterceptor.getTemporaryQueue(dc);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void connectionClosing(ConnectionToken dc) throws JMSException
    {
       nextInterceptor.connectionClosing(dc);
    }
 
+   /**
+    * Check id, must not be taken.
+    *
+    * @param ID             a clientID
+    * @exception JMSException if ID is already taken
+    */
    public void checkID(String ID) throws JMSException
    {
       nextInterceptor.checkID(ID);
    }
 
+   /**
+    * Add the message to the destination.
+    *
+    * @param dc             The feature to be added to the Message attribute
+    * @param message        The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage message) throws JMSException
    {
       nextInterceptor.addMessage(dc, message);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Queue createQueue(ConnectionToken dc, String dest) throws JMSException
    {
       return nextInterceptor.createQueue(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Topic createTopic(ConnectionToken dc, String dest) throws JMSException
    {
       return nextInterceptor.createTopic(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException
    {
       nextInterceptor.deleteTemporaryDestination(dc, dest);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param t              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void transact(ConnectionToken dc, TransactionRequest t) throws JMSException
    {
       nextInterceptor.transact(dc, t);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param item           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws JMSException
    {
       nextInterceptor.acknowledge(dc, item);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @param selector       Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector) throws JMSException
    {
       return nextInterceptor.browse(dc, dest, selector);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param subscriberId   Description of Parameter
+    * @param wait           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws JMSException
    {
       return nextInterceptor.receive(dc, subscriberId, wait);
    }
 
+   /**
+    * Sets the Enabled attribute of the ServerIL object
+    *
+    * @param dc             The new Enabled value
+    * @param enabled        The new Enabled value
+    * @exception JMSException  Description of Exception
+    */
    public void setEnabled(ConnectionToken dc, boolean enabled) throws JMSException
    {
       nextInterceptor.setEnabled(dc, enabled);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc              Description of Parameter
+    * @param subscriptionId  Description of Parameter
+    * @exception JMSException   Description of Exception
+    */
    public void unsubscribe(ConnectionToken dc, int subscriptionId) throws JMSException
    {
       nextInterceptor.unsubscribe(dc, subscriptionId);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws JMSException
    {
       nextInterceptor.destroySubscription(dc, id);
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a clientId.
+    * @exception JMSException  if user was not allowed to login
+    */
    public String checkUser(String userName, String password) throws JMSException
    {
       return nextInterceptor.checkUser(userName, password);
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a sessionId
+    * @exception JMSException  if user was not allowed to login
+    */
    public String authenticate(String userName, String password) throws JMSException
    {
       return nextInterceptor.authenticate(userName, password);
    }
 
+   /**
+    * @param dc                       org.jboss.mq.ConnectionToken
+    * @param s                        org.jboss.mq.Subscription
+    * @exception JMSException  The exception description.
+    */
    public void subscribe(org.jboss.mq.ConnectionToken dc, org.jboss.mq.Subscription s) throws JMSException
    {
       nextInterceptor.subscribe(dc, s);
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param clientTime     Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void ping(ConnectionToken dc, long clientTime) throws JMSException
    {
       nextInterceptor.ping(dc, clientTime);
@@ -192,14 +319,4 @@
       return nextInterceptor.getSubscription(dc, subscriberId);
    }
 
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      JMSServerInterceptor next = nextInterceptor;
-      while (next != null && next instanceof Recoverable == false)
-         next = next.getNext();
-      if (next == null)
-         throw new IllegalStateException("No interceptor implements " + Recoverable.class.getName());
-      Recoverable recoverable = (Recoverable) next;
-      return recoverable.recover(dc, flags);
-   }
-}
+} // JMSServerInvokerSupport

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSTopic.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSTopic.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/JMSTopic.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,24 +1,9 @@
 /*
-* 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.
-*/
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server;
 
 import java.util.ArrayList;
@@ -37,7 +22,6 @@
 import org.jboss.mq.Subscription;
 import org.jboss.mq.pm.NewPersistenceManager;
 import org.jboss.mq.pm.PersistenceManager;
-import org.jboss.mq.pm.Tx;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
 
@@ -48,7 +32,6 @@
  * @author     Norbert Lataille (Norbert.Lataille at m4x.org)
  * @author     Hiram Chirino (Cojonudo14 at hotmail.com)
  * @author     David Maplesden (David.Maplesden at orion.co.nz)
- * @author     Adrian Brock (adrian at jboss.com)
  * @created    August 16, 2001
  * @version    $Revision$
  */
@@ -59,6 +42,7 @@
    ConcurrentReaderHashMap durQueues = new ConcurrentReaderHashMap();
    ConcurrentReaderHashMap tempQueues = new ConcurrentReaderHashMap();
 
+   // Constructor ---------------------------------------------------
    public JMSTopic(SpyDestination dest, ClientConsumer temporary, JMSDestinationManager server, BasicQueueParameters parameters) throws JMSException
    {
       super(dest, temporary, server, parameters);
@@ -175,14 +159,7 @@
 
    public void removeReceiver(Subscription sub)
    {
-      try
-      {
-         getQueue(sub).removeReceiver(sub);
-      }
-      catch (JMSException e)
-      {
-         cat.trace("Subscription is not registered: " + sub, e);
-      }
+      getQueue(sub).removeReceiver(sub);
    }
 
    public void restoreMessage(MessageReference messageRef)
@@ -208,7 +185,7 @@
       }
    }
 
-   public void restoreMessage(SpyMessage message, Tx txid, int type)
+   public void restoreMessage(SpyMessage message)
    {
       try
       {
@@ -221,7 +198,7 @@
          {
             BasicQueue queue = (BasicQueue) durQueues.get(message.header.durableSubscriberID);
             MessageReference messageRef = server.getMessageCache().add(message, queue, MessageReference.STORED);
-            queue.restoreMessage(messageRef, txid, type);
+            queue.restoreMessage(messageRef);
          }
       }
       catch (JMSException e)
@@ -503,20 +480,14 @@
       return (PersistentQueue) durQueues.get(id);
    }
 
-   public BasicQueue getQueue(Subscription sub) throws JMSException
+   public BasicQueue getQueue(Subscription sub)
    {
       SpyTopic topic = (SpyTopic) sub.destination;
       DurableSubscriptionID id = topic.getDurableSubscriptionID();
-      BasicQueue queue = null;
       if (id != null)
-         queue = getDurableSubscription(id);
+         return getDurableSubscription(id);
       else
-         queue = (BasicQueue) tempQueues.get(sub);
-      
-      if (queue != null)
-         return queue;
-      else
-         throw new JMSException("Subscription not found: " + sub);
+         return (BasicQueue) tempQueues.get(sub);
    }
 
    // Package protected ---------------------------------------------

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/TracingInterceptor.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/TracingInterceptor.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/TracingInterceptor.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,23 +1,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.
+* JBoss, the OpenSource EJB server
 *
-* 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.
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
 */
 package org.jboss.mq.server;
 
@@ -27,8 +12,8 @@
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
 import javax.jms.Topic;
-import javax.transaction.xa.Xid;
 
+import org.jboss.logging.Logger;
 import org.jboss.mq.AcknowledgementRequest;
 import org.jboss.mq.ConnectionToken;
 import org.jboss.mq.DurableSubscriptionID;
@@ -44,8 +29,15 @@
  * @author <a href="mailto:pra at tim.se">Peter Antman</a>
  * @version $Revision$
  */
+
 public class TracingInterceptor extends JMSServerInterceptorSupport
 {
+
+   static protected Logger log = Logger.getLogger(TracingInterceptor.class);
+
+   /**
+    * Get the thread group of the server.
+    */
    public ThreadGroup getThreadGroup()
    {
       if (!log.isTraceEnabled())
@@ -64,7 +56,12 @@
       }
    }
 
-
+   /**
+    * Gets a clientID from server.
+    *
+    * @return               The ID value
+    * @exception JMSException  Description of Exception
+    */
    public String getID() throws JMSException
    {
 
@@ -93,6 +90,13 @@
       }
    }
 
+   /**
+    * Gets the TemporaryTopic attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryTopic value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws JMSException
    {
 
@@ -123,6 +127,13 @@
 
    }
 
+   /**
+    * Gets the TemporaryQueue attribute of the ServerIL object
+    *
+    * @param dc             Description of Parameter
+    * @return               The TemporaryQueue value
+    * @exception JMSException  Description of Exception
+    */
    public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws JMSException
    {
 
@@ -153,6 +164,12 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void connectionClosing(ConnectionToken dc) throws JMSException
    {
 
@@ -185,6 +202,12 @@
 
    }
 
+   /**
+    * Check id, must not be taken.
+    *
+    * @param ID             a clientID
+    * @exception JMSException if ID is already taken
+    */
    public void checkID(String ID) throws JMSException
    {
 
@@ -218,6 +241,13 @@
 
    }
 
+   /**
+    * Add the message to the destination.
+    *
+    * @param dc             The feature to be added to the Message attribute
+    * @param message        The feature to be added to the Message attribute
+    * @exception JMSException  Description of Exception
+    */
    public void addMessage(ConnectionToken dc, SpyMessage message) throws JMSException
    {
 
@@ -251,6 +281,14 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Queue createQueue(ConnectionToken dc, String dest) throws JMSException
    {
 
@@ -282,6 +320,14 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public Topic createTopic(ConnectionToken dc, String dest) throws JMSException
    {
 
@@ -312,6 +358,13 @@
       }
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException
    {
 
@@ -344,6 +397,13 @@
       }
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param t              Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void transact(ConnectionToken dc, TransactionRequest t) throws JMSException
    {
 
@@ -377,6 +437,13 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param item           Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws JMSException
    {
 
@@ -410,6 +477,15 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param dest           Description of Parameter
+    * @param selector       Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage[] browse(ConnectionToken dc, Destination dest, String selector) throws JMSException
    {
 
@@ -442,6 +518,15 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param subscriberId   Description of Parameter
+    * @param wait           Description of Parameter
+    * @return               Description of the Returned Value
+    * @exception JMSException  Description of Exception
+    */
    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws JMSException
    {
 
@@ -474,6 +559,13 @@
 
    }
 
+   /**
+    * Sets the Enabled attribute of the ServerIL object
+    *
+    * @param dc             The new Enabled value
+    * @param enabled        The new Enabled value
+    * @exception JMSException  Description of Exception
+    */
    public void setEnabled(ConnectionToken dc, boolean enabled) throws JMSException
    {
 
@@ -507,6 +599,13 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc              Description of Parameter
+    * @param subscriptionId  Description of Parameter
+    * @exception JMSException   Description of Exception
+    */
    public void unsubscribe(ConnectionToken dc, int subscriptionId) throws JMSException
    {
 
@@ -540,6 +639,12 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param id             Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws JMSException
    {
 
@@ -573,6 +678,14 @@
 
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a clientId.
+    * @exception JMSException  if user was not allowed to login
+    */
    public String checkUser(String userName, String password) throws JMSException
    {
 
@@ -605,6 +718,14 @@
 
    }
 
+   /**
+    * Check user for autentication.
+    *
+    * @param userName       Description of Parameter
+    * @param password       Description of Parameter
+    * @return               a sessionId
+    * @exception JMSException  if user was not allowed to login
+    */
    public String authenticate(String userName, String password) throws JMSException
    {
 
@@ -635,6 +756,11 @@
 
    }
 
+   /**
+    * @param dc                       org.jboss.mq.ConnectionToken
+    * @param s                        org.jboss.mq.Subscription
+    * @exception JMSException  The exception description.
+    */
    public void subscribe(org.jboss.mq.ConnectionToken dc, org.jboss.mq.Subscription s) throws JMSException
    {
 
@@ -668,6 +794,13 @@
 
    }
 
+   /**
+    * #Description of the Method
+    *
+    * @param dc             Description of Parameter
+    * @param clientTime     Description of Parameter
+    * @exception JMSException  Description of Exception
+    */
    public void ping(ConnectionToken dc, long clientTime) throws JMSException
    {
 
@@ -762,31 +895,4 @@
       }
 
    }
-
-   public Xid[] recover(ConnectionToken dc, int flags) throws Exception
-   {
-      if (log.isTraceEnabled() == false)
-         return super.recover(dc, flags);
-
-      try
-      {
-         log.trace("CALLED : recover");
-         log.trace("ARG    : " + flags);
-         return super.recover(dc, flags);
-      }
-      catch (JMSException e)
-      {
-         log.trace("EXCEPTION : recover: ", e);
-         throw e;
-      }
-      catch (RuntimeException e)
-      {
-         log.trace("EXCEPTION : recover: ", e);
-         throw e;
-      }
-      finally
-      {
-         log.trace("RETURN : recover");
-      }
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManager.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManager.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManager.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,29 +1,13 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
 package org.jboss.mq.server.jmx;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -31,11 +15,9 @@
 import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.transaction.xa.Xid;
 
 import org.jboss.mq.MessageStatistics;
 import org.jboss.mq.pm.PersistenceManager;
-import org.jboss.mq.pm.TxManager;
 import org.jboss.mq.server.BasicQueueParameters;
 import org.jboss.mq.server.JMSDestinationManager;
 import org.jboss.mq.server.JMSServerInterceptor;
@@ -45,10 +27,6 @@
 import org.jboss.mq.sm.StateManager;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.util.threadpool.BasicThreadPool;
-import org.jboss.util.threadpool.ThreadPool;
 
 /**
  * JMX MBean implementation for JBossMQ.
@@ -63,12 +41,14 @@
 {
    public String jndiBindLocation = "java:/JBossMQServer";
 
+   // Attributes ----------------------------------------------------
+
    /** A proxy to the service controller. */
    private ServiceControllerMBean serviceController;
    /** The JMX ObjectName of this service MBean */
    private ObjectName mqService;
    /** The JMS server implementation */
-   protected JMSDestinationManager jmsServer;
+   private JMSDestinationManager jmsServer;
    /** The JMX ObjectName of the configured persistence manager */
    private ObjectName persistenceManager;
    /** The JMX ObjectName of the configured state manager */
@@ -76,11 +56,7 @@
    /** The JMX ObjectName of the message cache */
    private ObjectName messageCache;
    /** The temporary topic/queue parameters */
-   protected BasicQueueParameters tempParameters = new BasicQueueParameters();
-   /** Default thread pool */
-   private ObjectName threadPool;
-   /** Default expiry destination */
-   private ObjectName expiryDestination;
+   private BasicQueueParameters tempParameters = new BasicQueueParameters();
 
    /**
     * @jmx:managed-attribute
@@ -243,26 +219,6 @@
       tempParameters.recoveryRetries = retries;
    }
    
-   public ObjectName getThreadPool()
-   {
-      return this.threadPool;
-   }
-
-   public void setThreadPool(ObjectName threadPool)
-   {
-      this.threadPool = threadPool;
-   }
-   
-   public ObjectName getExpiryDestination() 
-   {
-      return expiryDestination;
-   }
-
-   public void setExpiryDestination(ObjectName expiryDestination)
-   {
-      this.expiryDestination = expiryDestination;
-   }
-
    /**
     * @jmx:managed-operation
     */
@@ -403,31 +359,13 @@
 
       // We were either told the message cache or we get it from the
       // persistence manager
-      MessageCache mc;
+      MessageCache mc = null;
       if (messageCache != null)
          mc = (MessageCache) server.getAttribute(messageCache, "Instance");
       else
          mc = pm.getMessageCacheInstance();
       jmsServer.setMessageCache(mc);
 
-      ThreadPool tp;
-      ThreadGroup tg;
-      if (threadPool == null)
-      {
-         tg = new ThreadGroup("JBossMQ Server Threads");
-         tp = new BasicThreadPool("JMSThread", tg);
-      }
-      else
-      {
-         tp = (ThreadPool) server.getAttribute(threadPool, "Instance");
-         if (tp instanceof BasicThreadPool)
-           tg = ((BasicThreadPool)tp).getThreadGroup();
-         else
-           tg = new ThreadGroup("JBossMQ Server Threads");
-      }
-      jmsServer.setThreadPool(tp);
-      jmsServer.setThreadGroup(tg);
-
       jmsServer.startServer();
 
       super.startService();
@@ -676,48 +614,4 @@
       jmsServer.resetMessageCounter();
    }
 
-   public Map retrievePreparedTransactions()
-   {
-      if (jmsServer == null)
-         return null;
-      Map map = jmsServer.getPersistenceManager().getTxManager().getPreparedTransactions();
-      HashMap result = new HashMap();
-      for (Iterator i = map.entrySet().iterator(); i.hasNext();)
-      {
-         Map.Entry entry = (Map.Entry) i.next();
-         Xid xid = (Xid) entry.getKey();
-         TxManager.PreparedInfo info = (TxManager.PreparedInfo) entry.getValue();
-         if (xid != null && info != null)
-            result.put(xid, Boolean.valueOf(info.isInDoubt()));
-      }
-      return result;
-   }
-
-   public String showPreparedTransactions()
-   {
-      if (jmsServer == null)
-         return null;
-      Map map = jmsServer.getPersistenceManager().getTxManager().getPreparedTransactions();
-      JBossStringBuilder buffer = new JBossStringBuilder();
-      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
-      buffer.append("<tr><th>Xid</th><th>In Doubt</th><th>Local TXIDs</th></tr>");
-      for (Iterator i = map.entrySet().iterator(); i.hasNext();)
-      {
-         Map.Entry entry = (Map.Entry) i.next();
-         Xid xid = (Xid) entry.getKey();
-         TxManager.PreparedInfo info = (TxManager.PreparedInfo) entry.getValue();
-         if (xid != null && info != null)
-         {
-            buffer.append("<tr><td>");
-            buffer.append(xid);
-            buffer.append("</td><td>");
-            buffer.append(info.isInDoubt());
-            buffer.append("</td><td>");
-            buffer.append(info.getTxids());
-            buffer.append("</td></tr>");
-         }
-      }
-      buffer.append("</table>");
-      return buffer.toString();
-   }
 }

Modified: branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManagerMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManagerMBean.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/messaging/src/main/org/jboss/mq/server/jmx/DestinationManagerMBean.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,30 +1,11 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.server.jmx;
 
-import java.util.Map;
-
-import javax.management.ObjectName;
-
 /**
  * MBean interface.
  */
@@ -111,26 +92,6 @@
     */
    public void setRecoveryRetries(int retries);
 
-   /**
-    * Returns ThreadPool.
-    */
-   public ObjectName getThreadPool();
-
-   /**
-    * Sets ThreadPool.
-    */
-   public void setThreadPool(ObjectName threadPool);
-
-   /**
-    * Returns the expiry destination.
-    */
-   public ObjectName getExpiryDestination();
-
-   /**
-    * Sets the expiry destination.
-    */
-   public void setExpiryDestination(ObjectName destination);
-
    void createQueue(java.lang.String name) throws java.lang.Exception;
 
    void createTopic(java.lang.String name) throws java.lang.Exception;
@@ -174,18 +135,5 @@
     * Reset message counter of all configured destinations
     */
    void resetMessageCounter();
-   
-   /**
-    * Retrieve the prepared transactions
-    * 
-    * @return Map<Xid, indoubt boolean>
-    */
-   Map retrievePreparedTransactions(); 
-   
-   /**
-    * Show the prepared transactions
-    * 
-    * @return Some html
-    */
-   String showPreparedTransactions(); 
+
 }

Modified: branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml	2006-08-28 02:08:12 UTC (rev 56316)
@@ -2476,9 +2476,6 @@
       </fileset>
     </jar>
 
-     <copy tofile="${build.lib}/jbossmq-recovery-service.xml"
-           file="${build.resources}/jbossmq/jbossmq-recovery-service.xml"/>
-
      <copy tofile="${build.lib}/overridden-uil2-service.xml"
            file="${build.resources}/jbossmq/overridden-uil2-service.xml"/>
 

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicReceiveUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicReceiveUnitTestCase.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicReceiveUnitTestCase.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,696 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jbossmq.test;
-
-import java.util.List;
-
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-/**
- * Tests for recovery
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class RecoveryDurableTopicReceiveUnitTestCase extends RecoveryTest
-{
-   static String RECOVERY_TOPIC = "topic/recoveryDurableTopic";
-
-   Topic recoveryTopic;
-   
-   public RecoveryDurableTopicReceiveUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * Receive a message and prepare the transaction.
-    * 
-    * Assert the xid appears in the recovery list
-    * Assert the message is received after the rollback
-    */
-   public void testReceivePrepareShowsInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-               }
-               finally
-               {
-                  client.rollback(xid);
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, but
-    * then roll it back
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message is received after the rollback
-    */
-   public void testReceivePrepareRollbackDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.rollback(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, but
-    * then forget it
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message is received after the forget
-    */
-   public void testReceivePrepareForgetDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.forget(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, then commit it.
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.commit(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then commit it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then roll it back on another connection
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message can be received after the rollback
-    */
-   public void testReceivePrepareRollbackDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then forget it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message can be received after the forget
-    */
-   public void testReceivePrepareForgetDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then commit it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            restartRecoveryService();
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then roll it back on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message can be received after the rollback
-    */
-   public void testReceivePrepareRollbackDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            restartRecoveryService();
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then forget it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message can be received after the forget
-    */
-   public void testReceivePrepareForgetDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            setup(recoveryTopic, 1);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               assertNotNull(client.receiveNoWait());
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            restartRecoveryService();
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   protected void deployRecoveryService() throws Exception
-   {
-      super.deployRecoveryService();
-      InitialContext ctx = getInitialContext();
-      recoveryTopic = (Topic) ctx.lookup(RECOVERY_TOPIC);
-   }
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicSendUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicSendUnitTestCase.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryDurableTopicSendUnitTestCase.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,685 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jbossmq.test;
-
-import java.util.List;
-
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-/**
- * Tests for recovery
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class RecoveryDurableTopicSendUnitTestCase extends RecoveryTest
-{
-   static String RECOVERY_TOPIC = "topic/recoveryDurableTopic";
-
-   Topic recoveryTopic;
-   
-   public RecoveryDurableTopicSendUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * Send a message and prepare the transaction.
-    * 
-    * Assert the xid appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareShowsInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-               }
-               finally
-               {
-                  client.rollback(xid);
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, but
-    * then roll it back
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareRollbackDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.rollback(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, but
-    * then forget it
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareForgetDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.forget(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, then commit it.
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message can be received
-    */
-   public void testSendPrepareCommitDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               Xid xid = new MyXid();
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               try
-               {
-                  assertEquals(XAResource.XA_OK, result);
-                  List xids = client.recover();
-                  assertEquals(1, xids.size());
-                  assertXidEquals(xid, (Xid) xids.get(0));
-                  client.commit(xid);
-                  xids = client.recover();
-                  assertEquals(0, xids.size());
-               }
-               finally
-               {
-                  try
-                  {
-                     client.rollback(xid);
-                  }
-                  catch (Exception ignored)
-                  {
-                  }
-               }
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then commit it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message can be received after the commit
-    */
-   public void testSendPrepareCommitDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then roll it back on another connection
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message cannot be received after the rollback
-    */
-   public void testSendPrepareRollbackDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then forget it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message cannot be received after the forget
-    */
-   public void testSendPrepareForgetDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then commit it on another connection with a restart.
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message can be received after the commit
-    */
-   public void testSendPrepareCommitDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            restartRecoveryService();
-
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(1, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then roll it back on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message cannot be received after the rollback
-    */
-   public void testSendPrepareRollbackDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            restartRecoveryService();
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then forget it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message cannot be received after the forget
-    */
-   public void testSendPrepareForgetDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         makeSubscription(recoveryTopic);
-         try
-         {
-            reset(recoveryTopic);
-            Xid xid = new MyXid();
-            JMSClient client = new JMSClient(recoveryTopic);
-            try
-            {
-               client.enlist(xid);
-               client.sendMessage("Hello");
-               client.delist(xid);
-               int result = client.prepare(xid);
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-
-            restartRecoveryService();
-            assertEquals(0, clearDestination(recoveryTopic));
-            
-            client = new JMSClient(recoveryTopic);
-            try
-            {
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               client.close();
-            }
-            assertEquals(0, clearDestination(recoveryTopic));
-         }
-         finally
-         {
-            removeSubscription(recoveryTopic);
-         }
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   protected void deployRecoveryService() throws Exception
-   {
-      super.deployRecoveryService();
-      InitialContext ctx = getInitialContext();
-      recoveryTopic = (Topic) ctx.lookup(RECOVERY_TOPIC);
-   }
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueReceiveUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueReceiveUnitTestCase.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueReceiveUnitTestCase.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,616 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jbossmq.test;
-
-import java.util.List;
-
-import javax.jms.Queue;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-/**
- * Tests for recovery
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class RecoveryQueueReceiveUnitTestCase extends RecoveryTest
-{
-   static String RECOVERY_QUEUE = "queue/recoveryQueue";
-
-   Queue recoveryQueue;
-   
-   public RecoveryQueueReceiveUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * Receive a message and prepare the transaction.
-    * 
-    * Assert the xid appears in the recovery list
-    * Assert the message is received after the rollback
-    */
-   public void testReceivePrepareShowsInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.rollback(xid);
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, but
-    * then roll it back
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message is received after the rollback
-    */
-   public void testReceivePrepareRollbackDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, but
-    * then forget it
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message is received after the forget
-    */
-   public void testReceivePrepareForgetDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction, then commit it.
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then commit it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.commit(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then roll it back on another connection
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message can be received after the rollback
-    */
-   public void testReceivePrepareRollbackDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.rollback(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then forget it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message can be received after the forget
-    */
-   public void testReceivePrepareForgetDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.forget(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then commit it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message cannot be received after the commit
-    */
-   public void testReceivePrepareCommitDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         restartRecoveryService();
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.commit(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then roll it back on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message can be received after the rollback
-    */
-   public void testReceivePrepareRollbackDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         restartRecoveryService();
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.rollback(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Receive a message and prepare the transaction on one connection
-    * then forget it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message can be received after the forget
-    */
-   public void testReceivePrepareForgetDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         setup(recoveryQueue, 1);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            assertNotNull(client.receiveNoWait());
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         restartRecoveryService();
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.forget(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   protected void deployRecoveryService() throws Exception
-   {
-      super.deployRecoveryService();
-      InitialContext ctx = getInitialContext();
-      recoveryQueue = (Queue) ctx.lookup(RECOVERY_QUEUE);
-   }
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueSendUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueSendUnitTestCase.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryQueueSendUnitTestCase.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,605 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jbossmq.test;
-
-import java.util.List;
-
-import javax.jms.Queue;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-/**
- * Tests for recovery
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class RecoveryQueueSendUnitTestCase extends RecoveryTest
-{
-   static String RECOVERY_QUEUE = "queue/recoveryQueue";
-
-   Queue recoveryQueue;
-   
-   public RecoveryQueueSendUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * Send a message and prepare the transaction.
-    * 
-    * Assert the xid appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareShowsInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-            }
-            finally
-            {
-               client.rollback(xid);
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, but
-    * then roll it back
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareRollbackDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.rollback(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, but
-    * then forget it
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message cannot be received
-    */
-   public void testSendPrepareForgetDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.forget(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction, then commit it.
-    * 
-    * Assert the xid doesn't appears in the recovery list
-    * Assert the message can be received
-    */
-   public void testSendPrepareCommitDoesntShowInRecovery() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            Xid xid = new MyXid();
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            try
-            {
-               assertEquals(XAResource.XA_OK, result);
-               List xids = client.recover();
-               assertEquals(1, xids.size());
-               assertXidEquals(xid, (Xid) xids.get(0));
-               client.commit(xid);
-               xids = client.recover();
-               assertEquals(0, xids.size());
-            }
-            finally
-            {
-               try
-               {
-                  client.rollback(xid);
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then commit it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message can be received after the commit
-    */
-   public void testSendPrepareCommitDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.commit(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then roll it back on another connection
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message cannot be received after the rollback
-    */
-   public void testSendPrepareRollbackDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.rollback(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then forget it on another connection
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message cannot be received after the forget
-    */
-   public void testSendPrepareForgetDifferentConnection() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.forget(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then commit it on another connection with a restart.
-    * 
-    * Assert the xid appears in the recovery list before the commit
-    * Assert the message cannot be received before the commit
-    * Assert the xid doesn't appear in the recovery list after the commit
-    * Assert the message can be received after the commit
-    */
-   public void testSendPrepareCommitDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         restartRecoveryService();
-
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.commit(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(1, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then roll it back on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the rollback
-    * Assert the message cannot be received before the rollback
-    * Assert the xid doesn't appear in the recovery list after the rollback
-    * Assert the message cannot be received after the rollback
-    */
-   public void testSendPrepareRollbackDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         restartRecoveryService();
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.rollback(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   /**
-    * Send a message and prepare the transaction on one connection
-    * then forget it on another connection with a restart
-    * 
-    * Assert the xid appears in the recovery list before the forget
-    * Assert the message cannot be received before the forget
-    * Assert the xid doesn't appear in the recovery list after the forget
-    * Assert the message cannot be received after the forget
-    */
-   public void testSendPrepareForgetDifferentConnectionRestart() throws Exception
-   {
-      deployRecoveryService();
-      try
-      {
-         reset(recoveryQueue);
-         Xid xid = new MyXid();
-         JMSClient client = new JMSClient(recoveryQueue);
-         try
-         {
-            client.enlist(xid);
-            client.sendMessage("Hello");
-            client.delist(xid);
-            int result = client.prepare(xid);
-            assertEquals(XAResource.XA_OK, result);
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-
-         restartRecoveryService();
-         assertEquals(0, clearDestination(recoveryQueue));
-         
-         client = new JMSClient(recoveryQueue);
-         try
-         {
-            List xids = client.recover();
-            assertEquals(1, xids.size());
-            assertXidEquals(xid, (Xid) xids.get(0));
-            client.forget(xid);
-            xids = client.recover();
-            assertEquals(0, xids.size());
-         }
-         finally
-         {
-            client.close();
-         }
-         assertEquals(0, clearDestination(recoveryQueue));
-      }
-      finally
-      {
-         undeployRecoveryService();
-      }
-   }
-   
-   protected void deployRecoveryService() throws Exception
-   {
-      super.deployRecoveryService();
-      InitialContext ctx = getInitialContext();
-      recoveryQueue = (Queue) ctx.lookup(RECOVERY_QUEUE);
-   }
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryTest.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryTest.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/jbossmq/test/RecoveryTest.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,366 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jbossmq.test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import org.jboss.test.JBossTestCase;
-
-/**
- * Tests for recovery
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public abstract class RecoveryTest extends JBossTestCase
-{
-   static String RECOVERY_CONFIG = "jbossmq-recovery-service.xml";
-
-   static String SUBSCRIPTION = "testSubscription";
-   
-   static String FACTORY = "RecoveryXAConnectionFactory";
-   
-   XAConnectionFactory connectionFactory;
-   
-   public RecoveryTest(String name) throws Exception
-   {
-      super(name);
-   }
-   
-   class JMSClient implements ExceptionListener
-   {
-      Destination destination;
-      
-      XAConnection connection;
-      
-      XASession xaSession;
-
-      MessageProducer producer;
-      
-      MessageConsumer consumer;
-      
-      public JMSClient(Destination destination) throws Exception
-      {
-         this.destination = destination;
-         connection = connectionFactory.createXAConnection();
-         connection.setClientID("JMSClient");
-         connection.setExceptionListener(this);
-      }
-      
-      public void onException(JMSException e)
-      {
-         log.warn("onException", e);
-         close();
-      }
-      
-      public void sendMessage(String text) throws Exception
-      {
-         Message message = getSession().createTextMessage(text);
-         getProducer().send(message);
-      }
-      
-      public void sendMessage(int i) throws Exception
-      {
-         Message message = getSession().createObjectMessage(new Integer(i));
-         getProducer().send(message);
-      }
-      
-      public MessageProducer getProducer() throws Exception
-      {
-         if (producer == null)
-            producer = getSession().createProducer(destination);
-         return producer;
-      }
-
-      public Message receiveNoWait() throws Exception
-      {
-         return getConsumer().receiveNoWait();
-      }
-      
-      public MessageConsumer getConsumer() throws Exception
-      {
-         if (consumer == null)
-         {
-            connection.start();
-            if (destination instanceof Topic)
-               consumer = getSession().createDurableSubscriber((Topic) destination, SUBSCRIPTION);
-            else
-               consumer = getSession().createConsumer(destination);
-         }
-         return consumer;
-      }
-      
-      public void removeSubscription() throws Exception
-      {
-         getSession().unsubscribe(SUBSCRIPTION);
-      }
-      
-      public void enlist(Xid xid) throws Exception
-      {
-         getXAResource().start(xid, XAResource.TMNOFLAGS);
-      }
-      
-      public void delist(Xid xid) throws Exception
-      {
-         getXAResource().end(xid, XAResource.TMSUCCESS);
-      }
-      
-      public int prepare(Xid xid) throws Exception
-      {
-         return getXAResource().prepare(xid);
-      }
-      
-      public void commit(Xid xid) throws Exception
-      {
-         getXAResource().commit(xid, false);
-      }
-      
-      public void rollback(Xid xid) throws Exception
-      {
-         getXAResource().rollback(xid);
-      }
-      
-      public void forget(Xid xid) throws Exception
-      {
-         getXAResource().forget(xid);
-      }
-      
-      public List recover() throws Exception
-      {
-         return Arrays.asList(getXAResource().recover(XAResource.TMSTARTRSCAN));
-      }
-      
-      public XAResource getXAResource() throws Exception
-      {
-         return getXASession().getXAResource();
-      }
-      
-      public Session getSession() throws Exception
-      {
-         return getXASession().getSession();
-      }
-      
-      public XASession getXASession() throws Exception
-      {
-         if (xaSession == null)
-            xaSession = connection.createXASession();
-         return xaSession;
-      }
-      
-      public void close()
-      {
-         try
-         {
-            if (connection != null)
-               connection.close();
-         }
-         catch (Throwable ignored)
-         {
-         }
-         connection = null;
-      }
-   }
-
-   public static class MyXid implements Xid
-   {
-      static byte next = 0;
-
-      byte[] xid;
-
-      public MyXid()
-      {
-         xid = new byte[] { ++next };
-      }
- 
-      public int getFormatId()
-      {
-         return 314;
-      }
-
-      public byte[] getGlobalTransactionId()
-      {
-         return xid;
-      }
-
-      public byte[] getBranchQualifier()
-      {
-         return null;
-      }
-   }
-
-   protected void assertXidEquals(Xid xid1, Xid xid2)
-   {
-      if (xid1 == null)
-         fail("Null xid1");
-      if (xid2 == null)
-         fail("Null xid2");
-      
-      assertEquals("Different format id " + xid1.getFormatId() + " " + xid2.getFormatId(), xid1.getFormatId(), xid2.getFormatId());
-      assertTrue("Different global id " + xid1.getGlobalTransactionId() + " " + xid2.getGlobalTransactionId(), Arrays.equals(xid1.getGlobalTransactionId(), xid2.getGlobalTransactionId()));
-      if (xid1.getBranchQualifier() == null)
-      {
-         if (xid1.getBranchQualifier() == null)
-            return;
-         else
-            fail("Different branch null " + xid2.getBranchQualifier());
-      }
-      assertTrue("Different branch " + xid1.getBranchQualifier() + " " + xid2.getBranchQualifier(), Arrays.equals(xid1.getBranchQualifier(), xid2.getBranchQualifier()));
-   }
-   
-   protected void reset(Destination destination)
-   {
-      try
-      {
-         JMSClient client = new JMSClient(destination);
-         try
-         {
-            List xids = client.recover();
-            log.debug("Recovering: " + xids);
-            for (int i = 0; i < xids.size(); ++i)
-               client.rollback((Xid) xids.get(i));
-         }
-         finally
-         {
-            client.close();
-         }
-      }
-      catch (Exception e)
-      {
-         log.warn("Error resetting", e);
-      }
-      clearDestination(destination);
-   }
-   
-   protected int clearDestination(Destination destination)
-   {
-      int count = 0;
-      try
-      {
-         JMSClient client = new JMSClient(destination);
-         try
-         {
-            Message message = client.receiveNoWait();
-            while (message != null)
-            {
-               ++count;
-               message = client.receiveNoWait();
-            }
-         }
-         finally
-         {
-            client.close();
-         }
-      }
-      catch (Exception e)
-      {
-         log.warn("Error clearing " + destination, e);
-      }
-      return count;
-   }
-   
-   protected void setup(Destination destination, int count) throws Exception
-   {
-      JMSClient client = new JMSClient(destination);
-      try
-      {
-         for (int i = 0; i < count; ++i)
-            client.sendMessage(i);
-      }
-      finally
-      {
-         client.close();
-      }
-   }
-
-   protected void makeSubscription(Topic topic) throws Exception
-   {
-      JMSClient client = new JMSClient(topic);
-      try
-      {
-         client.getConsumer();
-      }
-      finally
-      {
-         client.close();
-      }
-   }
-   
-   protected void removeSubscription(Topic topic) throws Exception
-   {
-      JMSClient client = new JMSClient(topic);
-      try
-      {
-         client.removeSubscription();
-      }
-      finally
-      {
-         client.close();
-      }
-   }
-
-   protected void deployRecoveryService() throws Exception
-   {
-      deploy(RECOVERY_CONFIG);
-      try
-      {
-         InitialContext ctx = getInitialContext();
-         connectionFactory = (XAConnectionFactory) ctx.lookup(FACTORY);
-      }
-      catch (Throwable t)
-      {
-         try
-         {
-            undeploy(RECOVERY_CONFIG);
-         }
-         catch (Throwable ignored)
-         {
-         }
-      }
-   }
-   
-   protected void undeployRecoveryService() throws Exception
-   {
-      undeploy(RECOVERY_CONFIG);
-   }
-   
-   protected void restartRecoveryService() throws Exception
-   {
-      undeployRecoveryService();
-      deployRecoveryService();
-   }
-}

Deleted: branches/JBoss_4_0_3_SP1_CP/testsuite/src/resources/jbossmq/jbossmq-recovery-service.xml
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/resources/jbossmq/jbossmq-recovery-service.xml	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/resources/jbossmq/jbossmq-recovery-service.xml	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<server>
-
-  <mbean code="org.jboss.mq.server.jmx.Topic"
-	 name="jboss.mq.destination.recovery:service=Topic,name=recoveryTopic">
-    <depends optional-attribute-name="DestinationManager">jboss.mq.recovery:service=DestinationManager</depends>
-    <depends optional-attribute-name="SecurityManager">jboss.mq.recovery:service=SecurityManager</depends>
-    <attribute name="SecurityConf">
-      <security>
-        <role name="guest" read="true" write="true"/>
-      </security>
-    </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.mq.server.jmx.Topic"
-	 name="jboss.mq.destination.recovery:service=Topic,name=recoveryDurableTopic">
-    <depends optional-attribute-name="DestinationManager">jboss.mq.recovery:service=DestinationManager</depends>
-    <depends optional-attribute-name="SecurityManager">jboss.mq.recovery:service=SecurityManager</depends>
-    <attribute name="SecurityConf">
-       <security>
-         <role name="guest" read="true" write="true" create="true"/>
-      </security>
-    </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.mq.server.jmx.Queue"
-	 name="jboss.mq.destination.recovery:service=Queue,name=recoveryQueue">
-    <depends optional-attribute-name="DestinationManager">jboss.mq.recovery:service=DestinationManager</depends>
-    <depends optional-attribute-name="SecurityManager">jboss.mq.recovery:service=SecurityManager</depends>
-    <attribute name="MessageCounterHistoryDayLimit">-1</attribute>
-    <attribute name="SecurityConf">
-      <security>
-        <role name="guest" read="true" write="true"/>
-      </security>
-    </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.mq.il.uil2.UILServerILService"
-	 name="jboss.mq.recovery:service=InvocationLayer,type=UIL2">
-
-    <!-- The server chain -->
-    <depends optional-attribute-name="Invoker">jboss.mq.recovery:service=Invoker</depends>
-    <!-- JNDI binding -->
-    <attribute name="ConnectionFactoryJNDIRef">RecoveryConnectionFactory</attribute>
-    <!-- JNDI binding for XA -->
-    <attribute name="XAConnectionFactoryJNDIRef">RecoveryXAConnectionFactory</attribute>
-    <!-- The bind address -->
-    <attribute name="BindAddress">${jboss.bind.address}</attribute>
-    <!-- The bind port -->
-    <attribute name="ServerBindPort">8089</attribute>
-    <!-- The ping period in millis -->
-    <attribute name="PingPeriod">60000</attribute>
-    <!-- Whether tcp/ip does not wait for buffer fills -->
-    <attribute name="EnableTcpNoDelay">true</attribute>
-    <!-- Used to disconnect the client on the serverside if there is no activity -->
-    <!-- Ensure this is greater than the ping period -->
-    <attribute name="ReadTimeout">120000</attribute>
-    <!-- Used to disconnect the client on the clientside if there is no activity -->
-    <!-- Ensure this is greater than the ping period -->
-    <attribute name="ClientReadTimeout">120000</attribute>
-    <!-- The size of the buffer (in bytes) wrapping the socket -->
-    <!-- The buffer is flushed after each request -->
-    <attribute name="BufferSize">2048</attribute>
-    <!-- Large messages may block the ping/pong -->
-    <!-- A pong is simulated after each chunk (in bytes) for both reading and writing -->
-    <!-- It must be larger than the buffer size -->
-    <attribute name="ChunkSize">1000000</attribute>
-  </mbean>
-
-  <mbean code="org.jboss.mq.server.jmx.Invoker" name="jboss.mq.recovery:service=Invoker">
-    <depends optional-attribute-name="NextInterceptor">jboss.mq.recovery:service=TracingInterceptor</depends>
-    <depends>jboss:service=Naming</depends>
-  </mbean>
-
-  <mbean code="org.jboss.mq.server.jmx.InterceptorLoader" name="jboss.mq.recovery:service=TracingInterceptor">
-    <attribute name="InterceptorClass">org.jboss.mq.server.TracingInterceptor</attribute>
-    <depends optional-attribute-name="NextInterceptor">jboss.mq.recovery:service=SecurityManager</depends>
-  </mbean>
-
-  <mbean code="org.jboss.mq.security.SecurityManager" name="jboss.mq.recovery:service=SecurityManager">
-    <attribute name="DefaultSecurityConfig">
-      <security>
-        <role name="guest" read="true" write="true" create="true"/>
-      </security>
-    </attribute>
-    <attribute name="SecurityDomain">java:/jaas/jbossmq</attribute>
-    <depends optional-attribute-name="NextInterceptor">jboss.mq.recovery:service=DestinationManager</depends>
-  </mbean>
-
-  <!--
-     | The destination manager is the core service within JBossMQ
-  -->
-  <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq.recovery:service=DestinationManager">
-    <depends optional-attribute-name="MessageCache">jboss.mq.recovery:service=MessageCache</depends>
-    <depends optional-attribute-name="PersistenceManager">jboss.mq.recovery:service=PersistenceManager</depends>
-    <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends>
-    <depends>jboss:service=Naming</depends>
-  </mbean>
-
-  <!--
-     | The MessageCache decides where to put JBossMQ message that
-     | are sitting around waiting to be consumed by a client.
-     |
-     | The memory marks are in Megabytes.  Once the JVM memory usage hits
-     | the high memory mark, the old messages in the cache will start getting
-     | stored in the DataDirectory.  As memory usage gets closer to the
-     | Max memory mark, the amount of message kept in the memory cache aproaches 0.
-   -->
-  <mbean code="org.jboss.mq.server.MessageCache"
-	 name="jboss.mq.recovery:service=MessageCache">
-    <attribute name="HighMemoryMark">50</attribute>
-    <attribute name="MaxMemoryMark">60</attribute>
-    <attribute name="CacheStore">jboss.mq.recovery:service=PersistenceManager</attribute>
-  </mbean>
-
-  <!-- 
-     | The jdbc2 PersistenceManager is the new improved JDBC implementation.
-     | This implementation allows you to control how messages are stored in 
-     | the database.
-     |
-     | Use this PM if you want the reliablity a relational database can offer
-     | you.  The default configuration is known to work with hsqldb, other
-     | databases will requrie teaking of the SqlProperties e.g. changing table
-     | colum definitions to database supported types.
-     |
-     | Take care that the selected blob column type in RECOVERY_RECOVERY_JMS_MESSAGES can store
-     | all message data. Some databases (e.g. mySQL) offer blob types with
-     | different maximum capacity (e.g. mySQL-type BLOB=64K, LONGBLOB=2G).
-     |
-     | If you encouter problems with the configured BLOB_TYPE try a different
-     | setting. Valid settings are OBJECT_BLOB, BINARYSTREAM_BLOB and BYTES_BLOB.
-   -->
-  <mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager"
-	 name="jboss.mq.recovery:service=PersistenceManager">
-    <depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-    <attribute name="XARecovery">true</attribute>
-    <attribute name="SqlProperties">
-      BLOB_TYPE=OBJECT_BLOB
-      INSERT_TX = INSERT INTO RECOVERY_JMS_TRANSACTIONS (TXID) VALUES(?)
-      INSERT_TX_XARECOVERY = INSERT INTO RECOVERY_JMS_TRANSACTIONS (TXID, XID) VALUES(?, ?)
-      INSERT_MESSAGE = INSERT INTO RECOVERY_JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
-      SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM RECOVERY_JMS_TRANSACTIONS
-      SELECT_MAX_TX = SELECT MAX(TXID) TXID FROM (SELECT MAX(TXID) AS TXID FROM RECOVERY_JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM RECOVERY_JMS_MESSAGES)
-      DELETE_ALL_TX = DELETE FROM RECOVERY_JMS_TRANSACTIONS
-      DELETE_ALL_TX_XARECOVERY = DELETE FROM RECOVERY_JMS_TRANSACTIONS WHERE XID = NULL
-      SELECT_ALL_TX_XARECOVERY = SELECT TXID, XID FROM RECOVERY_JMS_TRANSACTIONS
-      SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM RECOVERY_JMS_MESSAGES WHERE DESTINATION=?
-      SELECT_MESSAGES_IN_DEST_XARECOVERY = SELECT MESSAGEID, MESSAGEBLOB, TXID, TXOP FROM RECOVERY_JMS_MESSAGES WHERE DESTINATION=?
-      SELECT_MESSAGE_KEYS_IN_DEST = SELECT MESSAGEID FROM RECOVERY_JMS_MESSAGES WHERE DESTINATION=?
-      SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM RECOVERY_JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
-      SELECT_MESSAGE_XARECOVERY = SELECT MESSAGEID, MESSAGEBLOB, TXID, TXOP FROM RECOVERY_JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
-      MARK_MESSAGE = UPDATE RECOVERY_JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=?
-      UPDATE_MESSAGE = UPDATE RECOVERY_JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?
-      UPDATE_MARKED_MESSAGES = UPDATE RECOVERY_JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
-      UPDATE_MARKED_MESSAGES_XARECOVERY = UPDATE RECOVERY_JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID NOT IN (SELECT TXID FROM RECOVERY_JMS_TRANSACTIONS WHERE XID IS NOT NULL)
-      UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE RECOVERY_JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
-      DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM RECOVERY_JMS_MESSAGES WHERE TXOP=? AND RECOVERY_JMS_MESSAGES.TXID IN (SELECT TXID FROM RECOVERY_JMS_TRANSACTIONS)
-      DELETE_MARKED_MESSAGES_WITH_TX_XARECOVERY = DELETE FROM RECOVERY_JMS_MESSAGES WHERE TXOP=? AND RECOVERY_JMS_MESSAGES.TXID IN (SELECT TXID FROM RECOVERY_JMS_TRANSACTIONS WHERE XID = NULL)
-      DELETE_TX = DELETE FROM RECOVERY_JMS_TRANSACTIONS WHERE TXID = ?
-      DELETE_MARKED_MESSAGES = DELETE FROM RECOVERY_JMS_MESSAGES WHERE TXID=? AND TXOP=?
-      DELETE_TEMPORARY_MESSAGES = DELETE FROM RECOVERY_JMS_MESSAGES WHERE TXOP='T'
-      DELETE_MESSAGE = DELETE FROM RECOVERY_JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
-      CREATE_MESSAGE_TABLE = CREATE CACHED TABLE RECOVERY_JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, \
-         DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), \
-         MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
-      CREATE_IDX_MESSAGE_TXOP_TXID = CREATE INDEX RECOVERY_JMS_MESSAGES_TXOP_TXID ON RECOVERY_JMS_MESSAGES (TXOP, TXID)
-      CREATE_IDX_MESSAGE_DESTINATION = CREATE INDEX RECOVERY_JMS_MESSAGES_DESTINATION ON RECOVERY_JMS_MESSAGES (DESTINATION)
-      CREATE_TX_TABLE = CREATE CACHED TABLE RECOVERY_JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
-      CREATE_TX_TABLE_XARECOVERY = CREATE CACHED TABLE RECOVERY_JMS_TRANSACTIONS ( TXID INTEGER, XID OBJECT, PRIMARY KEY (TXID) )
-      CREATE_TABLES_ON_STARTUP = TRUE
-    </attribute>
-    <!-- Uncomment to override the transaction timeout for recovery per queue/subscription, in seconds -->
-    <!--attribute name="RecoveryTimeout">0</attribute-->
-    <!-- The number of blobs to load at once during message recovery -->
-    <attribute name="RecoverMessagesChunk">0</attribute>
-  </mbean>
- 
-</server>

Modified: branches/JBoss_4_0_3_SP1_CP/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java	2006-08-27 18:41:22 UTC (rev 56315)
+++ branches/JBoss_4_0_3_SP1_CP/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java	2006-08-28 02:08:12 UTC (rev 56316)
@@ -1,49 +1,50 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
 package org.jboss.mq.il.http.servlet;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+
+import javax.naming.InitialContext;
+
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
+
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.transaction.xa.Xid;
 
+import javax.management.MBeanServer;
+import javax.management.AttributeNotFoundException;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ReflectionException;
+
 import org.jboss.logging.Logger;
+
 import org.jboss.mq.ConnectionToken;
-import org.jboss.mq.SpyMessage;
-import org.jboss.mq.il.http.HTTPClientILStorageQueue;
 import org.jboss.mq.il.http.HTTPILRequest;
 import org.jboss.mq.il.http.HTTPILResponse;
-import org.jboss.mq.server.JMSServerInvoker;
+import org.jboss.mq.il.http.HTTPClientIL;
+import org.jboss.mq.il.http.HTTPClientILStorageQueue;
+
 import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mq.server.JMSServerInvoker;
+import org.jboss.mq.SpyMessage;
 
 /**
  * This Servlet acts as a proxy to the JMS Server for the HTTP IL clients.
@@ -229,15 +230,6 @@
                 this.invoker.unsubscribe(connectionToken, subscriberId);
                 outputStream.writeObject(new HTTPILResponse());
             }
-            else if (methodName.equals("recover"))
-            {
-                if (log.isTraceEnabled())
-                    log.trace("recover(HTTPILRequest " + httpIlRequest.toString() + ")");
-                ConnectionToken connectionToken = (ConnectionToken)httpIlRequest.getArguments()[0];
-                int flags = ((Integer)httpIlRequest.getArguments()[1]).intValue();
-                Xid[] xids = this.invoker.recover(connectionToken, flags);
-                outputStream.writeObject(new HTTPILResponse(xids));
-            }
             else
             {
                 if (log.isTraceEnabled())




More information about the jboss-cvs-commits mailing list