On Jul 29, 2008, at 11:10 PM, Artem Melentyev wrote:
Vincent Massol wrote:
Hi Artem,
On Jul 29, 2008, at 8:52 PM, amelentev (SVN) wrote:
Author: amelentev Date: 2008-07-29 20:52:51 +0200 (Tue, 29 Jul 2008) New Revision: 11561
Modified: platform/core/trunk/xwiki-core/src/main/resources/META-INF/plexus/ components.xml Log: XWIKI-2444: QueryManager in Store set instantiation-strategy to per-lookup for prevent sharing of query objects.
We shouldn't do this IMO. Using a per lookup strategy with components is very very dangerous (I've experienced it several times). The problem is that you need to explicitely remove the components as otherwise you're creating a memory leak.
But how we should do instead? Queries are not reuseable. So we can't use Queries as components?
Plexus keeps an internal reference to these per lookup components so they're not released automatically. Personally I've been trying to stay away from per lookup component and use only POJOs. I'm fine if you want to keep it as a component but you *must* be absolutely sure that you release them using componentManager.remove() when they're not used anymore. Thanks -Vincent