org.apache.hadoop.metrics.util.MBeanUtil Java Examples

The following examples show how to use org.apache.hadoop.metrics.util.MBeanUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimulatedFSDataset.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Register the FSDataset MBean using the name
 *        "hadoop:service=DataNode,name=FSDatasetState-<storageid>"
 *  We use storage id for MBean name since a minicluster within a single
 * Java VM may have multiple Simulated Datanodes.
 */
void registerMBean(final String storageId) {
  // We wrap to bypass standard mbean naming convetion.
  // This wraping can be removed in java 6 as it is more flexible in 
  // package naming for mbeans and their impl.
  StandardMBean bean;

  try {
    bean = new StandardMBean(this,FSDatasetMBean.class);
    mbeanName = MBeanUtil.registerMBean("DataNode",
        "FSDatasetState-" + storageId, bean);
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }
 
  DataNode.LOG.info("Registered FSDatasetStatusMBean");
}
 
Example #2
Source File: FSDataset.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
/**
 * Register the FSDataset MBean using the name
 *        "hadoop:service=DataNode,name=FSDatasetState-<storageid>"
 */
void registerMBean(final String storageId) {
  // We wrap to bypass standard mbean naming convetion.
  // This wraping can be removed in java 6 as it is more flexible in 
  // package naming for mbeans and their impl.
  StandardMBean bean;
  String storageName;
  if (storageId == null || storageId.equals("")) {// Temp fix for the uninitialized storage
    storageName = "UndefinedStorageId" + rand.nextInt();
  } else {
    storageName = storageId;
  }
  try {
    bean = new StandardMBean(this,FSDatasetMBean.class);
    mbeanName = MBeanUtil.registerMBean("DataNode", "FSDatasetState-" + storageName, bean);
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }
 
  DataNode.LOG.info("Registered FSDatasetStatusMBean");
}
 
Example #3
Source File: FSNamesystem.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
/**
 * Register the FSNamesystem MBean using the name
 *        "hadoop:service=NameNode,name=FSNamesystemState"
 */
void registerMBean(Configuration conf) {
  // We wrap to bypass standard mbean naming convention.
  // This wraping can be removed in java 6 as it is more flexible in 
  // package naming for mbeans and their impl.
  StandardMBean bean;
  try {
    myFSMetrics = new FSNamesystemMetrics(conf);
    bean = new StandardMBean(this,FSNamesystemMBean.class);
    mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean);
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }

  LOG.info("Registered FSNamesystemStatusMBean");
}
 
Example #4
Source File: SimulatedFSDataset.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
/**
 * Register the FSDataset MBean using the name
 *        "hadoop:service=DataNode,name=FSDatasetState-<storageid>"
 *  We use storage id for MBean name since a minicluster within a single
 * Java VM may have multiple Simulated Datanodes.
 */
void registerMBean(final String storageId) {
  // We wrap to bypass standard mbean naming convetion.
  // This wraping can be removed in java 6 as it is more flexible in 
  // package naming for mbeans and their impl.
  StandardMBean bean;

  try {
    bean = new StandardMBean(this,FSDatasetMBean.class);
    mbeanName = MBeanUtil.registerMBean("DataNode",
        "FSDatasetState-" + storageId, bean);
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }
 
  DataNode.LOG.info("Registered FSDatasetStatusMBean");
}
 
Example #5
Source File: FSDataset.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Register the FSDataset MBean using the name
 *        "hadoop:service=DataNode,name=FSDatasetState-<storageid>"
 */
void registerMBean(final String storageId) {
  // We wrap to bypass standard mbean naming convetion.
  // This wraping can be removed in java 6 as it is more flexible in
  // package naming for mbeans and their impl.
  StandardMBean bean;
  String storageName;
  if (storageId == null || storageId.equals("")) {// Temp fix for the uninitialized storage
    storageName = "UndefinedStorageId" + rand.nextInt();
  } else {
    storageName = storageId;
  }
  try {
    bean = new StandardMBean(this,FSDatasetMBean.class);
    mbeanName = MBeanUtil.registerMBean("DataNode", "FSDatasetState-" + storageName, bean);
    versionBeanName = VersionInfo.registerJMX("DataNode");
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }

  DataNode.LOG.info("Registered FSDatasetStatusMBean");
}
 
