[jboss-cvs] JBossAS SVN: r71458 - branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 31 05:12:09 EDT 2008


Author: vicky.kak at jboss.com
Date: 2008-03-31 05:12:09 -0400 (Mon, 31 Mar 2008)
New Revision: 71458

Modified:
   branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java
Log:
[JBPAPP-662]Add a mechanism to check whether the thread associated transaction is no longer in a runnable state

Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java	2008-03-31 06:47:04 UTC (rev 71457)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java	2008-03-31 09:12:09 UTC (rev 71458)
@@ -268,6 +268,21 @@
       return -1;
    }
 
+   @Override
+   public void checkTransactionActive() throws RollbackException, SystemException
+   {
+      if (tm == null)
+         throw new IllegalStateException("No transaction manager: " + ccmName);
+      Transaction tx = tm.getTransaction();
+      if (tx != null)
+      {
+         int status = tx.getStatus();
+         // Only allow states that will actually succeed
+         if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING)
+            throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status));
+      }
+   }
+   
    protected void startService() throws Exception
    {
       if (transactionManagerService != null)




More information about the jboss-cvs-commits mailing list