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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

JIRA jira@apache.org
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: [hidden email]
For additional commands, e-mail: [hidden email]