You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Michael McKibben <hi...@hihat.net> on 2002/01/08 22:26:37 UTC

Recyclable question

How does a Recyclable object invalidate itself with the pool if for some
reason the component cannot be restored to its original state? The recycle
method does not allow for an exception to be thrown while being placed
back into the pool. Should I throw a RuntimeException here?

Regards,

--mike


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Recyclable question

Posted by Berin Loritsch <bl...@apache.org>.
Michael McKibben wrote:

> How does a Recyclable object invalidate itself with the pool if for some
> reason the component cannot be restored to its original state? The recycle
> method does not allow for an exception to be thrown while being placed
> back into the pool. Should I throw a RuntimeException here?


That need has never been raised before.

A RuntimeException is dangerous in that if your object is used with a pool
that does not check for the RuntimeException, it will be passed to the
application.  That could cause some unpredictable issues that you would
rather avoid.


Look at the solution I came up with for the JdbcConnectionPool.



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>