@ -49,6 +51,8 @@ public class CodahaleMetricWriter implements MetricWriter {
@@ -49,6 +51,8 @@ public class CodahaleMetricWriter implements MetricWriter {
@ -86,13 +90,19 @@ public class CodahaleMetricWriter implements MetricWriter {
@@ -86,13 +90,19 @@ public class CodahaleMetricWriter implements MetricWriter {
}
else{
finaldoublegauge=value.getValue().doubleValue();
Objectlock=null;
if(this.gaugeLocks.containsKey(name)){
lock=this.gaugeLocks.get(name);
}
else{
this.gaugeLocks.putIfAbsent(name,newObject());
lock=this.gaugeLocks.get(name);
}
// ensure we synchronize on the registry to avoid another thread
// pre-empting this thread after remove causing register to be
// called twice causing an error in CodaHale metrics
// NOTE: this probably should not be synchronized, but CodaHale
// provides no other methods to get or add a particular gauge
synchronized(this.registry){
// Ensure we synchronize to avoid another thread pre-empting this thread after
// remove causing an error in CodaHale metrics
// NOTE: CodaHale provides no way to do this atomically