> I started doing a little testing on the Tyrex pools on my local machine, > and it doesn't appear to actually be pooling the connections. In a 1 > minute period, I managed to get 118 hits (none of the connection lasted > for the entire minute - they lasted at most 5 seconds) and I checked my > outgoing connections, and had 128 (I'm assuming my stress-tester didn't > count 10 connections that were active when I told it to stop.) > > Anyhow, the point is, every time I request a connection from the pool, > I'm getting a brand new connection - not a recycled one. I'm calling > close() on the connection in a finally block (and it is getting called). > Is there something else I have to do on the DataSource to ensure that > the connection gets recycled properly? Or am I missing some > configuration in my server.xml?
The JNDI implementation of Catalina doesn't rebind after the lookup. So it you do 200 lookups, you'll get 200 different data source instances. I was unsure if it was a good idea to rebind resolved objects (for example, Tyrex JNDI implementation doesn't), so I didn't do it. Instead, I would retrieve the DataSource in the init() method of the servlet, and put it in an instance variable. Remy