mirror of https://github.com/apache/lucene.git
SolrMetricManager.registerMetric trivial opt
Needn't check for existing metric prior to removing. (code-reviewed by ab@apache.org)
This commit is contained in:
parent
89e14faca9
commit
37ad0e552d
|
@ -702,8 +702,8 @@ public class SolrMetricManager {
|
|||
if (context != null) {
|
||||
context.registerMetricName(fullName);
|
||||
}
|
||||
synchronized (metricRegistry) {
|
||||
if (force && metricRegistry.getMetrics().containsKey(fullName)) {
|
||||
synchronized (metricRegistry) { // prevent race; register() throws if metric is already present
|
||||
if (force) { // must remove any existing one if present
|
||||
metricRegistry.remove(fullName);
|
||||
}
|
||||
metricRegistry.register(fullName, metric);
|
||||
|
|
Loading…
Reference in New Issue