Example #6
Source File: FSDataset.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
  
  if(volumes != null) {
    for (FSVolume volume : volumes.volumes) {
      if(volume != null) {
        volume.dfsUsage.shutdown();
      }
    }
  }
}
 
Example #7
Source File: JobTracker.java    From RDFS with Apache License 2.0 5 votes vote down vote up
void close() throws IOException {
  if (this.infoServer != null) {
    LOG.info("Stopping infoServer");
    try {
      this.infoServer.stop();
    } catch (Exception ex) {
      LOG.warn("Exception shutting down JobTracker", ex);
    }
  }
  if (this.interTrackerServer != null) {
    LOG.info("Stopping interTrackerServer");
    this.interTrackerServer.stop();
  }

  shutdown = true;

  closeThread(this.expireTrackersThread);
  closeThread(this.retireJobsThread);
  closeThread(this.jobUpdaterThread);

  if (taskScheduler != null) {
    taskScheduler.terminate();
  }

  closeThread(this.expireLaunchingTaskThread);
  closeThread(this.completedJobsStoreThread);
  if (versionBeanName != null) {
    MBeanUtil.unregisterMBean(versionBeanName);
  }
  LOG.info("stopped all jobtracker services");
  return;
}
 
Example #8
Source File: DataNodeActivityMBean.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public DataNodeActivityMBean(final MetricsRegistry mr, final String storageId) {
  super(mr, "Activity statistics at the DataNode");
  String storageName;
  if (storageId.equals("")) {// Temp fix for the uninitialized storage
    storageName = "UndefinedStorageId" + rand.nextInt();
  } else {
    storageName = storageId;
  }
  mbeanName = MBeanUtil.registerMBean("DataNode", "DataNodeActivity-" + storageName, this);
}
 
Example #9
Source File: RpcActivityMBean.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param mr - the metrics registry that has all the metrics
 * @param serviceName - the service name for the rpc service 
 * @param port - the rpc port.
 */
public RpcActivityMBean(final MetricsRegistry mr, final String serviceName, final String port) {

  
  super(mr, "Rpc layer statistics");
  mbeanName = MBeanUtil.registerMBean(serviceName,
        "RpcActivityForPort" + port, this);
}
 
Example #10
Source File: RpcMgt.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
RpcMgt(final String serviceName, final String port,
              final RpcMetrics metrics, Server server) {
  myMetrics = metrics;
  myServer = server;
  mbeanName = MBeanUtil.registerMBean(serviceName,
                  "RpcStatisticsForPort" + port, this);
}
 
Example #11
Source File: DataNode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
private void shutdownMXBean() {
  if (datanodeMXBeanName != null) {
    MBeanUtil.unregisterMBean(datanodeMXBeanName);
  }
  if (pulseChecker != null) {
    pulseChecker.shutdown();
  }
}
 
Example #12
Source File: FSDataset.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
  if (versionBeanName != null) {
    MBeanUtil.unregisterMBean(versionBeanName);
  }
  if (asyncDiskService != null) {
    asyncDiskService.shutdown();
  }

  if(volumes != null) {
    lock.writeLock().lock();
    try {
      if (volumes.scannersExecutor != null) {
        volumes.scannersExecutor.shutdown();
      }

      for (FSVolume volume : volumes.getVolumes()) {
        if(volume != null) {
          volume.shutdown();
        }
      }
    } finally {
      lock.writeLock().unlock();
    }
  }
}
 
Example #13
Source File: DataNodeActivityMBean.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public DataNodeActivityMBean(final MetricsRegistry mr, final String storageId) {
  super(mr, "Activity statistics at the DataNode");
  String storageName;
  if (storageId.equals("")) {// Temp fix for the uninitialized storage
    storageName = "UndefinedStorageId" + rand.nextInt();
  } else {
    storageName = storageId;
  }
  mbeanName = MBeanUtil.registerMBean("DataNode", "DataNodeActivity-" + storageName, this);
}
 
Example #14
Source File: RpcActivityMBean.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param mr - the metrics registry that has all the metrics
 * @param serviceName - the service name for the rpc service 
 * @param port - the rpc port.
 */
