On Jan 11, 2009, at 4:58 AM, Asiri Rathnayake wrote:

> Hi Sergiu,
>
> On Sun, Jan 11, 2009 at 8:41 AM, Sergiu Dumitriu <[email protected]>  
> wrote:
>
>> asiri (SVN) wrote:
>>> Author: asiri
>>> Date: 2009-01-10 19:37:55 +0100 (Sat, 10 Jan 2009)
>>> New Revision: 15292
>>>
>>> Added:
>>>
>> platform/core/trunk/xwiki-officeimporter/src/main/java/org/xwiki/ 
>> officeimporter/internal/OfficeImporterVelocityBridge.java
>>> Modified:
>>>
>> platform/core/trunk/xwiki-officeimporter/src/main/java/org/xwiki/ 
>> officeimporter/OfficeImporter.java
>>>
>> platform/core/trunk/xwiki-officeimporter/src/main/java/org/xwiki/ 
>> officeimporter/internal/OfficeImporterVelocityContextInitializer.java
>>>
>> platform/core/trunk/xwiki-officeimporter/src/main/resources/META- 
>> INF/plexus/components.xml
>>>
>> platform/xwiki-applications/trunk/officeimporter/src/main/resources/ 
>> Import/Importer.xml
>>> Log:
>>> XWIKI-3083: Develop the initial feature set for the Office Importer
>> module
>>>
>>> * Added error reporting support.
>>> * Error messages need to be improved.
>>>
>>> Modified:
>> platform/core/trunk/xwiki-officeimporter/src/main/resources/META- 
>> INF/plexus/components.xml
>>> ===================================================================
>>> ---
>> platform/core/trunk/xwiki-officeimporter/src/main/resources/META- 
>> INF/plexus/components.xml
>>       2009-01-10 17:42:24 UTC (rev 15291)
>>> +++
>> platform/core/trunk/xwiki-officeimporter/src/main/resources/META- 
>> INF/plexus/components.xml
>>       2009-01-10 18:37:55 UTC (rev 15292)
>>> @@ -96,6 +96,7 @@
>>>           <role-hint>htmltopresentation</role-hint>
>>>           <field-name>htmlToPresentationTransformer</field-name>
>>>         </requirement>
>>> +        <instantiation-strategy>singleton</instantiation-strategy>
>>>       </requirements>
>>>     </component>
>>>     <!-- Velocity -->
>>> @@ -104,7 +105,7 @@
>>>       <role-hint>officeimporter</role-hint>
>>>
>> < 
>> implementation 
>> > 
>> org 
>> .xwiki 
>> .officeimporter.internal.OfficeImporterVelocityContextInitializer
>>>       </implementation>
>>> -      <instantiation-strategy>singleton</instantiation-strategy>
>>> +      <instantiation-strategy>per-lookup</instantiation-strategy>
>>
>> No, you should leave it as a singleton, since the context initializer
>> does not hold any state. It will be invoked manually for each  
>> request by
>> another component in the velocity module.
>>
>
> So the initialize() method is invoked on every request, got it.

And you should almost never use per-lookup, it's just too dangerous.  
Fo rex here you've introduced a memory leak since you're not releasing  
each component that is instantiated...

>
>
> Thanks.
>
> - Asiri
>
>
>>
>>>       <requirements>
>>>         <requirement>
>>>           <role>org.xwiki.officeimporter.OfficeImporter</role>

Thanks
-Vincent
http://xwiki.com
http://xwiki.org
http://massol.net






_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to