code: @Override
  	public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) {
  		final String domain = generateJmxDomain(metricName, group);
  		final Hashtable<String, String> table = generateJmxTable(group.getAllVariables());
  
  		AbstractBean jmxMetric;
  		ObjectName jmxName;
  		try {
  			jmxName = new ObjectName(domain, table);
  		} catch (MalformedObjectNameException e) {
  			/**
  			 * There is an implementation error on our side if this occurs. Either the domain was modified and no longer
  			 * conforms to the JMX domain rules or the table wasn't properly generated.
  			 */
  			LOG.debug("Implementation error. The domain or table does not conform to JMX rules." , e);
  			return;
  		}
  
  		if (metric instanceof Gauge) {
  			jmxMetric = new JmxGauge((Gauge<?>) metric);
  		} else if (metric instanceof Counter) {
  			jmxMetric = new JmxCounter((Counter) metric);
  		} else if (metric instanceof Histogram) {
  			jmxMetric = new JmxHistogram((Histogram) metric);
  		} else if (metric instanceof Meter) {
  			jmxMetric = new JmxMeter((Meter) metric);
  		} else {
  			LOG.error("Cannot add unknown metric type: {}. This indicates that the metric type " +
  				"is not supported by this reporter.", metric.getClass().getName());
  			return;
  		}
  
  		try {
  			synchronized (this) {
  				mBeanServer.registerMBean(jmxMetric, jmxName);
  				registeredMetrics.put(metric, jmxName);
  			}
  		} catch (NotCompliantMBeanException e) {
  			// implementation error on our side
  			LOG.debug("Metric did not comply with JMX MBean rules.", e);
  		} catch (InstanceAlreadyExistsException e) {
  			LOG.warn("A metric with the name " + jmxName + " was already registered.", e);
  		} catch (Throwable t) {
  			LOG.warn("Failed to register metric", t);
  		}
  	}
docs: ------------------------------------------------------------------------