[ 
https://issues.apache.org/jira/browse/SOLR-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656432#action_12656432
 ] 

Kay Kay commented on SOLR-913:
------------------------------

It causes longer time to restart in terms of recreating the heavy Pattern 
object once again. 

There is a difference between keeping a static reference pointing to a live 
object and setting it to null . In the case of the latter - it definitely frees 
up the memory on a good implementation. 

I meant to say  that - if there were to be another piece of code , that 
inadvertently - calls this piece of code  once again by creating additional 
Pattern objects would be suicidal. These are not random starting pain points 
that I am encountering in the startup but rather in the descending order of the 
time from profiling the shutdown / startup process. 

While I believe the concern about static Pattern object is misplaced - we can 
implement a global ResourceMap with Key as String, Object and the users of the 
Resources removing entries from the Map after they are used . This is pretty 
standard across projects in the sense it addresses the issue of duplicate 
creation of resources and the issue of releasing the resources after the last 
use. 

> org/apache/solr/handler/SnapPuller.java  - Expensive Pattern object made 
> static 
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-913
>                 URL: https://issues.apache.org/jira/browse/SOLR-913
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>         Environment: Tomcat 6, JRE 6 
>            Reporter: Kay Kay
>             Fix For: 1.4
>
>         Attachments: SOLR-913.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In the class -  org.apache.solr.handler.SnapPuller - there seems to be an 
> expensive Pattern object created locally in the method 
>   static Integer readInterval(String interval) ; 
> Pattern instances are better created as static objects and reused. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to