[jboss-cvs] JBoss Messaging SVN: r8370 - in branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026: docs/userguide/en/modules and 15 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 23 17:33:49 EDT 2011


Author: jbertram
Date: 2011-06-23 17:33:48 -0400 (Thu, 23 Jun 2011)
New Revision: 8370

Modified:
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/docs/userguide/en/modules/configuration.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/aop-messaging-client.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/db2-persistence-service.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/sybase-persistence-service.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/xmdesc/ConnectionFactory-xmbean.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/aop-messaging-client.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/db2-persistence-service.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/sybase-persistence-service.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/xmdesc/ConnectionFactory-xmbean.xml
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ClientConsumer.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ConsumerAspect.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/SessionAspect.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/StateCreationAspect.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConnectionState.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConsumerState.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/SessionState.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/delegate/SessionDelegate.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ClientTransaction.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ResourceManager.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
   branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
Log:
SOA-3026


Property changes on: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/Branch_1_4:7883-7884,7887-7892,7900,7906,7912-7914,7916,7930-7934,7936-7937,7941-7944,7962-7964,7966,7968-7971,7978-7979,7996,7999,8013,8060,8083,8114,8133-8134,8138,8141-8142,8154-8155,8157-8158,8160,8233-8234,8236,8256
/branches/JBM1842:8169-8232
   + /branches/Branch_1_4:7883-7884,7887-7892,7900,7906,7912-7914,7916,7930-7934,7936-7937,7941-7944,7962-7964,7966,7968-7971,7978-7979,7996,7999,8013,8060,8083,8114,8133-8134,8138,8141-8142,8154-8155,8157-8158,8160,8233-8234,8236,8256,8312-8313,8318,8323,8356,8360-8361
/branches/JBM1842:8169-8232

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/docs/userguide/en/modules/configuration.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/docs/userguide/en/modules/configuration.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/docs/userguide/en/modules/configuration.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -2465,6 +2465,14 @@
         <para>This attribute takes effect only if the EnableOrderingGroup attribute is true.</para>
       </section>
 
+      <section id="conf.connectionfactory.attributes.minTimeoutProcessTime">
+        <title>MinTimeoutProcessTime</title>
+
+        <para>Minimum processing time allowed for (milliseconds) in a timeout receive. This is the minimum time for the internal processing after a message is arrived at the client
+        but before returning the message to the application. Default is 300. </para>
+
+      </section>
+
     <!-- End conf.connectionfactory.attributes -->
   </section>
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/aop-messaging-client.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/aop-messaging-client.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/aop-messaging-client.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -136,6 +136,9 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver(..))">
       <advice name="handlePostDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
+   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->processMessageTimeout(..))">
+      <advice name="handleProcessMessageTimeout" aspect="org.jboss.jms.client.container.SessionAspect"/>
+   </bind>
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->acknowledgeAll(..))">
       <advice name="handleAcknowledgeAll" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
@@ -283,4 +286,4 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientBrowserDelegate->hasNextMessage())">
       <advice name="handleHasNextMessage" aspect="org.jboss.jms.client.container.BrowserAspect"/>
    </bind>         
-</aop>
\ No newline at end of file
+</aop>

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/db2-persistence-service.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/db2-persistence-service.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/db2-persistence-service.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -80,7 +80,7 @@
    SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
    SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
    UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
-   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER HOLDLOCK WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? WITH RS USE AND KEEP EXCLUSIVE LOCKS
    INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
    SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
    UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/sybase-persistence-service.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/sybase-persistence-service.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/server/default/deploy/sybase-persistence-service.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -136,11 +136,11 @@
 INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
 DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
 LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
-CREATE_CLUSTER_STATE_TABLE=CREATE TABLE JBM_CLUSTER (NODE_ID SMALLINT, PING_TIMESTAMP DATETIME, STATE SMALLINT, PRIMARY KEY(NODE_ID))
+CREATE_CLUSTER_STATE_TABLE=CREATE TABLE JBM_CLUSTER (NODE_ID SMALLINT NOT NULL, PING_TIMESTAMP DATETIME, STATE SMALLINT, PRIMARY KEY(NODE_ID))
 UPDATE_STATE=UPDATE JBM_CLUSTER SET STATE=? WHERE NODE_ID=?
