TableMetrics: bugfix: local metrics registry is a proxy. It must proxy

Refs scylladb/scylla#2340 (trunk/1.7)

Must proxy "register" call, otherwise unregistration of mbeans
will instead try to double-register. Code for this somehow fell away.

Message-Id: <1494417610-9720-1-git-send-email-calle@scylladb.com>
This commit is contained in:
Calle Wilund 2017-05-10 12:00:10 +00:00 committed by Avi Kivity
parent fa72ea29d3
commit e954db8444

View File

@ -21,11 +21,13 @@ import static com.scylladb.jmx.api.APIClient.getReader;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.metrics.MetricsRegistry.MetricMBean;
import com.scylladb.jmx.api.APIClient;
@ -110,15 +112,22 @@ public class TableMetrics implements Metrics {
final MetricNameFactory factory;
final MetricNameFactory aliasFactory;
final String cfName;
final MetricsRegistry other;
public Registry(MetricsRegistry other, MetricNameFactory factory, MetricNameFactory aliasFactory,
String cfName) {
super(other);
this.other = other;
this.cfName = cfName;
this.factory = factory;
this.aliasFactory = aliasFactory;
}
@Override
public void register(Supplier<MetricMBean> f, ObjectName... objectNames) {
other.register(f, objectNames);
}
public void createTableGauge(String name, String uri) throws MalformedObjectNameException {
createTableGauge(name, name, uri);
}