You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Tony Seebregts <to...@cibecs.com> on 2005/08/17 08:14:24 UTC

Re. PooledConnection being closed (Part 2)

Thanks Knut,

Figured out some of this about 30 minutes after posting the question but 
your explanation clears thing up a lot.

regards

Tony Seebregts

>
> Subject:
> Re: Re. PooledConnection being closed
> From:
> Knut Anders Hatlen <Kn...@Sun.COM>
> Date:
> Mon, 15 Aug 2005 18:44:41 +0200
> To:
> Derby Discussion <de...@db.apache.org>
>
> To:
> Derby Discussion <de...@db.apache.org>
>
>
>Tony Seebregts <to...@cibecs.com> writes:
>
>  
>
>>Ok, thanks Knut - my misunderstanding.
>>
>>I understood the ConnectionPoolDataSource as merely facilitating
>>connection pooling. If it manages the actual pooling though, is
>>there any point in handling the ConnectionEvents ? Other than for
>>monitoring/interest ...
>>    
>>
>
>The ConnectionPoolDataSource doesn't manage the connection pool. It is
>just an instrument which is used by a connection pool manager. A
>ConnectionPoolDataSource can create PooledConnection objects, but
>since each PooledConnection can have only one open Connection object
>at a time, you'll probably need more than one PooledConnection object,
>and the need for a pool manager emerges.
>
>A typical connection pool manager has a getConnection() method which
>checks whether there is an unused PooledConnection in the pool. If
>there is one, PooledConnection.getConnection() is called, otherwise a
>new PooledConnection is created and its getConnection() is called. In
>addition the manager has to make sure that the pool doesn't become too
>big, that invalid PooledConnection objects are removed from the pool,
>etc. That's where the ConnectionEvent handlers come into use. The
>connectionClosed() method marks a PooledConnection as unused, and
>removes it from the pool if the pool has become too big. The
>connectionErrorOccurred() removes an invalid PooledConnection from the
>pool.
>  
>