[ 
https://issues.apache.org/jira/browse/SOLR-11980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Braun updated SOLR-11980:
---------------------------------
    Description: 
[https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/core/SolrCore.java#L329]
 : 


Example:
{code:java}
public String getIndexDir() {
synchronized (searcherLock) {
  if (_searcher == null) return getNewIndexDir();
  SolrIndexSearcher searcher = _searcher.get();
  return searcher.getPath() == null ? dataDir + "index/" : searcher
  .getPath();
  }
}
{code}

Instance members that are locked over should be final. In this case, the field 
is searcherLock. 

This patch not only covers searcherLock but other private variables that can 
easily be final.

  was:
[https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/core/SolrCore.java#L329]
 : 


Example:
{code:java}
public String getIndexDir() {
synchronized (searcherLock) {
  if (_searcher == null) return getNewIndexDir();
  SolrIndexSearcher searcher = _searcher.get();
  return searcher.getPath() == null ? dataDir + "index/" : searcher
  .getPath();
  }
}
{code}

Instance members that are locked over should be final. In this case, the field 
is searcherLock. 

Side note but there are a number of other fields in the class that could be 
made final.


> SolrCore should not lock over non-final member variable, add final to more 
> vars
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-11980
>                 URL: https://issues.apache.org/jira/browse/SOLR-11980
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Michael Braun
>            Priority: Minor
>         Attachments: SOLR-11980.patch
>
>
> [https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/core/SolrCore.java#L329]
>  : 
> Example:
> {code:java}
> public String getIndexDir() {
> synchronized (searcherLock) {
>   if (_searcher == null) return getNewIndexDir();
>   SolrIndexSearcher searcher = _searcher.get();
>   return searcher.getPath() == null ? dataDir + "index/" : searcher
>   .getPath();
>   }
> }
> {code}
> Instance members that are locked over should be final. In this case, the 
> field is searcherLock. 
> This patch not only covers searcherLock but other private variables that can 
> easily be final.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to