Package org.apache.geronimo.transaction

Examples of org.apache.geronimo.transaction.TransactionContext


        this.next = next;
        this.connectionTracker = connectionTracker;
    }

    public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
        TransactionContext transactionContext = TransactionContext.getContext();
        ManagedConnectionInfo managedConnectionInfo = (ManagedConnectionInfo)transactionContext.getManagedConnectionInfo(this);
        if (managedConnectionInfo != null) {
            connectionInfo.setManagedConnectionInfo(managedConnectionInfo);
            return;
        } else {
            next.getConnection(connectionInfo);
            transactionContext.setManagedConnectionInfo(this, connectionInfo.getManagedConnectionInfo());
        }
    }
View Full Code Here


        if (connectionReturnAction == ConnectionReturnAction.DESTROY) {
            next.returnConnection(connectionInfo, connectionReturnAction);
        }

        TransactionContext transactionContext = TransactionContext.getContext();
        if (transactionContext.isActive()) {
            return;
        }
        if (connectionInfo.getManagedConnectionInfo().hasConnectionHandles()) {
            return;
        }
View Full Code Here

        public void setTransactionTimeout(int seconds) throws SystemException {
            txnManager.setTransactionTimeout(seconds);
        }

        public void begin() throws NotSupportedException, SystemException {
            TransactionContext ctx = TransactionContext.getContext();
            if (ctx instanceof UnspecifiedTransactionContext == false) {
                throw new NotSupportedException("Previous Transaction has not been committed");
            }
            UnspecifiedTransactionContext oldContext = (UnspecifiedTransactionContext) ctx;
            BeanTransactionContext newContext = new BeanTransactionContext(txnManager, oldContext);
View Full Code Here

                }
            }
        }

        public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
            TransactionContext ctx = TransactionContext.getContext();
            if (ctx instanceof BeanTransactionContext == false) {
                throw new IllegalStateException("Transaction has not been started");
            }
            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
            try {
View Full Code Here

                oldContext.resume();
            }
        }

        public void rollback() throws IllegalStateException, SecurityException, SystemException {
            TransactionContext ctx = TransactionContext.getContext();
            if (ctx instanceof BeanTransactionContext == false) {
                throw new IllegalStateException("Transaction has not been started");
            }
            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
            try {
View Full Code Here

    public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
        next.getConnection(connectionInfo);
        try {
            ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
            TransactionContext transactionContext = TransactionContext.getContext();
            if (transactionContext.isActive()) {
                XAResource xares = mci.getXAResource();
                transactionContext.getTransaction().enlistResource(xares);
            }

        } catch (SystemException e) {
            throw new ResourceException("Could not get transaction", e);
        } catch (RollbackException e) {
View Full Code Here

    public void returnConnection(
            ConnectionInfo connectionInfo,
            ConnectionReturnAction connectionReturnAction) {
        try {
            ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
            TransactionContext transactionContext = TransactionContext.getContext();
            if (transactionContext.isActive()) {
                XAResource xares = mci.getXAResource();
                transactionContext.getTransaction().delistResource(xares, XAResource.TMSUSPEND);
            }

        } catch (SystemException e) {
            //maybe we should warn???
            connectionReturnAction = ConnectionReturnAction.DESTROY;
View Full Code Here

TOP

Related Classes of org.apache.geronimo.transaction.TransactionContext

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.