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

Gregory Chanan commented on SOLR-6747:
--------------------------------------

{code}
NamedList cachedStats = this.cachedDynamicStats;
NamedList stats;
 if (useCachedStatsBetweenGetMBeanInfoCalls && cachedStats != null) {
  stats = cachedStats;
} else {
  stats = infoBean.getStatistics();
}
{code}

small optimization, but maybe better to avoid reading the volatile value if 
useCachedStatsBetweenGetMBeanInfoCalls is false?
i.e.
{code}
NamedList stats;
if (useCachedStatsBetweenGetMBeanInfoCalls) {
  NamedList cachedStats = this.cachedDynamicStats;
  if (cachedStats != null) {
    stats = cachedStats;
  }
}
if (stats == null) {
  stats = infoBean.getStatistics();
}
{code}

could optimize further by eliminating the conditional when 
useCachedStatsBetweenGetMBeanInfoCalls is false but perhaps not worth it.

Otherwise, looks good, +1.

> Add an optional caching option as a workaround for SOLR-6586.
> -------------------------------------------------------------
>
>                 Key: SOLR-6747
>                 URL: https://issues.apache.org/jira/browse/SOLR-6747
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Mark Miller
>            Assignee: Mark Miller
>             Fix For: 5.0, Trunk
>
>         Attachments: SOLR-6747.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to