-UPDATE_TIMESTAMP=UPDATE JBM_CLUSTER SET PING_TIMESTAMP=CURRENT_TIMESTAMP WHERE NODE_ID=?
-LOAD_CLUSTER_STATE=SELECT NODE_ID, PING_TIMESTAMP, STATE, CURRENT_TIMESTAMP FROM JBM_CLUSTER
-INSERT_NODE_STATE=INSERT INTO JBM_CLUSTER (NODE_ID, PING_TIMESTAMP, STATE) VALUES (?, CURRENT_TIMESTAMP, ?)
+UPDATE_TIMESTAMP=UPDATE JBM_CLUSTER SET PING_TIMESTAMP=GETDATE() WHERE NODE_ID=?
+LOAD_CLUSTER_STATE=SELECT NODE_ID, PING_TIMESTAMP, STATE, GETDATE() FROM JBM_CLUSTER
+INSERT_NODE_STATE=INSERT INTO JBM_CLUSTER (NODE_ID, PING_TIMESTAMP, STATE) VALUES (?, GETDATE(), ?)
 DELETE_DEAD_NODE=DELETE FROM JBM_CLUSTER WHERE NODE_ID=?
       ]]></attribute>
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/xmdesc/ConnectionFactory-xmbean.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/xmdesc/ConnectionFactory-xmbean.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP4/etc/xmdesc/ConnectionFactory-xmbean.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -147,6 +147,12 @@
       <name>DefaultOrderingGroupName</name>
       <type>java.lang.String</type>
    </attribute>
+   
+   <attribute access="read-write" getMethod="getMinTimeoutProcessTime" setMethod="setMinTimeoutProcessTime">
+      <description>Minimum processing time allowed for (milliseconds) in a timeout receive. Default is 300.</description>
+      <name>MinTimeoutProcessTime</name>
+      <type>long</type>
+   </attribute>
 
    <!-- Managed operations -->
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/aop-messaging-client.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/aop-messaging-client.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/aop-messaging-client.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -136,6 +136,9 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver(..))">
       <advice name="handlePostDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
+   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->processMessageTimeout(..))">
+      <advice name="handleProcessMessageTimeout" aspect="org.jboss.jms.client.container.SessionAspect"/>
+   </bind>
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->acknowledgeAll(..))">
       <advice name="handleAcknowledgeAll" aspect="org.jboss.jms.client.container.SessionAspect"/>
    </bind>
@@ -283,4 +286,4 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientBrowserDelegate->hasNextMessage())">
       <advice name="handleHasNextMessage" aspect="org.jboss.jms.client.container.BrowserAspect"/>
    </bind>         
-</aop>
\ No newline at end of file
+</aop>

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/db2-persistence-service.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/db2-persistence-service.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/db2-persistence-service.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -80,7 +80,7 @@
    SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
    SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
    UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
-   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER HOLDLOCK WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? WITH RS USE AND KEEP EXCLUSIVE LOCKS
    INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
    SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
    UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/sybase-persistence-service.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/sybase-persistence-service.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/server/default/deploy/sybase-persistence-service.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -95,7 +95,7 @@
    INSERT_TRANSACTION_EXTRA=INSERT INTO JBM_TX_EX (TRANSACTION_ID, START_TIME) VALUES(?, ?)
    DELETE_TRANSACTION_EXTRA=DELETE FROM JBM_TX_EX WHERE TRANSACTION_ID=?
    UPDATE_MESSAGE_STATE=UPDATE JBM_MSG_REF SET STATE = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
-   CLAIM_MESSAGE_IN_SUCK=UPDATE JBM_MSG_REF SET STATE='C' WHERE CHANNEL_ID = ? MESSAGE_ID = ? AND AND STATE='S'
+   CLAIM_MESSAGE_IN_SUCK=UPDATE JBM_MSG_REF SET STATE='C' WHERE CHANNEL_ID = ? AND MESSAGE_ID = ? AND STATE='S'
    LOAD_REFS_IN_SUCK=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'S' AND CHANNEL_ID = ? ORDER BY ORD
    LOAD_SINGLE_REFERENCE=SELECT STATE, CHANNEL_ID FROM JBM_MSG_REF WHERE MESSAGE_ID=?
       ]]></attribute>
@@ -136,11 +136,11 @@
 INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
 DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
 LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
-CREATE_CLUSTER_STATE_TABLE=CREATE TABLE JBM_CLUSTER (NODE_ID SMALLINT, PING_TIMESTAMP DATETIME, STATE SMALLINT, PRIMARY KEY(NODE_ID))
+CREATE_CLUSTER_STATE_TABLE=CREATE TABLE JBM_CLUSTER (NODE_ID SMALLINT NOT NULL, PING_TIMESTAMP DATETIME, STATE SMALLINT, PRIMARY KEY(NODE_ID))
 UPDATE_STATE=UPDATE JBM_CLUSTER SET STATE=? WHERE NODE_ID=?
