You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael Braun (JIRA)" <ji...@apache.org> on 2018/02/13 18:44:00 UTC

[jira] [Created] (SOLR-11980) SolrCore should not lock over non-final member variable

Michael Braun created SOLR-11980:
------------------------------------

             Summary: SolrCore should not lock over non-final member variable
                 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


[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.



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

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