I still think destroy should be called at some point. The jca spec states this is when the resource adapter can destroy physical connections and reclaim system resources...
"An application server should explicitly call ManagedConnection.destroy to destroy a physical connection. An application server should destroy a physical connection to manage the size of its connection pool and to reclaim system resources." The cleanup method should be called when all handles associated with a ManagedConnection are closed and the ManagedConnection can be placed back into the connection pool. I've pasted the relevent section below. I'm a noob at this so am happy to be told otherwise. 6.5.4.4 Cleanup of ManagedConnection A resource adapter typically allocates system resources (outside a JVM instance) for a ManagedConnection instance. Additionally, a ManagedConnection instance can have state specific to a client, such as security context, data/function access structures, and result set from a query. The method ManagedConnection.cleanup initiates a cleanup of any client-specific state maintained by a ManagedConnection instance. The cleanup must invalidate all connection handles created using the ManagedConnection instance. Any attempt by an application component to use the associated connection handle after cleanup of the underlying ManagedConnection should result in an exception. The container always drives the cleanup of a ManagedConnection instance. The container keeps track of created connection handles in an implementation specific mechanism. It invokes ManagedConnection.cleanup when it has to invalidate all connection handles associated with this ManagedConnection instance and put the ManagedConnection instance back in to the pool. This may be called after the end of a connection sharing scope or when the last associated connection handle is closed for a ManagedConnection instance. The invocation of the ManagedConnection.cleanup method on an already cleaned-up connection should not throw an exception. The cleanup of a ManagedConnection instance resets its client-specific state and prepares the connection to be put back into a connection pool. The cleanup method should not cause the resource adapter to close the physical pipe and reclaim system resources associated with the physical connection. "An application server should explicitly call ManagedConnection.destroy to destroy a physical connection. An application server should destroy a physical connection to manage the size of its connection pool and to reclaim system resources." A resource adapter should destroy all allocated system resources for this ManagedConnection instance when the method destroy is called. -- View this message in context: http://openejb.979440.n4.nabble.com/openejb-not-destroying-ManagedConnections-on-shutdown-tp4658799p4658814.html Sent from the OpenEJB User mailing list archive at Nabble.com.