You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Henrik Vendelbo <hv...@bluprints.com> on 2003/11/03 19:09:26 UTC
[pool] Keyey pool usage
Browsing the mailing-list archive made me wonder if the pools are inteded
for the use I seek.
I have information stored in a database, and want to retrieve it as rarely
as possible.
When I need a piece of information I want to borrow it from the pool and
return it when I am done with it.
I may borrow the same object multiple times and obtain the same object, be
it in parallel or sequentially.
Suppose I do the following :
Object o1 = borrowObject("somename");
Object o2 = borrowObject("somename");
Object o3 = borrowObject("somename");
returnObject(o1);
returnObject(o2);
returnObject(o3);
will the three objects be the same ?
Object o1 = borrowObject("somename");
returnObject(o1);
Object o2 = borrowObject("somename");
returnObject(o2);
will o1 == o2 ?
Henrik
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [pool] Keyey pool usage
Posted by Dirk Verbeeck <di...@pandora.be>.
See inline for answers but I suspect you really need a cache and not a pool.
related question/answer:
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=commons-user@jakarta.apache.org&msgNo=2693
-- Dirk
Henrik Vendelbo wrote:
> Browsing the mailing-list archive made me wonder if the pools are inteded
> for the use I seek.
>
> I have information stored in a database, and want to retrieve it as rarely
> as possible.
>
> When I need a piece of information I want to borrow it from the pool and
> return it when I am done with it.
>
> I may borrow the same object multiple times and obtain the same object, be
> it in parallel or sequentially.
>
> Suppose I do the following :
>
> Object o1 = borrowObject("somename");
> Object o2 = borrowObject("somename");
> Object o3 = borrowObject("somename");
> returnObject(o1);
> returnObject(o2);
> returnObject(o3);
>
> will the three objects be the same ?
no
> Object o1 = borrowObject("somename");
> returnObject(o1);
> Object o2 = borrowObject("somename");
> returnObject(o2);
>
> will o1 == o2 ?
not guarantied, but probably yes
> Henrik
Dirk
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org