public RpcActivityMBean(final MetricsRegistry mr, final String serviceName, final String port) {

  
  super(mr, "Rpc layer statistics");
  mbeanName = MBeanUtil.registerMBean(serviceName,
        "RpcActivityForPort" + port, this);
}
 
Example #15
Source File: AvatarNode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void registerMBean() {
  StandardMBean avatarNodeBean;
  try {
    avatarNodeBean = new StandardMBean(this, AvatarNodeStatusMBean.class);
    MBeanUtil.registerMBean("AvatarNode", "AvatarNodeState", avatarNodeBean);
  } catch (NotCompliantMBeanException mex) {
    LOG.error("Error registering mbean with JMX", mex);
  }
}
 
Example #16
Source File: JMXContext.java    From RDFS with Apache License 2.0 5 votes vote down vote up
private synchronized JMXContextMBean getOrCreateMBean(String recordName) {
  JMXContextMBean bean = JMXBeans.get(recordName);
  if (bean == null) {
    bean = new JMXContextMBean(recordName);
    JMXBeans.put(recordName, bean);
    if (isMonitoring()) {
      ObjectName registeredName = 
        MBeanUtil.registerMBean(getContextName(), recordName, bean);
      beanHandles.put(bean, registeredName);
    }
  }
  return bean;
}
 
Example #17
Source File: JMXContext.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Override
protected void remove(MetricsRecordImpl record) {
  super.remove(record);
  
  String recordName = record.getRecordName();
  
  JMXContextMBean bean = JMXBeans.remove(recordName);
  if (bean == null) {
    return;
  }
  // Currently - one bean per record, so remove the bean
  ObjectName name = beanHandles.remove(bean);
  MBeanUtil.unregisterMBean(name);
}
 
Example #18
Source File: RpcMgt.java    From RDFS with Apache License 2.0 5 votes vote down vote up
RpcMgt(final String serviceName, final String port,
              final RpcMetrics metrics, Server server) {
  myMetrics = metrics;
  myServer = server;
  mbeanName = MBeanUtil.registerMBean(serviceName,
                  "RpcStatisticsForPort" + port, this);
}
 
Example #19
Source File: JMXContext.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void startMonitoring() throws IOException {
  for (Map.Entry<String, JMXContextMBean> beanEntry : JMXBeans.entrySet()) {
    ObjectName registeredName = MBeanUtil.registerMBean(getContextName(),
                            beanEntry.getKey(),
                            beanEntry.getValue());
    beanHandles.put(beanEntry.getValue(), registeredName);
  }
  super.startMonitoring();
}
 
Example #20
Source File: JMXContext.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void stopMonitoring() {
  for (ObjectName name : beanHandles.values()) {
    MBeanUtil.unregisterMBean(name);
  }
  beanHandles.clear();
  super.stopMonitoring();
}
 
Example #21
Source File: VersionInfo.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public static ObjectName registerJMX(String daemon) {
  StandardMBean versionBean;
  ObjectName versionBeanName = null;
  try {
    versionBean = new StandardMBean(new VersionInfo(),
                                        VersionInfoMBean.class);
    versionBeanName =
      MBeanUtil.registerMBean(daemon, "Version", versionBean);
  } catch (NotCompliantMBeanException e) {
    e.printStackTrace();
  }

  return versionBeanName;
}
 
Example #22
Source File: SimulatedFSDataset.java    From RDFS with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #23
Source File: DataNodeActivityMBean.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #24
Source File: FSNamesystem.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
/**
 * shutdown FSNamesystem
 */
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #25
Source File: NameNodeActivtyMBean.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #26
Source File: NameNodeActivtyMBean.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
protected NameNodeActivtyMBean(final MetricsRegistry mr) {
  super(mr, "Activity statistics at the NameNode");
  mbeanName = MBeanUtil.registerMBean("NameNode", "NameNodeActivity", this);
}
 
Example #27
Source File: RpcActivityMBean.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #28
Source File: RpcMgt.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #29
Source File: SimulatedFSDataset.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example #30
Source File: SepMetrics.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
    if (mbeanName != null)
        MBeanUtil.unregisterMBean(mbeanName);
}