[Objectbridge-developers] Re: ConnectionManager
Brought to you by:
thma
From: Thomas M. <tho...@ho...> - 2001-09-23 09:01:54
|
Hi Satish, sa...@na... wrote: > > Hi Thomas, > > I have been noticing that lots of JDBC connections were getting > created for simple queries using the same broker instance. > > Then I noticed that new ConnectionManager > instances were getting created for each query using the same broker > instance. I inserted some debug statements and I think I might be > seeing a bug. > > Basically, since the connectionTable is empty for a new ConnectionManager > (created in StatementsForClass), getNewConnection is called in > ConnectionManager. Also curious is why the connectionManager object in > PersistenceBroker was not being used? > > I haven't had the time to put together a simple case that you can use. > But, if you need, I will do so. > > Please let me know. > > If you do have a fix for this, can you mail it to me since I need to get > this software out as soon as possible. > Yes, this is definitely a bug. Sascha reported it some days ago and I already prepared a fix. As I did a lot of other internal changes in the meantime that won't be compatible to your sources I can't send you the patched files. But fortunately it's not difficult to do: 1. provide PersistenceBrokerImpl with a public method getConnectionManager(): public ConnectionManager getConnectionManager() { return m_ConnectionManager; } 2. in the StamentsForClass constructor change the line ConnectionManager manager = new ConnectionManager(broker); to: ConnectionManager manager = broker.getConnectionManager(); 3. That's it! > Also, did you get a chance to look at my previous email regarding > mysql wait_timeouts on idle connections and hence you can be left with > stale connections in the pool (the server pool). > Yes, but it's not easy to simulate this behaviour with instantdb. I assume that the method java.sql.Connection.isClosed() will return true or throws an SQLException in this case. I will write some code that will use isClosed() to check if the connection is still valid and will acquire a fresh one if necessary. The fix will be in the next release. (by the end of the week) HTH, Thomas > Thanks for all your help, > Satish. > > -- > Get your firstname@lastname email for FREE at http://Nameplanet.com/?su |