private void unRegisterMBeanSafe() {
    if (metricsMBean != null && !ReplLoadWork.disableMbeanUnregistrationForTests) {
      try {
        MBeans.unregister(metricsMBean);
      } catch (Exception e) {
        LOG.warn("Unable to unregister MBean {}", metricsMBean, e);
      }
    }
  }
Abstract class for Replication Metric Collection.
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/metric/ReplicationMetricCollector.java