final TransactionContext tc = transactions.getOrCreateTransactionContext(threadId);
try {
if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
if (tc.getTransactionType() != TransactionContext.Scope.LOCAL) {
throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
}
if (!transactionExpected) {
throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
}
transactionManager.resume(tc.getTransaction());
} else if (transactionExpected) {
throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.no_transaction", threadId)); //$NON-NLS-1$
}
} catch (InvalidTransactionException e) {
throw new XATransactionException(e);
} catch (SystemException e) {
throw new XATransactionException(e);