-UPDATE_TIMESTAMP=UPDATE JBM_CLUSTER SET PING_TIMESTAMP=CURRENT_TIMESTAMP WHERE NODE_ID=?
-LOAD_CLUSTER_STATE=SELECT NODE_ID, PING_TIMESTAMP, STATE, CURRENT_TIMESTAMP FROM JBM_CLUSTER
-INSERT_NODE_STATE=INSERT INTO JBM_CLUSTER (NODE_ID, PING_TIMESTAMP, STATE) VALUES (?, CURRENT_TIMESTAMP, ?)
+UPDATE_TIMESTAMP=UPDATE JBM_CLUSTER SET PING_TIMESTAMP=GETDATE() WHERE NODE_ID=?
+LOAD_CLUSTER_STATE=SELECT NODE_ID, PING_TIMESTAMP, STATE, GETDATE() FROM JBM_CLUSTER
+INSERT_NODE_STATE=INSERT INTO JBM_CLUSTER (NODE_ID, PING_TIMESTAMP, STATE) VALUES (?, GETDATE(), ?)
 DELETE_DEAD_NODE=DELETE FROM JBM_CLUSTER WHERE NODE_ID=?
       ]]></attribute>
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/xmdesc/ConnectionFactory-xmbean.xml
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/xmdesc/ConnectionFactory-xmbean.xml	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/integration/EAP5/etc/xmdesc/ConnectionFactory-xmbean.xml	2011-06-23 21:33:48 UTC (rev 8370)
@@ -147,6 +147,12 @@
       <name>DefaultOrderingGroupName</name>
       <type>java.lang.String</type>
    </attribute>
+   
+   <attribute access="read-write" getMethod="getMinTimeoutProcessTime" setMethod="setMinTimeoutProcessTime">
+      <description>Minimum processing time allowed for (milliseconds) in a timeout receive. Default is 300.</description>
+      <name>MinTimeoutProcessTime</name>
+      <type>long</type>
+   </attribute>
 
    <!-- Managed operations -->
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ClientConsumer.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ClientConsumer.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ClientConsumer.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -297,6 +297,9 @@
    private volatile Thread onMessageThread;
    private ExecutorService pool = Executors.newCachedThreadPool();
 
+   //JBMESSAGING-1876
+   private long minTimeoutProcessTime;
+
    public int getBufferSize()
    {
       return buffer.size();
@@ -309,7 +312,10 @@
                          String queueName,
                          int bufferSize, Executor sessionExecutor,
                          int maxDeliveries, boolean shouldAck,
-                         long redeliveryDelay)
+                         long redeliveryDelay,
+                         boolean isClustered,
+                         CallbackManager cbManager,
+                         long minTimeoutProcessTime)
    {
       if (bufferSize < 1)
       {
@@ -329,6 +335,7 @@
       this.maxDeliveries = maxDeliveries;
       this.shouldAck = shouldAck;
       this.redeliveryDelay = redeliveryDelay;
+      this.minTimeoutProcessTime = minTimeoutProcessTime;
    }
         
    // Public ---------------------------------------------------------------------------------------
@@ -556,7 +563,7 @@
                {
                   final DeliveryInfo info = new DeliveryInfo(m, consumerID, queueName, null, shouldAck);
                   
-                  if (timeout <= 0)
+                  if (timeout <= 0 || sessionDelegate.getTransacted())
                   {
                      sessionDelegate.preDeliver(info);
 
@@ -590,15 +597,17 @@
 
                      long tmUsed = System.currentTimeMillis() - startTimestamp;
                      
-                     if (tmUsed >= timeout)
+                     long timeDelta = timeout - tmUsed;
+                     long timeLeft = timeDelta <= minTimeoutProcessTime ? minTimeoutProcessTime : timeDelta ; 
+                     
+                     if (trace)
                      {
-                        log.warn("Timed out before post message processing, discarding message " + m);
-                        throw new JMSException("Timed out before post message processing, discarding message " + m);
+                        log.trace("Time left: " + timeLeft + " timeout " + timeout + " tmUsed " + tmUsed);
                      }
-
+                     
                      try
                      {
-                        ignore = f.get(timeout - tmUsed, TimeUnit.MILLISECONDS);
+                        ignore = f.get(timeLeft, TimeUnit.MILLISECONDS);
                      }
                      catch (InterruptedException e)
                      {
@@ -615,8 +624,9 @@
                      }
                      catch (TimeoutException e)
                      {
-                        log.warn("Timed out waiting for post message processing, discarding message " + m);
-                        throw new JMSException("Timed out waiting for post message processing, discarding message " + m);
+                        log.warn("Timed out waiting for post message processing " + m + " within time " + timeLeft);
+                        ignore = false;
+                        sessionDelegate.processMessageTimeout();
                      }
                   }
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/ConsumerAspect.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -113,7 +113,8 @@
          new ClientConsumer(isCC, sessionState.getAcknowledgeMode(),
                             sessionDelegate, consumerDelegate, consumerID, queueName,
                             prefetchSize, executor, maxDeliveries, consumerState.isShouldAck(),
-                            redeliveryDelay);
+                            redeliveryDelay, 
+                            fcc != null, cm, consumerState.getMinTimeoutProcessTime());
       
       sessionState.addCallbackHandler(messageHandler);
       

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/SessionAspect.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/SessionAspect.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -398,6 +398,59 @@
       }
    }
    
