Search in sources :

Example 1 with ForeignTransaction

use of org.wildfly.iiop.openjdk.tm.ForeignTransaction in project wildfly by wildfly.

the class EjbIIOPTransactionInterceptor method processInvocation.

@Override
public Object processInvocation(final InterceptorContext invocation) throws Exception {
    // Do we have a foreign transaction context?
    Transaction tx = TxServerInterceptor.getCurrentTransaction();
    if (tx instanceof ForeignTransaction) {
        final EJBComponent component = (EJBComponent) invocation.getPrivateData(Component.class);
        // for timer invocations there is no view, so the methodInf is attached directly
        // to the context. Otherwise we retrieve it from the invoked view
        MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class);
        if (methodIntf == null) {
            final ComponentView componentView = invocation.getPrivateData(ComponentView.class);
            if (componentView != null) {
                methodIntf = componentView.getPrivateData(MethodIntf.class);
            } else {
                methodIntf = MethodIntf.BEAN;
            }
        }
        final TransactionAttributeType attr = component.getTransactionAttributeType(methodIntf, invocation.getMethod());
        if (attr != TransactionAttributeType.NOT_SUPPORTED && attr != TransactionAttributeType.REQUIRES_NEW) {
            throw EjbLogger.ROOT_LOGGER.transactionPropagationNotSupported();
        }
    }
    return invocation.proceed();
}
Also used : Transaction(javax.transaction.Transaction) ForeignTransaction(org.wildfly.iiop.openjdk.tm.ForeignTransaction) ComponentView(org.jboss.as.ee.component.ComponentView) ForeignTransaction(org.wildfly.iiop.openjdk.tm.ForeignTransaction) EJBComponent(org.jboss.as.ejb3.component.EJBComponent) Component(org.jboss.as.ee.component.Component) EJBComponent(org.jboss.as.ejb3.component.EJBComponent) MethodIntf(org.jboss.as.ejb3.component.MethodIntf) TransactionAttributeType(javax.ejb.TransactionAttributeType)

Aggregations

TransactionAttributeType (javax.ejb.TransactionAttributeType)1 Transaction (javax.transaction.Transaction)1 Component (org.jboss.as.ee.component.Component)1 ComponentView (org.jboss.as.ee.component.ComponentView)1 EJBComponent (org.jboss.as.ejb3.component.EJBComponent)1 MethodIntf (org.jboss.as.ejb3.component.MethodIntf)1 ForeignTransaction (org.wildfly.iiop.openjdk.tm.ForeignTransaction)1