users@glassfish.java.net

JCA - cleanup call for ManagedConnection too early?

From: <glassfish_at_javadesktop.org>
Date: Wed, 12 Sep 2007 05:14:38 PDT

Using Glassfish V2 build b58-rc1 I noticed the following:

A ManagedConnection of a JCA Resource Adapter is used within a container managed transaction. The EJB calls close() for the connection. The Resource Adapter sends the CONNECTION_CLOSED event to the application server. Glassfish then first calls end() on the associated XAResource and immediately afterwards cleanup() on the ManagedConnection. After the cleanup() call the ManagedConnection will be returned to the pool and may be used by another EJB.

In my point of view Glassfish should only call cleanup() after commit() or rollback() has been called. Otherwise, in case of an early re-use of the ManagedConnection there may be two transactions open at the same time for one ManagedConnection.

The JCA Spec 1.5 says in Chapter 7.6.5: "After the JTA transaction completes, the application server initiates a cleanup of the physical connection instance by calling ManagedConnection.cleanup method."

In my point of view the transaction completes only after commit()/rollback() has been called.

Clemens
[Message sent by forum member 'ctee' (ctee)]

http://forums.java.net/jive/thread.jspa?messageID=235026