commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Nielsen <>
Subject Re: [DBCP] AbandonedTrace - Connection Recovery
Date Wed, 23 Jul 2003 15:45:20 GMT

David Graham wrote:
>>>Using a WeakHashMap might be a good solution.  Connections are
>>>to be closed when they are garbage collected so if a client doesn't
>>>a connection and loses all pointers to it, the pool would lose its
>>>reference to it and the Connection would get gc'd.  This is *much*
>>>than grabbing a connection away from the client application that may
>>>be using it.
>>Using a weak reference for pooled connections which are in use is a good
>>and I am all for it.
>>The only problem is that there is no guarantee when the weak referenced
>>db connection pool object will be GC'd.  That is highly dependent upon
>>how the JVM implements GC.  There is no guarantee that this would
>>abandoned connections from causing the pool to be exhausted.
> That's a valid point but unlikely to happen in a highly loaded server JVM
> that's creating and destroying many objects.  I think it's sufficient to
> say that the pool won't hold onto connections that apps have lost but it's
> up to the apps not to lose them in the first place.

It depends on which generation the connection pool object ends up in.
In this case connection pool objects would end up in the GC generation
which is least often swept for GC.  Most likely these objects would only
get GC'd during a Full GC. Full GC's can happen very infrequently, even
on a heavily loaded server if the JVM is tuned right.


Glenn Nielsen    | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message