1 22 package org.jboss.tm.integrity; 23 24 import java.util.Set ; 25 26 import org.jboss.tm.TransactionImpl; 27 28 35 public class FailIncompleteTransactionIntegrity extends AbstractTransactionIntegrity 36 { 37 public void checkTransactionIntegrity(TransactionImpl transaction) 38 { 39 Set threads = transaction.getAssociatedThreads(); 41 String rollbackError = null; 42 synchronized (threads) 43 { 44 if (threads.size() > 1) 45 rollbackError = "Too many threads " + threads + " associated with transaction " + transaction; 46 else if (threads.size() != 0) 47 { 48 Thread other = (Thread ) threads.iterator().next(); 49 Thread current = Thread.currentThread(); 50 if (current.equals(other) == false) 51 rollbackError = "Attempt to commit transaction " + transaction + " on thread " + current + 52 " with other threads still associated with the transaction " + other; 53 } 54 } 55 if (rollbackError != null) 56 { 57 log.error(rollbackError, new IllegalStateException ("STACKTRACE")); 58 markRollback(transaction); 59 } 60 } 61 } 62 | Popular Tags |