+   //JBMESSAGING-1876
+   public Object handleProcessMessageTimeout(Invocation invocation) throws Throwable
+   { 
+      MethodInvocation mi = (MethodInvocation)invocation;
+      SessionState state = getState(invocation);
+      
+      boolean result = true;
+      
+      synchronized (state)
+      {
+      
+         int ackMode = state.getAcknowledgeMode();
+                  
+         if (ackMode == Session.CLIENT_ACKNOWLEDGE)
+         {
+            if (trace)
+            {
+               log.trace("Don't do anything about CLIENT_ACK mode");
+            }
+         }
+         else if (ackMode == Session.AUTO_ACKNOWLEDGE)
+         {
+            if (trace)
+            {
+               log.trace("Don't do anything about AUTO_ACK mode");
+            }
+         }
+         else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+         {
+            if (trace)
+            {
+               log.trace("Don't do anything about DUPS_OK_ACK mode");
+            }
+         }
+         else
+         {             
+            Object txID = state.getCurrentTxId();
+      
+            if (txID != null)
+            {
+
+               if (trace) { log.trace("Marking tx " + txID + " to be rollback only"); }
+               
+               ConnectionState connState = (ConnectionState)state.getParent();
+               
+               connState.getResourceManager().markTxRollbackOnly(txID);
+            }        
+         }
+      }
+      
+      return null;
+   }
+   
    /**
     * Used for client acknowledge.
     */

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -99,7 +99,8 @@
          ConnectionState connectionState =
             new ConnectionState(serverID, connectionDelegate,
                                 remotingConnection, versionToUse, 
-                                connectionDelegate.isEnableOrderingGroup(), connectionDelegate.getDefaultOrderingGroupName());
+                                connectionDelegate.isEnableOrderingGroup(), connectionDelegate.getDefaultOrderingGroupName(),
+                                connectionDelegate.getMinTimeoutProcessTime());
 
          remotingConnection.getConnectionListener().setConnectionState(connectionState);
          remotingConnection.getConnectionListener().start();

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -86,6 +86,8 @@
    private boolean enableOrderingGroup;
    
    private String defaultOrderingGroupName;
+   
+   private long minTimeoutProcessTime;
 
    // Static ---------------------------------------------------------------------------------------
 
@@ -373,6 +375,16 @@
       return defaultOrderingGroupName;
    }
 
+   public long getMinTimeoutProcessTime()
+   {
+      return minTimeoutProcessTime;
+   }
+
+   public void setMinTimeoutProcessTime(long minTimeoutProcessTime)
+   {
+      this.minTimeoutProcessTime = minTimeoutProcessTime;
+   }
+   
    // Package Private ------------------------------------------------------------------------------
 
    // Private --------------------------------------------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -84,6 +84,8 @@
    
    private String defaultOrderingGroupName;
    
