|
From: Juergen H. <ju...@in...> - 2005-06-17 09:00:22
|
The purpose of SimpleConnectionHandle is to hold an existing Connection reference. We can't close that reference in "releaseConnection", because "releaseConnection" is gonna be called once per "getConnection" call. So if the SimpleConnectionHandle will be access multiple times, it's always gonna return the same Connection, and we can't close until the original creator of the handle (who also supplied the Connection) decides to shut the handle down. For an alternative implementation of ConnectionHandle, have a look at DefaultJdoDialect's DataStoreConnectionHandle: this illustrates how a handle can behave that fetches a fresh Connection for every "getConnection" call and consequently also closes the Connection for every "releaseConnection" call. In that particular, it uses JDO 2.0's Connection "borrowing", where the Connection needs to be returned to the PersistenceManager immediately after each operation; else the PersistenceManager would complain that we didn't return the Connection. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Marc Logemann Sent: Thursday, June 16, 2005 10:43 PM To: spr...@li... Subject: [Springframework-developer] SimpleConnectionHandle Hi, is there a reason that SimpleConnectionHandle does not supply a default releaseConnection implementation? I wonder why releaseConnection() cant simply close the Connection it got upon creation. Instead people tend to close the connection in JDODialect childs in method releaseJdbcConnection() by getting the connection from the handle and close it there. -- regards Marc Logemann [blog] http://www.logemann.org [busn] http://www.logentis.de ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |