[jboss-jira] [JBoss JIRA] (WFLY-10258) Prevent enlisting additional resources on EJB caller side in case of server side @RequiresNew

Ondra Chaloupka (JIRA) issues at jboss.org
Fri Apr 20 08:49:00 EDT 2018


    [ https://issues.jboss.org/browse/WFLY-10258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13564395#comment-13564395 ] 

Ondra Chaloupka edited comment on WFLY-10258 at 4/20/18 8:48 AM:
-----------------------------------------------------------------

[~dmlloyd] a good point, agree and on top of it I can see you already implemented the functionality ;-P

Anyway, if you permit a small side step:
I think it would be a hard to involve your idea about using {{XAResource.end}} call to decide about the resource future. First the {{XAResource}} API is not providing way to return a value back to the caller (https://docs.oracle.com/javaee/7/api/javax/transaction/xa/XAResource.html#end-javax.transaction.xa.Xid-int-). The other issue is the Narayana implementation which calls the {{.end}} just before {{prepare}} call on the each {{XAResource}} (https://github.com/jbosstm/narayana/blob/master/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java#L210). Refactoring the code and moving the {{end}} call to some top-level place where the decision about 1PC/2PC is done (https://github.com/jbosstm/narayana/blob/master/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java#L2168) I consider difficult.

Back to the prior point:
As I was investigating your point I can see that the wfly transactional client delists itself from the current transaction in {{beforeCompletion}} calllback when it knows there was no work done (https://github.com/wildfly/wildfly-transaction-client/blob/master/src/main/java/org/wildfly/transaction/client/XAOutflowedResources.java#L79). That's good but delisting at the Narayana side (https://github.com/jbosstm/narayana/blob/master/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java#L904) seems  not removing the xa resource from the list (https://github.com/jbosstm/narayana/blob/master/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java#L3719) which defines if 1PC is applied.

*/edit* I found the started discussion at the forum: https://developer.jboss.org/message/982119


was (Author: ochaloup):
[~dmlloyd] a good point, agree and on top of it I can see you already implemented the functionality ;-P

Anyway, if you permit a small side step:
I think it would be a hard to involve your idea about using {{XAResource.end}} call to decide about the resource future. First the {{XAResource}} API is not providing way to return a value back to the caller (https://docs.oracle.com/javaee/7/api/javax/transaction/xa/XAResource.html#end-javax.transaction.xa.Xid-int-). The other issue is the Narayana implementation which calls the {{.end}} just before {{prepare}} call on the each {{XAResource}} (https://github.com/jbosstm/narayana/blob/master/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java#L210). Refactoring the code and moving the {{end}} call to some top-level place where the decision about 1PC/2PC is done (https://github.com/jbosstm/narayana/blob/master/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java#L2168) I consider difficult.

Back to the prior point:
As I was investigating your point I can see that the wfly transactional client delists itself from the current transaction in {{beforeCompletion}} calllback when it knows there was no work done (https://github.com/wildfly/wildfly-transaction-client/blob/master/src/main/java/org/wildfly/transaction/client/XAOutflowedResources.java#L79). That's good but delisting at the Narayana side (https://github.com/jbosstm/narayana/blob/master/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java#L904) seems  not removing the xa resource from the list (https://github.com/jbosstm/narayana/blob/master/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java#L3719) which defines if 1PC is applied.

/edit I found the started discussion at the forum: https://developer.jboss.org/message/982119

> Prevent enlisting additional resources on EJB caller side in case of server side @RequiresNew
> ---------------------------------------------------------------------------------------------
>
>                 Key: WFLY-10258
>                 URL: https://issues.jboss.org/browse/WFLY-10258
>             Project: WildFly
>          Issue Type: Bug
>          Components: EJB, Transactions
>    Affects Versions: 12.0.0.Final
>            Reporter: Jörg Bäsner
>
> Scenario:
> - server-1 (intermediary)
> -- Running standalone profile
> -- Has a remote-outbound-connection pointing at server-2 through server-2's public IP address
> -- Intermediary bean need to lookup the Target bean in server-2 and also inject the {{TransactionManager}}
> -- Intermediary bean need to enlist a _dummy_ XAResource 
> - server-2 (target)
> -- disable {{JBOSS-LOCAL-USER}} auth
> -- Target bean needs to be annotated with {{@REQUIRES_NEW}} (important)
> - Standalone EJB client invokes an intermediary bean server-1, which as a result invokes target  bean on server-2. 
> The _dummy_ XAResource should log in the {{commit}} method whether one-phase optimization is being used like:
> {code}
>     @Override
>     public void commit(Xid arg0, boolean onePhaseOptim) throws XAException {
>         logger.info("-- Committing in the client resource. One-phase optimisation is: " + onePhaseOptim + " --"
>                 + (onePhaseOptim ? "" : " -> TWO-PHASE COMMIT !!!"));
>     }
> {code}
> In this scenario it is expected that the one-phase optimization is being used!



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the jboss-jira mailing list