commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom <>
Subject Re: [POOL] a conceptual implementation error?
Date Tue, 21 Nov 2006 06:52:55 GMT

> This is a nonsensical PoolableObjectFactory. 

> Pools are designed so that they lazily create poolable objects as
> needed via the makeObject method. 

> Using a pool without a PoolableObjectFactory is *strongly
> discouraged*. 

I have a pool of 4 services. Every time a task needs to be performed, I 
borrow one service from the pool, have it execute the task, and return 
it. This seems to me as being a sensible pool.

Since using a factory is preferred, I have a collection based factory in 
which makeObject removes one from the collection and hands it over to 
the pool. There is no lazy creation here. When requesting a 5th service 
in this scenario, Apache's Stack makes the CPU go to 100%, Generic 
returns null. This is just as it is, I am sorry or maybe show me how to 
implement this better. Preferred behaviour would be that the process 
waits until a service becomes available.

I have tried to clearly explain why I feel there is a conceptual bug (I 
feel an implementation should not be able to go into an endless loop 
this easily). I understand that the currently implementation is 
perfectly suited for infinite (lazily create) pools. I have also shown 
IMHO that when the implementation is used for non infinite pools (and 
they do exist), they are buggy.

So, there is no pun intended here, and the current implementation has 
worked for our infinite pools perfectly for years. But I need an finite 
pool and have implemented both a round robin and a stack that works both 
in the lazy create and in the finite mode. It is up to the Apache 
developers to check and see if there is merit to my point and if you are 
interested in this alternative and would like to take a peek at the 
source. Or not. For me, my problem is solved.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message