Search in sources :

Example 16 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class PoolManagerImpl method postInvoke.

private void postInvoke(ComponentInvocation curInv) {
    ComponentInvocation invToUse = curInv;
    /*
        if(invToUse == null){
            invToUse = getConnectorRuntime().getInvocationManager().getCurrentInvocation();
        }
*/
    if (invToUse == null) {
        return;
    }
    Object comp = invToUse.getInstance();
    if (comp == null) {
        return;
    }
    handleLazilyAssociatedConnectionPools(comp, invToUse);
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Example 17 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class JavaEETransactionManagerSimplified method begin.

/**
 * This method is introduced as part of implementing the local transaction timeout
 * capability. Implementation of begin() moved here. Previpusly there is no timeout
 * infrastructure for local txns, so when ever a timeout required for local txn, it
 * uses the globaltxn timeout infrastructure by doing an XA simulation.
 */
public void begin(int timeout) throws NotSupportedException, SystemException {
    // Check if tx already exists
    if (transactions.get() != null)
        throw new NotSupportedException(sm.getString("enterprise_distributedtx.notsupported_nested_transaction"));
    setDelegate();
    // This is needed in case the JTS tx was imported from a client.
    if (getStatus() != Status.STATUS_NO_TRANSACTION)
        throw new NotSupportedException(sm.getString("enterprise_distributedtx.notsupported_nested_transaction"));
    // START IASRI 4662745
    if (monitoringEnabled) {
        // XXX acquireReadLock();
        getDelegate().getReadLock().lock();
        try {
            JavaEETransactionImpl tx = initJavaEETransaction(timeout);
            activeTransactions.add(tx);
            monitor.transactionActivatedEvent();
            ComponentInvocation inv = invMgr.getCurrentInvocation();
            if (inv != null && inv.getInstance() != null) {
                tx.setComponentName(inv.getInstance().getClass().getName());
            }
        } finally {
            // XXX releaseReadLock();
            getDelegate().getReadLock().unlock();
        }
    } else {
        initJavaEETransaction(timeout);
    }
// START IASRI 4662745
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Example 18 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class JavaEETransactionManagerSimplified method registerComponentResource.

public void registerComponentResource(TransactionalResource h) {
    ComponentInvocation inv = invMgr.getCurrentInvocation();
    if (inv != null) {
        Object instance = inv.getInstance();
        if (instance == null)
            return;
        h.setComponentInstance(instance);
        List l = getResourceList(instance, inv);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "\n\nIn JavaEETransactionManagerSimplified.registerComponentResource, h=" + h + " h.xares=" + h.getXAResource());
        }
        l.add(h);
    }
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Example 19 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class JavaEETransactionManagerSimplified method enlistComponentResources.

public void enlistComponentResources() throws RemoteException {
    if (_logger.isLoggable(Level.FINE))
        _logger.log(Level.FINE, "TM: enlistComponentResources");
    ComponentInvocation inv = invMgr.getCurrentInvocation();
    if (inv == null)
        return;
    try {
        Transaction tran = getTransaction();
        inv.setTransaction((JavaEETransaction) tran);
        enlistComponentResources(inv);
    } catch (InvocationException ex) {
        _logger.log(Level.SEVERE, "enterprise_distributedtx.excep_in_enlist", ex);
        throw new RemoteException(ex.getMessage(), ex.getNestedException());
    } catch (Exception ex) {
        _logger.log(Level.SEVERE, "enterprise_distributedtx.excep_in_enlist", ex);
        throw new RemoteException(ex.getMessage(), ex);
    }
}
Also used : JavaEETransaction(com.sun.enterprise.transaction.api.JavaEETransaction) ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) InvocationException(org.glassfish.api.invocation.InvocationException) RemoteException(java.rmi.RemoteException) InvocationException(org.glassfish.api.invocation.InvocationException) WorkException(javax.resource.spi.work.WorkException) RemoteException(java.rmi.RemoteException) XAException(javax.transaction.xa.XAException)

Example 20 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class UserTransactionImpl method rollback.

public void rollback() throws IllegalStateException, SecurityException, SystemException {
    if (!initialized)
        init();
    if (userTx != null) {
        userTx.rollback();
        return;
    }
    ComponentInvocation inv = invocationManager.getCurrentInvocation();
    if (inv != null) {
        checkUserTransactionMethodAccess(inv);
    }
    try {
        // TMSUCCESS
        transactionManager.delistComponentResources(false);
        transactionManager.rollback();
    } catch (RemoteException ex) {
        _logger.log(Level.SEVERE, "enterprise_distributedtx.excep_in_utx_rollback", ex);
        throw new SystemException();
    } finally {
        if (inv != null)
            inv.setTransaction(null);
    }
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) RemoteException(java.rmi.RemoteException)

Aggregations

ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)67 InvocationManager (org.glassfish.api.invocation.InvocationManager)13 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)8 EjbInvocation (com.sun.ejb.EjbInvocation)7 InvocationException (org.glassfish.api.invocation.InvocationException)7 SecurityContext (com.sun.enterprise.security.SecurityContext)6 WebModule (com.sun.enterprise.web.WebModule)6 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)5 InjectionException (com.sun.enterprise.container.common.spi.util.InjectionException)5 WebComponentInvocation (com.sun.enterprise.web.WebComponentInvocation)5 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)4 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)4 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)4 JavaEETransactionManager (com.sun.enterprise.transaction.api.JavaEETransactionManager)4 RemoteException (java.rmi.RemoteException)4 EJBInvocation (org.glassfish.ejb.api.EJBInvocation)4 ArrayList (java.util.ArrayList)3 NamingException (javax.naming.NamingException)3 WeldBootstrap (org.jboss.weld.bootstrap.WeldBootstrap)3 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)3