Examples of InvalidTransactionException


Examples of javax.transaction.InvalidTransactionException

        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

Examples of javax.transaction.InvalidTransactionException

    // Create a context if none has been set yet
    if (transactionContextManager.getContext() == null) {
      transactionContextManager.newUnspecifiedTransactionContext();
    }
    if (tx instanceof GeronimoTransactionDelegate == false) {
      throw new InvalidTransactionException("invalid transaction specified");
    }
    TransactionContext ctx = ((GeronimoTransactionDelegate) tx).getContext();
    transactionContextManager.resumeBeanTransactionContext(ctx);
  }
View Full Code Here

Examples of javax.transaction.InvalidTransactionException

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

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

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

    }
View Full Code Here

Examples of javax.transaction.InvalidTransactionException

        String[] theFinalStates1 = init1;

        Exception[] theExceptions = { null, null, null, null, null, null, null,
                null };

        InvalidTransactionException aInvalidTransactionException;
        int loopCount = init1.length;
        for (int i = 0; i < loopCount; i++) {
            try {
                aInvalidTransactionException = new InvalidTransactionException(
                        init1[i]);
                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

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

Examples of javax.transaction.InvalidTransactionException

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

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

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

    }
View Full Code Here

Examples of javax.transaction.InvalidTransactionException

        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

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

Examples of javax.transaction.InvalidTransactionException

    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

Examples of javax.transaction.InvalidTransactionException

        } 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
TOP
Copyright © 2018 www.massapi.com. 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.