|
From: Rod J. <ro...@in...> - 2004-11-03 10:55:24
|
Rainer
Why do you say "without success"? Getting back the same object isn't necessarily an error.
This is actually hard to test. Returning the same instance in successive calls is perfectly legitimate as long as there
is no blocking. Perhaps I should strengthen the tests using two threads, but of course the behaviour will still depend
on the underlying pool instance.
If you look at the Commons PoolTargetSource implementation, getTarget() is as follows:
public Object getTarget() throws Exception {
return this.pool.borrowObject();
}
Thus it defers whether it's the same or another object to the pool implementation: Spring isn't caching the object.
Rgds
Rod
Rainer Schmitz wrote:
> Aloha!
>
> I tried to use CommonsPoolTargetSource without success - calling
> beanFactory.getBean() always returns the same instance.
>
> I looked into CommonsPoolTargetSourceTests and as far as I can see it's
> not tested wether the pool is returning new objects or is working at
> all. Inspecting the objects returned by getBean() in testFunctionality()
> with a debugger shows both calls return the same SideEffectBean instance.
>
> Is this feature broken or am I missing something?
>
> Cheers,
> Rainer
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
--
____________________________________________________
Rod Johnson
Interface21 - Spring Services from the Source
http://www.springframework.com
Founder, Spring Framework:
http://www.springframework.org
Author, "Expert One-on-One J2EE Development Without EJB"
(May 2004, with Juergen Hoeller).
http://www.amazon.com/exec/obidos/ASIN/0764558315/
Author, "Expert One-on-One J2EE Design and Development"
(October 2002).
http://www.amazon.com/exec/obidos/tg/detail/-/0764543857/
____________________________________________________
Interface21 Limited
Registered Office Summit House, 2-2a Highfield Road, Dartford, Kent DA1 2JY
Registered in England and Wales No. 5187766
____________________________________________________
|