Package com.sun.enterprise.transaction.api

Examples of com.sun.enterprise.transaction.api.JavaEETransaction


    public void commit() throws RollbackException,
            HeuristicMixedException, HeuristicRollbackException, SecurityException,
            IllegalStateException, SystemException {

        try {
            JavaEETransaction tx = transactions.get();
            if ( tx != null && tx.isLocalTx()) {
                if(monitoringEnabled){
                    Object obj = tx;
                    getDelegate().getReadLock().lock(); // XXX acquireReadLock();

                    boolean success = false;
                    try{
                        tx.commit(); // commit local tx
                        success = true;
                    }catch(HeuristicMixedException e){
                        success = true;
                        throw e;
                    } finally {
                        monitorTxCompleted(obj, success);
                        getDelegate().getReadLock().unlock(); // XXX releaseReadLock();
                    }
                } else {
                    tx.commit(); // commit local tx
                }
            }
            else  {
                try{
                    // an XA transaction
View Full Code Here


    public void rollback() throws IllegalStateException, SecurityException,
                SystemException {
        boolean acquiredlock=false;
        try {
            JavaEETransaction tx = transactions.get();
            if ( tx != null && tx.isLocalTx()) {
                if(monitoringEnabled){
                    Object obj = tx;
                    getDelegate().getReadLock().lock(); // XXX acquireReadLock();
                    acquiredlock = true;

                    try {
                        tx.rollback(); // rollback local tx
                    } finally {
                        monitorTxCompleted(obj, false);
                    }
                } else {
                    tx.rollback(); // rollback local tx
                }
            }
            else  {
                try {
                    // an XA transaction
View Full Code Here

    }

    public void setRollbackOnly()
        throws IllegalStateException, SystemException {

        JavaEETransaction tx = transactions.get();
        // START IASRI 4662745
        if ( tx != null && tx.isLocalTx()){
            if(monitoringEnabled){
                getDelegate().getReadLock().lock(); // XXX acquireReadLock();
                try{
                    tx.setRollbackOnly();
                }finally{
                    getDelegate().getReadLock().unlock(); // XXX releaseReadLock();
                }
            } else {
                tx.setRollbackOnly();
            }
        }
        else
            getDelegate().setRollbackOnlyDistributedTransaction(); // probably a JTS imported tx
    }
View Full Code Here

    public void resume(Transaction tobj)
            throws InvalidTransactionException, IllegalStateException,
            SystemException {

        JavaEETransaction tx = transactions.get();
        if ( tx != null )
            throw new IllegalStateException(
                    sm.getString("enterprise_distributedtx.transaction_exist_on_currentThread"));

        if ( tobj != null ) {
View Full Code Here

       
        return inv.method;
    }
   
    public String getTransactionId() {
        JavaEETransaction tx = null;
        try {
            tx =
                (JavaEETransaction) EjbContainerUtilImpl.getInstance().
                        getTransactionManager().getTransaction();
        } catch (Exception ex) {
View Full Code Here

    }

    @Override
    protected void enlistExtendedEntityManagers(ComponentContext ctx) {
        if (ctx.getTransaction() != null) {
            JavaEETransaction j2eeTx = (JavaEETransaction) ctx.getTransaction();
            SessionContextImpl sessionCtx = (SessionContextImpl) ctx;
            Map<EntityManagerFactory, EntityManager> entityManagerMap =
                sessionCtx.getExtendedEntityManagerMap();

            for (Map.Entry<EntityManagerFactory, EntityManager> entry :
                     entityManagerMap.entrySet()) {
                EntityManagerFactory emf = entry.getKey();
                EntityManager extendedEm = entry.getValue();

                EntityManager extendedEmAssociatedWithTx =
                    j2eeTx.getExtendedEntityManager(emf);

                // If there's not already an EntityManager registered for
                // this extended EntityManagerFactory within the current tx
                if (extendedEmAssociatedWithTx == null) {
                    j2eeTx.addExtendedEntityManagerMapping(emf,
                                                           extendedEm);
                    sessionCtx.setEmfRegisteredWithTx(emf, true);

                    // Tell persistence provider to associate the extended
                    // entity manager with the transaction.
View Full Code Here

    @Override
    protected void delistExtendedEntityManagers(ComponentContext ctx) {
        if ( ((EJBContextImpl)ctx).getTransaction() != null ) {
            SessionContextImpl sessionCtx = (SessionContextImpl) ctx;
            JavaEETransaction j2eeTx = (JavaEETransaction) sessionCtx.getTransaction();

            Map<EntityManagerFactory, EntityManager> entityManagerMap = sessionCtx
                    .getExtendedEntityManagerMap();
            for (Map.Entry<EntityManagerFactory, EntityManager> entry :
                    entityManagerMap.entrySet()) {
                EntityManagerFactory emf = entry.getKey();

                if (sessionCtx.isEmfRegisteredWithTx(emf)) {
                    j2eeTx.removeExtendedEntityManagerMapping(emf);
                    sessionCtx.setEmfRegisteredWithTx(emf, false);
                }
            }
        }
    }
View Full Code Here

    }

    @Override
    protected void enlistExtendedEntityManagers(ComponentContext ctx) {
        if (ctx.getTransaction() != null) {
            JavaEETransaction j2eeTx = (JavaEETransaction) ctx.getTransaction();
            SessionContextImpl sessionCtx = (SessionContextImpl) ctx;
            Map<EntityManagerFactory, PhysicalEntityManagerWrapper> entityManagerMap =
                sessionCtx.getExtendedEntityManagerMap();

            for (Map.Entry<EntityManagerFactory, PhysicalEntityManagerWrapper> entry :
                     entityManagerMap.entrySet()) {
                EntityManagerFactory emf = entry.getKey();
                PhysicalEntityManagerWrapper extendedEm = entry.getValue();

                PhysicalEntityManagerWrapper extendedEmAssociatedWithTx = EntityManagerWrapper.getExtendedEntityManager(j2eeTx, emf);

                // If there's not already an EntityManager registered for
                // this extended EntityManagerFactory within the current tx
                if (extendedEmAssociatedWithTx == null) {
                    j2eeTx.addExtendedEntityManagerMapping(emf, extendedEm);
                    sessionCtx.setEmfRegisteredWithTx(emf, true);

                    // Tell persistence provider to associate the extended
                    // entity manager with the transaction.
                    if(extendedEm.getSynchronizationType() == SYNCHRONIZED) {
View Full Code Here

    @Override
    protected void delistExtendedEntityManagers(ComponentContext ctx) {
        if ( ctx.getTransaction() != null ) {
            SessionContextImpl sessionCtx = (SessionContextImpl) ctx;
            JavaEETransaction j2eeTx = (JavaEETransaction) sessionCtx.getTransaction();

            Map<EntityManagerFactory, PhysicalEntityManagerWrapper> entityManagerMap = sessionCtx
                    .getExtendedEntityManagerMap();
            for (Map.Entry<EntityManagerFactory, PhysicalEntityManagerWrapper> entry :
                    entityManagerMap.entrySet()) {
                EntityManagerFactory emf = entry.getKey();

                if (sessionCtx.isEmfRegisteredWithTx(emf)) {
                    j2eeTx.removeExtendedEntityManagerMapping(emf);
                    sessionCtx.setEmfRegisteredWithTx(emf, false);
                }
            }
        }
    }
View Full Code Here

    }

    @Override
    protected void enlistExtendedEntityManagers(ComponentContext ctx) {
        if (ctx.getTransaction() != null) {
            JavaEETransaction j2eeTx = (JavaEETransaction) ctx.getTransaction();
            SessionContextImpl sessionCtx = (SessionContextImpl) ctx;
            Map<EntityManagerFactory, EntityManager> entityManagerMap =
                sessionCtx.getExtendedEntityManagerMap();

            for (Map.Entry<EntityManagerFactory, EntityManager> entry :
                     entityManagerMap.entrySet()) {
                EntityManagerFactory emf = entry.getKey();
                EntityManager extendedEm = entry.getValue();

                EntityManager extendedEmAssociatedWithTx =
                    j2eeTx.getExtendedEntityManager(emf);

                // If there's not already an EntityManager registered for
                // this extended EntityManagerFactory within the current tx
                if (extendedEmAssociatedWithTx == null) {
                    j2eeTx.addExtendedEntityManagerMapping(emf,
                                                           extendedEm);
                    sessionCtx.setEmfRegisteredWithTx(emf, true);

                    // Tell persistence provider to associate the extended
                    // entity manager with the transaction.
View Full Code Here

TOP

Related Classes of com.sun.enterprise.transaction.api.JavaEETransaction

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.