[jbosscache-commits] JBoss Cache SVN: r7580 - core/branches/flat/src/main/java/org/horizon/transaction.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Jan 23 06:22:21 EST 2009
Author: manik.surtani at jboss.com
Date: 2009-01-23 06:22:21 -0500 (Fri, 23 Jan 2009)
New Revision: 7580
Modified:
core/branches/flat/src/main/java/org/horizon/transaction/DummyBaseTransactionManager.java
Log:
JBCACHE-1469: DummyBaseTransactionManager behaves incorrectly with Status.STATUS_MARKED_ROLLBACK
Modified: core/branches/flat/src/main/java/org/horizon/transaction/DummyBaseTransactionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/transaction/DummyBaseTransactionManager.java 2009-01-23 11:18:14 UTC (rev 7579)
+++ core/branches/flat/src/main/java/org/horizon/transaction/DummyBaseTransactionManager.java 2009-01-23 11:22:21 UTC (rev 7580)
@@ -33,15 +33,14 @@
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
+import java.io.Serializable;
/**
* @author bela
- * <p/>
- * Date: May 15, 2003 Time: 4:11:37 PM
* @since 1.0
*/
-public class DummyBaseTransactionManager implements TransactionManager, java.io.Serializable {
- static ThreadLocal<Transaction> thread_local = new ThreadLocal<Transaction>();
+public class DummyBaseTransactionManager implements TransactionManager, Serializable {
+ static ThreadLocal<DummyTransaction> thread_local = new ThreadLocal<DummyTransaction>();
private static final long serialVersionUID = -6716097342564237376l;
private static final Log log = LogFactory.getLog(DummyBaseTransactionManager.class);
private static final boolean trace = log.isTraceEnabled();
@@ -84,13 +83,17 @@
HeuristicRollbackException, SecurityException,
IllegalStateException, SystemException {
int status;
- Transaction tx = getTransaction();
+ DummyTransaction tx = getTransaction();
if (tx == null)
throw new IllegalStateException("thread not associated with transaction");
status = tx.getStatus();
- if (status == Status.STATUS_MARKED_ROLLBACK)
- throw new RollbackException();
- tx.commit();
+ if (status == Status.STATUS_MARKED_ROLLBACK) {
+ tx.setStatus(Status.STATUS_ROLLEDBACK);
+ rollback();
+ throw new RollbackException("Transaction status is Status.STATUS_MARKED_ROLLBACK");
+ } else {
+ tx.commit();
+ }
// Disassociate tx from thread.
setTransaction(null);
@@ -155,7 +158,7 @@
* @throws javax.transaction.SystemException
* If the transaction service fails in an unexpected way.
*/
- public Transaction getTransaction() throws SystemException {
+ public DummyTransaction getTransaction() throws SystemException {
return thread_local.get();
}
@@ -208,7 +211,7 @@
* @param tx
*/
public void setTransaction(Transaction tx) {
- thread_local.set(tx);
+ thread_local.set((DummyTransaction) tx);
}
}
More information about the jbosscache-commits
mailing list