Package com.sun.enterprise.transaction.api

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


     *        be XAResource.TMSUCCESS or XAResource.TMFAIL    
     * @exception <code>PoolingException</code>
     */      
    public void delistResource(ResourceHandle h, int xaresFlag) {
        try {
        JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();
            Transaction tran = tm.getTransaction();
      if (tran != null) {
                tm.delistResource(tran, h, xaresFlag);
            }   
        } catch (SystemException ex) {
            _logger.log(Level.WARNING,"poolmgr.system_exception",ex);
        } catch (IllegalStateException ex) {
            // ignore
View Full Code Here


     */
    public void registerResource(ResourceHandle handle)
            throws PoolingException {
        try {
            Transaction tran = null;
            JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();

            // enlist if necessary
            if (handle.isTransactional()) {
                InvocationManager invmgr = ConnectorRuntime.getRuntime().getInvocationManager();
                ComponentInvocation inv = invmgr.getCurrentInvocation();
                             
                if (inv == null) {
                    //throw new InvocationException();
                   
                    //Go to the tm and get the transaction
        //This is mimicking the current behavior of
        //the SystemResourceManagerImpl registerResource method
        //in that, you return the transaction from the TxManager
        try {
                        tran = tm.getTransaction();  
                    } catch( Exception e ) {
            tran = null;
      _logger.log(Level.INFO, e.getMessage());
        }
                } else {
                    tran = (Transaction) inv.getTransaction();
                    tm.registerComponentResource(handle);
                }
               
                if (tran != null) {
          try{           
              tm.enlistResource(tran, handle);
          } catch (Exception ex) {
                        if(_logger.isLoggable(Level.FINE)) {
                  _logger.fine("Exception whle trying to enlist resource " + ex.getMessage());
                        }
              //If transactional, remove the connection handle from the
              //component's resource list as there has been exception attempting
              //to enlist the resource
              if(inv != null) {
                            if(_logger.isLoggable(Level.FINE)) {
                      _logger.fine("Attempting to unregister component resource");
                            }
                  tm.unregisterComponentResource(handle);
              }
              throw ex;
          }
                }
            }
View Full Code Here

     * Get's the component's transaction and marks it for rolling back.
     */
    public void rollBackTransaction() {
        InvocationManager invmgr = ConnectorRuntime.getRuntime().getInvocationManager();

  JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();
  Transaction tran = null;
        try {
            ComponentInvocation inv = invmgr.getCurrentInvocation();
            if (inv == null) {
                //throw new InvocationException();
                   
               //Go to the tm and get the transaction
               //This is mimicking the current behavior of
               //the SystemResourceManagerImpl registerResource method
               //in that, you return the transaction from the TxManager
         try {
                   tran = tm.getTransaction();  
               } catch( Exception e ) {
             tran = null;
                   _logger.log(Level.INFO, e.getMessage());
               }

View Full Code Here

     * @exception <code>PoolingException</code>
     */
    public void unregisterResource(ResourceHandle resource,
                                   int xaresFlag) {

        JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();

        Transaction tran = null;

        try {
            // delist with TMSUCCESS if necessary
            if (resource.isTransactional()) {
                InvocationManager invmgr = ConnectorRuntime.getRuntime().getInvocationManager();

                ComponentInvocation inv = invmgr.getCurrentInvocation();
                if (inv == null) {
                    //throw new InvocationException();

                    //Go to the tm and get the transaction
                    //This is mimicking the current behavior of
                    //the SystemResourceManagerImpl registerResource method
                    //in that, you return the transaction from the TxManager
                    try {
                        tran = tm.getTransaction();
                    } catch (Exception e) {
                        tran = null;
                        _logger.log(Level.INFO, e.getMessage());
                    }
                } else {
                    tran = (Transaction) inv.getTransaction();
                    tm.unregisterComponentResource(resource);
                }
                if (tran != null && resource.isEnlisted()) {
                    tm.delistResource(tran, resource, xaresFlag);
                }
            }
        } catch (SystemException ex) {
            _logger.log(Level.WARNING, "poolmgr.system_exception", ex);
        } catch (IllegalStateException ex) {
View Full Code Here

            }
        }
    }

    private JavaEETransactionManager getJavaEETransactionManager(ServiceLocator services) {
        JavaEETransactionManager tm = null;
        ServiceHandle<JavaEETransactionManager> inhabitant = services.getServiceHandle(JavaEETransactionManager.class);
        if (inhabitant != null && inhabitant.isActive()) {
            tm = inhabitant.getService();
        }
       
View Full Code Here

        } else { //the rest are considered methods for message delivery

            //RA did not call beforeDelivery, handle it here
            if (!beforeDeliveryCalled) {
                JavaEETransactionManager txManager =
                        ConnectorRuntime.getRuntime().getTransactionManager();
                boolean txImported = (txManager.getTransaction() != null);
                listener_.beforeMessageDelivery(method, txImported);
            }

            try {
                //returnValue = listener_.deliverMessage(method, args);
View Full Code Here

        postInvokeTx(true, false);
        return transactionManager.suspend();
    }

    public void recreate(Xid xid, long timeout) {
        final JavaEETransactionManager tm = transactionManager;
       
        try {
            tm.recreate(xid, timeout);
        } catch (javax.resource.spi.work.WorkException ex) {
            throw new IllegalStateException(ex);
        }
        preInvokeTx(true);
    }
View Full Code Here

        }
        preInvokeTx(true);
    }

    public void release(Xid xid) {
        final JavaEETransactionManager tm = transactionManager;
    
        postInvokeTx(false, true);
        try {
            tm.release(xid);   
        } catch (javax.resource.spi.work.WorkException ex) {
            throw new IllegalStateException(ex);
        finally {
            if (tm instanceof JavaEETransactionManagerSimplified) {
                ((JavaEETransactionManagerSimplified) tm).clearThreadTx();
View Full Code Here

        }
        preInvokeTx(true);
    }

    public void release(Xid xid) {
        final JavaEETransactionManager tm = transactionManager;
    
        postInvokeTx(false, true);
        try {
            tm.release(xid);   
        } catch (javax.resource.spi.work.WorkException ex) {
            throw new IllegalStateException(ex);
        finally {
            if (tm instanceof JavaEETransactionManagerSimplified) {
                ((JavaEETransactionManagerSimplified) tm).clearThreadTx();
View Full Code Here

    }

    public void onReady() {
        _logger.fine("TM RECOVERY WRAPPER - ON READY STARTED");

        JavaEETransactionManager tm = habitat.getByContract(JavaEETransactionManager.class);
        tm.initRecovery(false);

        _logger.fine("TM RECOVERY WRAPPER - ON READY FINISHED");
    }
View Full Code Here

TOP

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

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.