commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [pool] should addObject return a boolean?
Date Wed, 21 Sep 2011 04:09:35 GMT
On 9/20/11 8:24 PM, Gary Gregory wrote:
> That sounds reasonable.
>
> Would any call sites prefer an exception. Checked or unchecked?

I suppose in some cases some clients / pool implementations might
want to throw IllegalStateException if an attempt is made to add to
a pool at capacity, but there are others (including internal to GOP,
GKOP) where it is more convenient for it to be a no-op.  Checking a
boolean return or just allowing the no-op is lighter weight than
catching an exception, so the boolean return is probably better. 
Implementations that want to throw can document and throw unchecked
exceptions (e.g. ISE) and clients can also throw on the false return
if they want.

Phil
>
> Gary
>
> On Tue, Sep 20, 2011 at 10:53 PM, Phil Steitz <phil.steitz@gmail.com> wrote:
>
>> When GKOP or GOP pools lack capacity, addObject does nothing.  In
>> some cases (I am dealing with one now internally to GKOP), it would
>> be good to know if an instance was actually added or not.  How about
>> changing the interface (both OP and KOP versions) to return a
>> boolean with true indicating that a new instance was actually
>> created and added to the pool?
>>
>> Phil
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>


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


Mime
View raw message