You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ian Petzer <I....@syzygy.net> on 2004/05/17 12:10:22 UTC

Is the commons pool threadsafe

Hello All

I trawled through the mail-archives about this issue but could not come up
with a conclusive answer.

My question is:
Is access to the GenericObjectPool thread safe? Can I have multiple objects
calling borrowObject() and returnObject() at the same time or do I need to
synchronise access to it?

Thanks
Ian

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


Re: Is the commons pool threadsafe

Posted by Dirk Verbeeck <di...@pandora.be>.
Yes, GenericObjectPool is thread safe, you don't have to synchronise.

You might want to make sure your PoolableObjectFactory is thread safe.
Concurrent pool.borrowObject() method calls are able to call the 
PoolableObjectFactory methods at the same time.

Cheers
Dirk

Ian Petzer wrote:
> Hello All
> 
> I trawled through the mail-archives about this issue but could not come up
> with a conclusive answer.
> 
> My question is:
> Is access to the GenericObjectPool thread safe? Can I have multiple objects
> calling borrowObject() and returnObject() at the same time or do I need to
> synchronise access to it?
> 
> Thanks
> Ian



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