I have cross checked the observed behavior found in glassfish with the JCA 1.5 spec.
Section 7.6.5 describes the "Connection Close and JTA cleanup" scenario which includes the following:
On receiving the connection close notification, the application server performs
transactional cleanup for the ManagedConnection instance. If the
ManagedConnection instance was participating in a transaction manager enlisted
JTA transaction, the application server takes the following steps:
1) The application server dissociates the XAResource instance, corresponding to
the ManagedConnection instance, from the transaction manager using the
method Transaction.delistResource.
2) The transaction manager calls XAResource.end(Xid, flag) to inform the
resource manager that any further operations on the ManagedConnection
instance are no longer associated with the transaction, represented by the Xid
passed in XAResource.end call. This method invocation dissociates the
transaction from the resource manager instance.
[b]After[/b] the JTA transaction completes, the application server initiates a cleanup of
the physical connection instance by calling ManagedConnection.cleanup
method. After calling the method cleanup on the ManagedConnection instance,
the application server returns the ManagedConnection instance to the
connection pool.
The point to consider here is that according to the spec the app server must call the [i]ManagedConnection.cleanup[/i] method [b]after[/b] the transaction has completed and must [b]afterwards[/b] return the connection to the pool.
Glassfish however seems to not only not care about whether the transaction has completed yet but also returns the connection to the pool [b]before[/b] the invocation of the cleanup method, right?
Kai
[Message sent by forum member 'hudalla' (hudalla)]
http://forums.java.net/jive/thread.jspa?messageID=263902