I'm having a little trouble understanding exactly what the spec requires with regards to connection association.
I think that the following is supposed to be a requirement: scenario: mc1 is a ManagedConnection from ManagedConnectionFactory mcf Object c = mc.getConnection(subject, cri) c is not "closed" by the application component (i.e., if it is a javax.resource.cci.Connection, the application component did not call close() on it). App server calls mc.cleanup(), so now c can not be used to do any work on the EIS. mc2 is another ManagedConnection, also from mcf. App server calls mc.associateConnection(c) I think this call should succeed and that c can then be used to do work on the EIS through mc2. ----------- Arguments against: spec p 32, section 5.5.4 The method ManagedConnection.cleanup initiates a cleanup of any client-specific state maintained by a ManagedConnection instance. The cleanup is required to invalidate all con- nection handles created using this ManagedConnection instance. Any attempt by an applica-tion component to use associated connection handle after cleanup of the underlying ManagedConnection should result in an exception. (This does not specify that the now-invalid connection handle may be resuscitated by associating it with a different ManagedConnection). ---------------- Arguments for: spec p. 76, section 6.10.3 * When the business method invocation on the EJB A instance completes successfully without any application error, the container starts the completion protocol for the local transaction. The container calls the LocalTransaction.commit method to commit the transaction. * After the local transaction completes, the container initiates a cleanup (now there is no active local transaction) of the physical connection instance by calling ManagedConnection.cleanup method. Note: The container should initiate cleanup of the ManagedConnection instance in the case where EJB A does not call close on the connection handle before returning. The container identifies this need for cleanup of ManagedConnection based on the scope of connection sharing. * On the cleanup method invocation, the ManagedConnection instance does a cleanup of its local transaction related state and resets itself to a default state. * The container returns the physical connection to the pool for handling subsequent connection requests. spec p.77, section 6.11 In this scenario, entity bean C instance obtains an application-level connection handle (using the method getConnection on the ConnectionFactory) during its creation. Entity bean C in- stance holds the connection handle during its lifetime. Even without the scenario in section 6.11 involving 3 ejbs, I believe this requires the following sequence of events: ejb C created, gets a connection handle c. It stores it in an instance variable during its lifetime. This is initially associated with ManagedConnection mc1. Method called on C, on its return container must call mc1.cleanup(), according to section 6.10.3. According to the description of cleanup(), c is now invalid. Method called again on C. Section 6.11 implicitly assumes that the call should succeed, which obviously means that c is no longer invalid. Therefore, I believe the container must associate c with some appropriate managed connection, say mc2, before control is passed to the method implementation in C. --------------- Conclusion: I think it would be more accurate to specify in section 5.5.4 The method ManagedConnection.cleanup initiates a cleanup of any client-specific state maintained by a ManagedConnection instance. The cleanup is required to invalidate all con- nection handles created using this ManagedConnection instance. Invalid connection handles may be restored to usability by associating them with appropriate ManagedConnection instances by calling the ManagedConnection associateConnection(Object connection) method. Any attempt by an applica-tion component to use associated connection handle after cleanup of the underlying ManagedConnection and before re-association with a ManagedConnection instance should result in an exception. Am I correct? Thanks David Jencks _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
