My concerned is with the XAResource being involved in more than one transaction since
the MC is placed into the connection pool before the XAResource.end(TMSUCCESS) call.
For example, using the following settings for the -service.xml file:
MinSize = 1
MaxSize = 1
BlockingTimeoutMillis = 5000
IdleTimeoutMinutes = 0
I create in EJB that has a method that simply executes the following steps:
Connection = ConnectionFactory.getConnection(); // CF obtained in ejbCreate
// do interaction stuff
// connection.close();
As part of the connection.close(), the transaction is suspended via
XAResource.end(TMSUSPEND) and the MC is placed in the connection pool.
The log shows the following for the acquisition and closing of a connection:
2004-07-19 01:46:09,131 TRACE
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying new
ManagedConnection: [EMAIL PROTECTED]
2004-07-19 01:46:09,131 TRACE
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Getting connection
from pool [InUse/Available/Max]: [1/1/1]
2004-07-19 01:46:09,131 TRACE [org.jboss.tm.TransactionImpl] enlistResource():
Entered, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//21,
BranchQual=] status=STATUS_ACTIVE
2004-07-19 01:46:09,131 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=1]) entered: [EMAIL PROTECTED]
flags=0
2004-07-19 01:46:09,251 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=1]) leaving: [EMAIL PROTECTED]
flags=0
2004-07-19 01:46:12,516 TRACE [org.jboss.tm.TransactionImpl] delistResource():
Entered, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//21,
BranchQual=] status=STATUS_ACTIVE
2004-07-19 01:46:12,516 TRACE [org.jboss.tm.TransactionImpl] endResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=1]) entered: [EMAIL PROTECTED]
flag=33554432
2004-07-19 01:46:12,596 TRACE [org.jboss.tm.TransactionImpl] endResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=1]) leaving: [EMAIL PROTECTED]
flag=33554432
2004-07-19 01:46:12,596 TRACE
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] putting
ManagedConnection back into pool
IMHO, MC.cleanup should throw an exception here since the transaction, although
suspended, is still active.
Next the transaction is committed, but first XAResource.end(TMSUCCESS) is called. The
XAResource.end(TMSUCCESS) is blocked waiting for an I/O to complete, thus the
transaction never leaves the active state. The RA sees the xid as
0100000101100155534d562d42524f574e534b2f2f323131.
The log shows the following:
2004-07-19 01:46:12,666 TRACE [org.jboss.tm.TransactionImpl] Committing,
tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=],
status=STATUS_ACTIVE
2004-07-19 01:46:12,666 TRACE [org.jboss.tm.TransactionImpl] Before completion done,
tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=],
status=STATUS_ACTIVE
2004-07-19 01:46:12,666 TRACE [org.jboss.tm.TransactionImpl] endresources(0): state=2
2004-07-19 01:46:12,666 TRACE [org.jboss.tm.TransactionImpl] endResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//21, BranchQual=1]) entered: [EMAIL PROTECTED]
flag=67108864
Now, a second client invokes the EJB. The MC whose XAResource is already involved with
an active transaction is pulled from the connection pool.
The log shows the following:
2004-07-19 01:48:45,206 DEBUG [org.apache.tomcat.util.threads.ThreadPool] Getting new
thread data
2004-07-19 01:48:45,206 TRACE [org.jboss.tm.TransactionImpl] Created new instance for
tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//23, BranchQual=]
2004-07-19 01:48:45,206 TRACE [org.jboss.tm.TxManager] began tx:
TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//23, BranchQual=]
2004-07-19 01:48:45,216 TRACE
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying
ManagedConnection from pool: [EMAIL PROTECTED]
2004-07-19 01:48:45,216 TRACE
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Getting connection
from pool [InUse/Available/Max]: [1/1/1]
A new transaction is started on the MCÂs associated XAResource, the same XAResource
that has a thread blocked in XAResource.end(TMSUCCESS). The RA sees the xid as
0100000101100155534d562d42524f574e534b2f2f323331
The log shows the following:
2004-07-19 01:48:45,216 TRACE [org.jboss.tm.TransactionImpl] enlistResource():
Entered, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=USMV-BROWNSK//23,
BranchQual=] status=STATUS_ACTIVE
2004-07-19 01:48:45,216 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//23, BranchQual=1]) entered: [EMAIL PROTECTED]
flags=0
2004-07-19 01:48:45,316 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl
[FormatId=257, GlobalId=USMV-BROWNSK//23, BranchQual=1]) leaving: [EMAIL PROTECTED]
flags=0
At this point, the RA can only throw an exception back to the TM, since the XAResource
is already associated with an active transaction.
Once the MC is placed back into the pool and because the MC has to maintain a 1-1
relationship with the XAResource (that is, MC.getXAResource must return the same
XAResource instance), calling XAResource.end(TMSUCCESS) at this point can lead to the
XAResource being involved in more than one transaction.
As for the <track-connection-by-tx> attribute: it does work, but it is not compliant
with the JCA specification
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3842611#3842611
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3842611
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user