commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhandari, Makarand" <MBhand...@WebsterBank.com>
Subject Behavior of GenericObjectPool
Date Wed, 04 May 2005 18:12:15 GMT
Folks,
 
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
track?

Thanks,
Mak.







**********************************************************************
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 http://www.zixit.com/support/zixmailnethelp.htm#4.0
or contact ZixCorp Support at support@zixcorp.com or 888-576-4949.  {WBE}
**********************************************************************


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


Mime
View raw message