I think the pool 2 behavior will meet your needs but I'll let the code
speak for itself as it should be unambigous.

Take a look at the TestObjectPool.testClosedPoolBehavior() test (about
45% down the file) and let me know if a pool that passes that test
meets your needs. Here's a link to the trunk version of that file:
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java?view=markup

On 3/23/06, Gary Gregory <[EMAIL PROTECTED]> wrote:
> Sandy:
>
> I am looking for a way to query the pool for its open/close state.
>
> Background: for those who care ;)
>
> When our app server shuts down, we have a couple of threads that need to
> shutdown and clean up their resources. It so happens (don't ask) that
> more than one thread may want to close() the pool.
>
> When you call close() a second time (or more), you get an exception.
> Alternatively, close() could be quiet, a no-op, if the pool is already
> closed.
>
> Right now, I have a subclass (hack) which implements an isOpen() method
> which calls super.isClosed(). This is not what I want to do. Ideally,
> I'd like to wrap the GenericObjectPool instance and not subclass it, but
> that's another topic for our app.
>
> Thanks,
> Gary
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
> Sandy
> > McArthur
> > Sent: Thursday, March 23, 2006 8:10 PM
> > To: Jakarta Commons Developers List
> > Subject: Re: [pool] BaseObjectPool.isClosed() visibility [was:
> Announcing
> > Release Candidate 2 for Pool 1.3]
> >
> > On 3/23/06, Gary Gregory <[EMAIL PROTECTED]> wrote:
> > > This build works fine with our application.
> > >
> > > My only wish would be to make BaseObjectPool.isClosed() public.
> >
> > Gary, are you really wanting a way to test if the pool is closed or do
> > you want the returnObject and invalidateObject methods to be more
> > graceful and accept objects borrowed from before the pool was closed?
> >
> > The code in the trunk for pool 2 only throws IllegalStateExceptions
> > for the addObject and the borrowObject methods after close has been
> > called. The other methods will still seem to function normally but
> > really they are in a shutdown mode and just dispose of returned
> > objects.

--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to