[jboss-dev-forums] [Design of JCA on JBoss] - Connection Sharing

smcgowan@redhat.com do-not-reply at jboss.com
Thu Jan 17 16:47:23 EST 2008


I've been looking at an issue which is consistent with the LocalTransaction scenario described in the Connector Specification (7.10.3).  In this scenario, two EJBs get a connection to the same resource manager in asingle transaction.
EJB ==> Stateful Bean-Managed Bean using JTA to demarcate TX
EJB1 ==> Stateful Container-Managed Bean with TX_REQUIRED attribute for business methods
EJB2 ==> Stateful Container-Managed Bean with TX_REQUIRE attribute for business methods

>From EJB, the first ut.begin is called.
Method calls in EJB1 are performed to get a connection and delete any
rows found in the table in preparation for the test.
>From EJB, ut.commit is called.

>From EJB, a second ut.begin call is made.

a method call to EJB1.insert() is called where a connection is made to insert the row.  From within this same method, a call to EJB2 dbConnect method is made.  In this dbConnect method, another call to ds.getConnection() is performed.  When ds.getConnection() is called,  a new ManagedConnection is created resulting in two InUse connections and an attempt enlist the TX fails as multiple last resources is disallowed.  The TX is aborted and marked for rollback. The resources are marked Shareable in the resource-ref elements of each EJB.  Therefore, I expected that the connection handle for the same ManagedConnection instance used for handling the connection request for EJB1 would be provided by the container thus retaining the association of the local transaction context between EJB1 and EJ2 method calls.Can you confirm that should be the case with the latest version of JBoss AS 5.0.0.Beta3/4?  


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121117#4121117

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121117



More information about the jboss-dev-forums mailing list