+   private long minTimeoutProcessTime;
+   
    // Static ---------------------------------------------------------------------------------------
    
    /*
@@ -114,7 +116,8 @@
 
    public ClientConnectionFactoryDelegate(String uniqueName, String objectID, int serverID, String serverLocatorURI,
                                           Version serverVersion, boolean clientPing, boolean strictTck,
-                                          boolean sendAcksAsync, boolean enableOrderingGroup, String defaultOrderingGroupName)
+                                          boolean sendAcksAsync, boolean enableOrderingGroup, String defaultOrderingGroupName,
+                                          long minTimeoutProcessTime)
    {
       super(objectID);
 
@@ -127,6 +130,7 @@
       this.sendAcksAsync = sendAcksAsync;
       this.setEnableOrderingGroup(enableOrderingGroup);
       this.setDefaultOrderingGroupName(defaultOrderingGroupName);
+      this.minTimeoutProcessTime = minTimeoutProcessTime;
    }
    
    public ClientConnectionFactoryDelegate()
@@ -209,6 +213,8 @@
          connectionDelegate.setEnableOrderingGroup(this.enableOrderingGroup);
          
          connectionDelegate.setDefaultOrderingGroup(this.defaultOrderingGroupName);
+         
+         connectionDelegate.setMinTimeoutProcessTime(this.minTimeoutProcessTime);
       }
       else
       {
@@ -360,6 +366,8 @@
       strictTck = in.readBoolean();
       
       sendAcksAsync = in.readBoolean();
+      
+      minTimeoutProcessTime = in.readLong();
    }
 
    public void write(DataOutputStream out) throws Exception
@@ -377,6 +385,8 @@
       out.writeBoolean(strictTck);
       
       out.writeBoolean(sendAcksAsync);
+      
+      out.writeLong(this.minTimeoutProcessTime);
    }
 
    /**

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -549,6 +549,11 @@
       return "SessionDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
    }
 
+   public void processMessageTimeout() throws JMSException
+   {
+      throw new IllegalStateException("This invocation should not be handled here!");
+   }
+
    // Protected ------------------------------------------------------------------------------------
 
    // Package Private ------------------------------------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConnectionState.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConnectionState.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -91,12 +91,15 @@
    private boolean enableOrderingGroup;
    
    private String defaultOrderingGroupName;
+   
+   private long minTimeoutProcessTime;
 
    // Constructors ---------------------------------------------------------------------------------
 
    public ConnectionState(int serverID, ConnectionDelegate delegate,
                           JMSRemotingConnection remotingConnection,
-                          Version versionToUse, boolean enableOrderingGroup, String defaultOrderingGroupName)
+                          Version versionToUse, boolean enableOrderingGroup, String defaultOrderingGroupName,
+                          long minTimeoutProcessTime)
       throws Exception
    {
       super(null, (DelegateSupport)delegate);
@@ -118,6 +121,8 @@
       this.setEnableOrderingGroup(enableOrderingGroup);
       
       this.setDefaultOrderingGroupName(defaultOrderingGroupName);
+      
+      this.minTimeoutProcessTime = minTimeoutProcessTime;
    }
 
    // HierarchicalState implementation -------------------------------------------------------------
@@ -325,6 +330,11 @@
       return defaultOrderingGroupName;
    }
 
+   public long getMinTimeoutProcessTime()
+   {
+      return minTimeoutProcessTime;
+   }
+
    // Package protected ----------------------------------------------------------------------------
 
    // Protected ------------------------------------------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConsumerState.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/ConsumerState.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -66,6 +66,8 @@
    private SessionState parent;
    private ConsumerDelegate delegate;
    
+   private long minTimeoutProcessTime;
+   
    // Constructors ---------------------------------------------------------------------------------
 
    public ConsumerState(SessionState parent, ConsumerDelegate delegate, JBossDestination dest,
@@ -83,6 +85,7 @@
       this.subscriptionName=subscriptionName;
       this.maxDeliveries = maxDeliveries;
       this.redeliveryDelay = redeliveryDelay;
+      this.minTimeoutProcessTime = parent.getMinTimeoutProcessTime();
     
       //We don't store deliveries if this a non durable subscriber
       
@@ -221,6 +224,11 @@
    	return redeliveryDelay;
    }
 
+   public long getMinTimeoutProcessTime()
+   {
+      return this.minTimeoutProcessTime;
+   }
+
    // Package protected ----------------------------------------------------------------------------
 
    // Protected ------------------------------------------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/SessionState.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/client/state/SessionState.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -575,5 +575,10 @@
       }
    }
 
+   public long getMinTimeoutProcessTime()
+   {
+      return parent.getMinTimeoutProcessTime();
+   }
+
 }
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/delegate/SessionDelegate.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/delegate/SessionDelegate.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/delegate/SessionDelegate.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -95,4 +95,6 @@
    ProducerDelegate createProducerDelegate(JBossDestination destination) throws JMSException;
 
    void acknowledgeAll() throws JMSException;
+
+   void processMessageTimeout() throws JMSException;
 }

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -53,7 +53,8 @@
                                  boolean strictTck,
                                  boolean sendAcksAsync,
                                  boolean enableOrderingGroup,
-                                 String defaultOrderingGroupName) throws Exception;
+                                 String defaultOrderingGroupName,
+                                 long minTimeoutProcessTime) throws Exception;
 
    void unregisterConnectionFactory(String uniqueName, boolean supportsFailover, boolean supportsLoadBalancing) throws Exception;
 }

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -88,6 +88,8 @@
    private boolean enableOrderingGroup;
    
    private String defaultOrderingGroupName;
+   
+   private long minTimeoutProcessTime = 300;
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -208,7 +210,8 @@
                                       locatorURI, enablePing, prefetchSize, slowConsumers,
                                       defaultTempQueueFullSize, defaultTempQueuePageSize,                                      
                                       defaultTempQueueDownCacheSize, dupsOKBatchSize, supportsFailover, supportsLoadBalancing,
-                                      loadBalancingFactory, strictTck, sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName);               
+                                      loadBalancingFactory, strictTck, sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName,
+                                      minTimeoutProcessTime);               
          
          String info = "Connector " + locator.getProtocol() + "://" +
             locator.getHost() + ":" + locator.getPort();
@@ -488,6 +491,16 @@
    {
       return defaultOrderingGroupName;
    }
+   public long getMinTimeoutProcessTime()
+   {
+      return minTimeoutProcessTime;
+   }
+   
+   public void setMinTimeoutProcessTime(long minTimeoutProcessTime)
+   {
+      this.minTimeoutProcessTime = minTimeoutProcessTime;
+   }
+   
    // JMX managed operations -----------------------------------------------------------------------
 
    // Public ---------------------------------------------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -132,6 +132,7 @@
                                                       boolean sendAcksAsync,
                                                       boolean enableOrderingGroup,
                                                       String defaultOrderingGroupName)
+                                                      long minTimeoutProcessTime)
       throws Exception
    {
       log.debug(this + " registering connection factory '" + uniqueName + "', bindings: " + jndiBindings);
@@ -186,7 +187,8 @@
       ClientConnectionFactoryDelegate localDelegate =
          new ClientConnectionFactoryDelegate(uniqueName, id, serverPeer.getServerPeerID(),
                                              locatorURI, version, clientPing, useStrict,
-                                             sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName);
+                                             sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName,
+                                             minTimeoutProcessTime);
 
       log.debug(this + " created local delegate " + localDelegate);
 

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ClientTransaction.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ClientTransaction.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ClientTransaction.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -65,6 +65,8 @@
    private boolean clientSide;
    
    private boolean recovered;
+   
+   private boolean rollbackOnly = false;
 
    // Static --------------------------------------------------------
 
@@ -502,4 +504,14 @@
 
    }
 
+   public void markRollbackOnly()
+   {
+      this.rollbackOnly = true;
+   }
+
+   public boolean isRollbackOnly()
+   {
+      return this.rollbackOnly;
+   }
+
 }

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ResourceManager.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/src/main/org/jboss/jms/tx/ResourceManager.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -197,6 +197,13 @@
       {
          throw new IllegalStateException("Cannot find transaction " + xid);
       }
+      
+      //if tx is mark rollback, roll back immediately
+      if (tx.isRollbackOnly())
+      {
+         this.rollbackLocal(xid, tx);
+         throw new MessagingTransactionRolledBackException("Rolled back " + tx + " as it is marked rollback only!");
+      }
                   
       TransactionRequest request =
          new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, tx);
@@ -239,6 +246,16 @@
          throw new IllegalStateException("Cannot find transaction with xid:" + xid);         
       }
       
+      this.rollbackLocal(xid, ts);
+   }
+   
+   private void rollbackLocal(Object xid, ClientTransaction ts) throws JMSException
+   {
+      if (ts == null)
+      {      
+         throw new IllegalStateException("Cannot find transaction with xid:" + xid);         
+      }
+      
       // don't need messages for rollback
       // We don't clear the acks since we need to redeliver locally
       ts.clearMessages();
@@ -329,7 +346,13 @@
       if (state == null)
       { 
          throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
-      } 
+      }
+
+      if (state.isRollbackOnly())
+      {
+         this.rollback(xid, state, connection);
+         throw new MessagingXAException(XAException.XA_RBROLLBACK, "Transaction marked rollback only, xid: " + xid);
+      }
       
       TransactionRequest request =
          new TransactionRequest(TransactionRequest.TWO_PHASE_PREPARE_REQUEST, xid, state);
@@ -350,6 +373,13 @@
       ClientTransaction tx = removeTxInternal(xid);
       
       if (trace) { log.trace("got tx: " + tx + " state " + tx.getState()); }
+      
+      //roll back for onePhase only. for 2pc, rollback only is processed in prepare
+      if ((tx != null) && tx.isRollbackOnly() && onePhase)
+      {
+         this.rollback(xid, tx, connection);
+         throw new MessagingXAException(XAException.XA_RBROLLBACK, "Transaction marked rollback only, xid: " + xid);
+      }
           
       if (onePhase)
       {
@@ -407,6 +437,16 @@
          throw new java.lang.IllegalStateException("Cannot find xid to remove " + xid);
       }
       
+      this.rollback(xid, tx, connection);
+   }
+   
+   private void rollback(Xid xid, ClientTransaction tx, ConnectionDelegate connection) throws XAException
+   {
+      if (tx == null)
+      {
+         throw new java.lang.IllegalStateException("Cannot find xid to remove " + xid);
+      }
+      
       //It's possible we don't actually have the prepared tx here locally - this
       //may happen if we have recovered from failure and the transaction manager
       //is calling rollback on the transaction as part of the recovery process.
@@ -414,12 +454,9 @@
       TransactionRequest request = null;
       
       //don't need the messages
-      if (tx != null)
-      {
-         tx.clearMessages();
-      }
+      tx.clearMessages();
              
-      if ((tx == null) || tx.getState() == ClientTransaction.TX_PREPARED)
+      if (tx.getState() == ClientTransaction.TX_PREPARED)
       {
          //2PC rollback
          
@@ -432,13 +469,9 @@
       else
       {
          //For one phase rollback there is nothing to do on the server 
-         
-         if (tx == null)
-         {     
-            throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
-         }
+         if (trace) { log.trace("It is a one phase roll back, tx: " + tx); }
       }
-                  
+
       //we redeliver the messages
       //locally to their original consumers if they are still open or cancel them to the server
       //if the original consumers have closed
@@ -447,20 +480,14 @@
       
       try
       {
-         if (tx != null)
-         {
-            redeliverMessages(tx);
-            
-            tx.setState(ClientTransaction.TX_ROLLEDBACK);  
-         }
-         
+         redeliverMessages(tx);
+         tx.setState(ClientTransaction.TX_ROLLEDBACK);  
       }
       catch (JMSException e)
       {
          log.error("Failed to redeliver", e);
       }                               
-   }
-  
+   }  
    
    Xid joinTx(Xid xid) throws XAException
    {
@@ -717,6 +744,21 @@
          }
       }
    }
+
+   /**
+    * @param txID
+    */
+   public void markTxRollbackOnly(Object txID) throws JMSException
+   {
+      ClientTransaction tx = getTxInternal(txID);
+      
+      if (tx == null)
+      {
+         throw new JMSException("There is no transaction with id " + txID);
+      }
+      
+      tx.markRollbackOnly();
+   }
    
    // Inner Classes --------------------------------------------------------------------------------
   

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -856,6 +856,109 @@
       }
    }
 
