Package javax.transaction

Examples of javax.transaction.InvalidTransactionException


        String[] theFinalStates1 = { null };

        Exception[] theExceptions = { null };

        InvalidTransactionException aInvalidTransactionException;
        int loopCount = 1;
        for (int i = 0; i < loopCount; i++) {
            try {
                aInvalidTransactionException = new InvalidTransactionException();
                if (theExceptions[i] != null) {
                    fail();
                }
                assertEquals(i + "  Final state mismatch",
                        aInvalidTransactionException.getMessage(),
                        theFinalStates1[i]);

            } catch (Exception e) {
                if (theExceptions[i] == null) {
                    fail(i + "Unexpected exception");
View Full Code Here


        if (getTransaction() != null)
            throw new IllegalStateException();

        if (tobj == null)
            throw new InvalidTransactionException();

        bindings.put(Thread.currentThread(), tobj);

    }
View Full Code Here

        if (_transaction.get() != null)
            throw new IllegalStateException("Transaction is active in current thread: " + _transaction.get());
        try {
            _transaction.set((TX) tx);
        } catch (ClassCastException cce) {
            throw new InvalidTransactionException();
        }

    }
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

        } 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

        return threadTransaction.get();
    }

    public void resume(final 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());
        }
        final MyTransaction myTransaction = (MyTransaction) tx;

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

        final 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

        if (getTransaction() != null)
            throw new IllegalStateException();

        if (tobj == null)
            throw new InvalidTransactionException();

        bindings.put(Thread.currentThread(), tobj);

    }
View Full Code Here

        setTransactionalTransactionOperationsManger(true);
        try {
            if (getTransactionManager().getTransaction() != null)
                throw new TransactionalException(
                        "InvalidTransactionException thrown from TxType.NEVER transactional interceptor.",
                        new InvalidTransactionException("Managed bean with Transactional annotation and TxType of NEVER " +
                                "called inside a transaction context"));
            return proceed(ctx);
        } finally {
            resetTransactionOperationsManager();
        }
View Full Code Here

        if (getTransaction() != null)
            throw new IllegalStateException();

        if (tobj == null)
            throw new InvalidTransactionException();

        bindings.put(Thread.currentThread(), tobj);

    }
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.