commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Speh <rws...@yahoo.com>
Subject RE: DBCP and Exceptions
Date Tue, 22 Jan 2002 15:10:58 GMT
I guess I put in my vote for checked Exceptions.

Randy Speh

--- "Waldhoff, Rodney" <rwaldhof@us.britannica.com>
wrote:
> From the perspective of commons-pool, it seemed like
> in the general case the
> need to throw Exceptions was rare, so it was better
> to use RuntimeException
> than force all clients to all pools to use
> extraneous try/catch blocks. (Of
> course in ensuring that the objects are returned to
> the pool, we'll often
> require a try/catch anyway, so maybe they aren't
> extraneous.)
> 
> Something like DBCP is a signficant case where
> "throws Exception" would be
> helpful.  The current impl, throwing
> RuntimeException when ConnectionFactory
> recieves a SQLException is really a hack.  Changing
> pool to allow Exception
> would be one solution, as perhaps would be throwing
> some sort of
> SQLExceptionWrapper (extends RuntimeException)
> having that pass
> transparently through the pool, and picking it up in
> PoolingDriver/PoolingDataSource.
> 
> Curiously, I'll note that most of the time the need
> to throw checked
> Exceptions is tied to the PoolableObjectFactory more
> than to the ObjectPool
> implementation.  I wonder if in these cases there's
> generally an object
> containing/wrapping the ObjectPool as well, as there
> is in DBCP, in which
> case the generally strategy of wrapping Exception in
> a RuntimeException in
> the factory, and then unwrapping it just above
> ObjectPool may be
> appropriate.
> 
> If everyone else feels like pool should throw
> checked Exceptions, I wouldn't
> be opposed to it. Indeed, I may have talked myself
> into it in writing this
> email.
> 
>  - Rod
> 
> -----Original Message-----
> From: Randy Speh
> To: commons-dev@jakarta.apache.org
> Sent: 1/18/02 8:16 AM
> Subject: DBCP and Exceptions
> 
> Could someone please tell me why none of the
> interfaces in the org.apache.commons.pool declare
> that
> they can throw and Exception.  When the
> DriverConnectionFactory has an error getting a
> connection it throws a RuntimeException.
> 
> Thank you,
> Randy Speh
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message