+   //https://issues.jboss.org/browse/JBMESSAGING-1876
+   public void testMinTimeoutProcessTimeConfigSettings() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+         String mbeanConfig = "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" + "       name=\"jboss.messaging.connectionfactory:service=TestTimeoutProcessConfigSettingsFactory\"\n"
+                              + "       xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n"
+                              + "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n"
+                              + "       <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n"
+                              + "       <attribute name=\"JNDIBindings\">\n"
+                              + "          <bindings>\n"
+                              + "            <binding>/TestTimeoutProcessConfigSettingsFactory</binding>\n"
+                              + "          </bindings>\n"
+                              + "       </attribute>\n"
+                              + "       <attribute name=\"MinTimeoutProcessTime\">2345</attribute>\n"
+                              + " </mbean>";
+
+         ObjectName on = ServerManagement.deploy(mbeanConfig);
+         ServerManagement.invoke(on, "create", new Object[0], new String[0]);
+         ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/TestTimeoutProcessConfigSettingsFactory");
+         c = cf.createConnection();
+         
+         ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)c).getDelegate();
+         
+         ConnectionState state1 = (ConnectionState)del1.getState();
+         
+         long minTime = state1.getMinTimeoutProcessTime();
+         
+         assertEquals(2345, minTime);
+      }
+      finally
+      {
+         try
+         {
+            if (c != null)
+            {
+               log.info("Closing connection");
+               c.close();
+               log.info("Closed connection");
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+      }
+   }
+
+   //https://issues.jboss.org/browse/JBMESSAGING-1876
+   public void testMinTimeoutProcessTimeDefaults() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+         String mbeanConfig = "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" + "       name=\"jboss.messaging.connectionfactory:service=TestTimeoutProcessConfigDefaultSettingsFactory\"\n"
+                              + "       xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n"
+                              + "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n"
+                              + "       <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n"
+                              + "       <attribute name=\"JNDIBindings\">\n"
+                              + "          <bindings>\n"
+                              + "            <binding>/TestTimeoutProcessConfigDefaultSettingsFactory</binding>\n"
+                              + "          </bindings>\n"
+                              + "       </attribute>\n"
+                              + " </mbean>";
+
+         ObjectName on = ServerManagement.deploy(mbeanConfig);
+         ServerManagement.invoke(on, "create", new Object[0], new String[0]);
+         ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/TestTimeoutProcessConfigDefaultSettingsFactory");
+         c = cf.createConnection();
+         
+         ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)c).getDelegate();
+         
+         ConnectionState state1 = (ConnectionState)del1.getState();
+         
+         long minTime = state1.getMinTimeoutProcessTime();
+         
+         assertEquals(300, minTime);
+      }
+      finally
+      {
+         try
+         {
+            if (c != null)
+            {
+               log.info("Closing connection");
+               c.close();
+               log.info("Closed connection");
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+      }
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java	2011-06-22 04:42:21 UTC (rev 8369)
+++ branches/Branch_JBossMessaging_1_4_6_GA_SOA-3026/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java	2011-06-23 21:33:48 UTC (rev 8370)
@@ -217,6 +217,169 @@
       
    }
 
+   //JBMESSAGING-1876
+   public void testMinTimeoutProcessTimeSettings() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+         String mbeanConfig = "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" + "       name=\"jboss.messaging.connectionfactory:service=TestChangeRateConfigSettingsFactory\"\n"
+                              + "       xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n"
+                              + "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n"
+                              + "       <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n"
+                              + "       <attribute name=\"JNDIBindings\">\n"
+                              + "          <bindings>\n"
+                              + "            <binding>/ClusteredTestMinTimeoutProcessTimeConfigSettingsFactory</binding>\n"
+                              + "          </bindings>\n"
+                              + "       </attribute>\n"
+                              + "       <attribute name=\"SupportsFailover\">true</attribute>"
+                              + "       <attribute name=\"SupportsLoadBalancing\">true</attribute>"
+                              + "       <attribute name=\"MinTimeoutProcessTime\">100</attribute>\n"
+                              + " </mbean>";
+
+         ObjectName on = ServerManagement.deploy(mbeanConfig);
+         ServerManagement.invoke(on, "create", new Object[0], new String[0]);
+         ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+         ConnectionFactory cf = (ConnectionFactory)ic[0].lookup("/ClusteredTestMinTimeoutProcessTimeConfigSettingsFactory");
+         c = cf.createConnection();
+         
+         ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)c).getDelegate();
+         
+         ConnectionState state1 = (ConnectionState)del1.getState();
+         
+         long minTime = state1.getMinTimeoutProcessTime();
+         
+         assertEquals(100, minTime);
+      }
+      finally
+      {
+         try
+         {
+            if (c != null)
+            {
+               log.info("Closing connection");
+               c.close();
+               log.info("Closed connection");
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+      }
+   }
+
+   //https://issues.jboss.org/browse/JBMESSAGING-1876
+   public void testMinTimeoutProcessTimeSettings2() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+         String mbeanConfig = "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" + "       name=\"jboss.messaging.connectionfactory:service=TestChangeRateConfigSettingsFactory\"\n"
+                              + "       xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n"
+                              + "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n"
+                              + "       <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n"
+                              + "       <attribute name=\"JNDIBindings\">\n"
+                              + "          <bindings>\n"
+                              + "            <binding>/ClusteredTestMinTimeoutProcessTimeConfigSettingsFactory</binding>\n"
+                              + "          </bindings>\n"
+                              + "       </attribute>\n"
+                              + "       <attribute name=\"SupportsFailover\">false</attribute>"
+                              + "       <attribute name=\"SupportsLoadBalancing\">true</attribute>"
+                              + "       <attribute name=\"MinTimeoutProcessTime\">100</attribute>\n"
+                              + "       <attribute name=\"MaxRetryChangeRate\">10</attribute>\n"
+                              + "       <attribute name=\"RetryChangeRateInterval\">2345</attribute>\n"
+                              + " </mbean>";
+
+         ObjectName on = ServerManagement.deploy(mbeanConfig);
+         ServerManagement.invoke(on, "create", new Object[0], new String[0]);
+         ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+         ConnectionFactory cf = (ConnectionFactory)ic[0].lookup("/ClusteredTestMinTimeoutProcessTimeConfigSettingsFactory");
+         c = cf.createConnection();
+         
+         ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)c).getDelegate();
+         
+         ConnectionState state1 = (ConnectionState)del1.getState();
+         
+         long minTime = state1.getMinTimeoutProcessTime();
+         
+         assertEquals(100, minTime);
+      }
+      finally
+      {
+         try
+         {
+            if (c != null)
+            {
+               log.info("Closing connection");
+               c.close();
+               log.info("Closed connection");
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+      }
+   }
+
+   //https://issues.jboss.org/browse/JBMESSAGING-1876
+   public void testMinTimeoutProcessTimeDefaults() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+         String mbeanConfig = "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" + "       name=\"jboss.messaging.connectionfactory:service=TestChangeRateConfigDefaultsFactory\"\n"
+                              + "       xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n"
+                              + "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n"
+                              + "       <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n"
+                              + "       <attribute name=\"JNDIBindings\">\n"
+                              + "          <bindings>\n"
+                              + "            <binding>/ClusteredTestChangeRateConfigDefaultsFactory</binding>\n"
+                              + "          </bindings>\n"
+                              + "       </attribute>\n"
+                              + "       <attribute name=\"SupportsFailover\">true</attribute>"
+                              + "       <attribute name=\"SupportsLoadBalancing\">true</attribute>"
+                              + " </mbean>";
+
+         ObjectName on = ServerManagement.deploy(mbeanConfig);
+         ServerManagement.invoke(on, "create", new Object[0], new String[0]);
+         ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+         ConnectionFactory cf = (ConnectionFactory)ic[0].lookup("/ClusteredTestChangeRateConfigDefaultsFactory");
+         c = cf.createConnection();
+         
+         ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)c).getDelegate();
+         
+         ConnectionState state1 = (ConnectionState)del1.getState();
+         
+         long minTime = state1.getMinTimeoutProcessTime();
+         
+         assertEquals(300, minTime);
+      }
+      finally
+      {
+         try
+         {
+            if (c != null)
+            {
+               log.info("Closing connection");
+               c.close();
+               log.info("Closed connection");
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+      }
+   }
+
    // Package protected ----------------------------------------------------------------------------
 
    // Protected ------------------------------------------------------------------------------------



More information about the jboss-cvs-commits mailing list