From c8d55cc6d45afaff31160a22fbe01dc36bb6675f Mon Sep 17 00:00:00 2001 From: Andrzej Bialecki Date: Mon, 30 Oct 2017 12:52:01 +0100 Subject: [PATCH] SOLR-11413: SolrGraphiteReporter fails to report metrics due to non-thread safe code. --- solr/CHANGES.txt | 2 ++ .../solr/metrics/reporters/SolrGraphiteReporter.java | 12 +++++------- .../src/test-files/solr/solr-graphitereporter.xml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index b29262582b4..22dfaf9181b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -81,6 +81,8 @@ Bug Fixes * SOLR-11557: Fix SolrZkClient.checkInterrupted (Tomás Fernández Löbbe) +* SOLR-11413: SolrGraphiteReporter fails to report metrics due to non-thread safe code. (Erik Persson, ab) + Optimizations ---------------------- * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr diff --git a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java index 68111d59368..4a55f462114 100644 --- a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java +++ b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java @@ -75,13 +75,11 @@ public class SolrGraphiteReporter extends FilteringSolrMetricReporter { } GraphiteSender graphite; String id = host + ":" + port + ":" + pickled; - graphite = serviceRegistry.getOrCreate(id, () -> { - if (pickled) { - return new PickledGraphite(host, port); - } else { - return new Graphite(host, port); - } - }); + if (pickled) { + graphite = new PickledGraphite(host, port); + } else { + graphite = new Graphite(host, port); + } if (instancePrefix == null) { instancePrefix = registryName; } else { diff --git a/solr/core/src/test-files/solr/solr-graphitereporter.xml b/solr/core/src/test-files/solr/solr-graphitereporter.xml index 7c7f5ca11b8..de123135a59 100644 --- a/solr/core/src/test-files/solr/solr-graphitereporter.xml +++ b/solr/core/src/test-files/solr/solr-graphitereporter.xml @@ -18,7 +18,7 @@ - + localhost ${mock-graphite-port}