Package javax.transaction

Examples of javax.transaction.InvalidTransactionException


    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

        } else if (ex instanceof TRANSACTION_ROLLEDBACK) {
            RemoteException newEx = new TransactionRolledbackException(message);
            newEx.detail = ex;
            return newEx;
        } else if (ex instanceof INVALID_TRANSACTION) {
            RemoteException newEx = new InvalidTransactionException(message);
            newEx.detail = ex;
            return newEx;
        } else if (ex instanceof BAD_PARAM) {
            Exception inner = ex;
View Full Code Here

        }
    }

    public void resumeBeanTransactionContext(TransactionContext context) throws SystemException, InvalidTransactionException {
        if (!(context instanceof BeanTransactionContext)) {
            throw new InvalidTransactionException("Context is not a bean managed transaction context");
        }
        if (!context.isActive()) {
            throw new InvalidTransactionException("Context is not active");
        }
        BeanTransactionContext beanContext = ((BeanTransactionContext) context);

        // suspend the exisiting unspecified transaction context
        TransactionContext callerContext = getContext();
        if (!(callerContext instanceof UnspecifiedTransactionContext)) {
            throw new InvalidTransactionException("Caller context is not an unspecified transaction context");
        }
        callerContext.suspend();

        try {
            beanContext.setOldContext((UnspecifiedTransactionContext) callerContext);
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

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.