commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhandari, Makarand" <>
Subject Behavior of GenericObjectPool
Date Wed, 04 May 2005 18:12:15 GMT
I'm trying to use Common Pool in a project. The documentation says that
it uses a FIFO (First In First Out) behavior that makes sure each object
is regularly used (helps preventing time-outs).

In my code, I add a bunch of objects to the pool, then borrow and return
them from/to the pool. When I do this, I keep getting the same object
back every time.

I took a look at the addObjectToPool() code and it says:

if((_maxIdle >= 0) && (_pool.size() >= _maxIdle)) {
   shouldDestroy = true;
} else if(success) {
  _pool.addFirst(new ObjectTimestampPair(obj));

Shouldn't this be _pool.addLast(new ..) ?? addFirst() causes the
returned object to sit at the front of the stack and is returned to you
on the next borrow. I'm trying to do some kind of load balancing among
all the connections in the pool and this throws me off.

I tested it with the addLast() and it worked for me. Am I on the right


PRIVILEGED AND CONFIDENTIAL: This communication, including attachments, is for the exclusive
use of addressee and may contain proprietary, confidential or privileged information. If you
are not the intended recipient, any use, copying, disclosure, dissemination or distribution
is strictly prohibited. If you're not the intended recipient, please notify the sender immediately
by return email and delete this communication and destroy all copies. 
Email containing sensitive information will be sent using ZixMail Secure Messaging.
If you need assistance in accessing a Secure Message, click on the link below
or contact ZixCorp Support at or 888-576-4949.  {WBE}

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

View raw message