commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [pool] should addObject return a boolean?
Date Wed, 21 Sep 2011 04:41:15 GMT
On Wed, Sep 21, 2011 at 12:09 AM, Phil Steitz <phil.steitz@gmail.com> wrote:

> 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.
>

Well, it sounds like the KISS solution is the boolean. I'd say go for that
until something better is needed.

Gary


> 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
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message