[teiid-commits] teiid SVN: r3839 - branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Feb 1 13:02:36 EST 2012


Author: shawkins
Date: 2012-02-01 13:02:36 -0500 (Wed, 01 Feb 2012)
New Revision: 3839

Modified:
   branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
Log:
TEIID-1921 fix for using the local connection

Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2012-02-01 16:55:53 UTC (rev 3838)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2012-02-01 18:02:36 UTC (rev 3839)
@@ -909,11 +909,16 @@
 	// global txn
 	public ResultsFuture<?> start(final XidImpl xid, final int flags, final int timeout)
 			throws XATransactionException {
+		final DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+		if (workContext.getSession().isEmbedded()) {
+		    //must be a synch call regardless since the txn should be associated with the thread.
+			getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, true);
+			return ResultsFuture.NULL_FUTURE;
+		}
 		Callable<Void> processor = new Callable<Void>() {
 			@Override
 			public Void call() throws Exception {
-				DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-				getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
+				getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, false);
 				return null;
 			}
 		};

Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java	2012-02-01 16:55:53 UTC (rev 3838)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java	2012-02-01 18:02:36 UTC (rev 3839)
@@ -239,7 +239,12 @@
 					tc.setTransactionType(TransactionContext.Scope.GLOBAL);
 					if (singleTM) {
 						tc.setTransaction(transactionManager.getTransaction());
-						assert tc.getTransaction() != null;
+						if (tc.getTransaction() == null) {
+						    //the current code currently does not handle the case of embedded connections where
+							//someone is manually initiating txns - that is there is no thread bound txn.
+							//in theory we could inflow the txn and then change all of the methods to check singleTM off of the context
+						    throw new XATransactionException(XAException.XAER_INVAL, "Transaction Is null"); //$NON-NLS-1$
+						}
 					} else {
 						FutureWork<Transaction> work = new FutureWork<Transaction>(new Callable<Transaction>() {
 							@Override



More information about the teiid-commits mailing list