Package javax.transaction

Examples of javax.transaction.InvalidTransactionException


    public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
        if (threadTx.get() != null) {
            throw new IllegalStateException("Transaction already associated with current thread");
        }
        if (tx instanceof TransactionImpl == false) {
            throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
        }
        threadTx.set(tx);
    }
View Full Code Here


    public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
        if (threadTx.get() != null) {
            throw new IllegalStateException("Transaction already associated with current thread");
        }
        if (tx instanceof TransactionProxy == false) {
            throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
        }
        threadTx.set(tx);
    }
View Full Code Here

    public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
        if (threadTx.get() != null) {
            throw new IllegalStateException("Transaction already associated with current thread");
        }
        if (tx instanceof TransactionImpl == false) {
            throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
        }
        threadTx.set(tx);
    }
View Full Code Here

        return threadTransaction.get();
    }

    public void resume(Transaction tx) throws InvalidTransactionException {
        if (tx == null) {
            throw new InvalidTransactionException("Transaction is null");
        }
        if (!(tx instanceof MyTransaction)) {
            throw new InvalidTransactionException("Unknown transaction type " + tx.getClass().getName());
        }
        MyTransaction myTransaction = (MyTransaction) tx;

        if (threadTransaction.get() != null) {
            throw new IllegalStateException("A transaction is already active");
        }

        int status = myTransaction.getStatus();
        if (status != Status.STATUS_ACTIVE && status != Status.STATUS_MARKED_ROLLBACK) {
            throw new InvalidTransactionException("Expected transaction to be STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, but was " + status);
        }

        threadTransaction.set(myTransaction);
    }
View Full Code Here

/*     */       {
/* 114 */         TransactionImple theTransaction = (TransactionImple)which;
/*     */         try
/*     */         {
/* 118 */           if (!AtomicAction.resume(theTransaction.getAtomicAction())) {
/* 119 */             throw new InvalidTransactionException();
/*     */           }
/* 121 */           theTransaction = null;
/*     */         }
/*     */         catch (Exception e2)
/*     */         {
/* 125 */           throw new SystemException();
/*     */         }
/*     */       }
/*     */       else {
/* 129 */         throw new InvalidTransactionException("Illegal type is: " + which);
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

        if(currentTxId != txId)
        {
            suspendCurrentTransaction();
            Transaction tx = txIdToTxMap.get(txId);
            if (tx == null) {
                throw new InvalidTransactionException("No transaction with id "
                        + txId + " found.");
            }
            tm.resume(tx);
            currentTxId = txId;
        }
View Full Code Here

            } finally {
                txIdToTxMap.remove(currentTxId);
                currentTxId = -1l;
            }
        } else {
            throw new InvalidTransactionException("Can't commit, no transaction selected.");
        }
    }
View Full Code Here

            } finally {
                txIdToTxMap.remove(currentTxId);
                currentTxId = -1l;
            }
        } else {
            throw new InvalidTransactionException("Can't roll back, no transaction selected.");
        }

    }
View Full Code Here

    private void associate(TransactionImpl tx) throws InvalidTransactionException {
        if (tx == null) throw new NullPointerException("tx is null");

        Object existingAssociation = associatedTransactions.putIfAbsent(tx, Thread.currentThread());
        if (existingAssociation != null) {
            throw new InvalidTransactionException("Specified transaction is already associated with another thread");
        }
        threadTx.set(tx);
        fireThreadAssociated(tx);
    }
View Full Code Here

    public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
        if (getTransaction() != null) {
            throw new IllegalStateException("Thread already associated with another transaction");
        }
        if (!(tx instanceof TransactionImpl)) {
            throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
        }
        associate((TransactionImpl) tx);
    }
View Full Code Here

TOP

Related Classes of javax.transaction.InvalidTransactionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.