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

The following examples show how to use org.apache.hadoop.metrics.util.MBeanUtil. These examples are extracted from open source projects. 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 Project: RDFS   Source File: SimulatedFSDataset.java    License: 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 Project: RDFS   Source File: FSDataset.java    License: 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 3
Source Project: hadoop-gpu   Source File: SimulatedFSDataset.java    License: 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 4
Source Project: hadoop-gpu   Source File: FSNamesystem.java    License: 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 5
Source Project: hadoop-gpu   Source File: FSDataset.java    License: 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 6
Source Project: RDFS   Source File: JobTracker.java    License: 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 7
Source Project: RDFS   Source File: AvatarNode.java    License: 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 8
Source Project: RDFS   Source File: JMXContext.java    License: 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 9
Source Project: RDFS   Source File: JMXContext.java    License: 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 10
Source Project: RDFS   Source File: JMXContext.java    License: 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 11
Source Project: RDFS   Source File: JMXContext.java    License: 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 12
Source Project: RDFS   Source File: VersionInfo.java    License: 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 13
Source Project: RDFS   Source File: RpcMgt.java    License: 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 14
Source Project: RDFS   Source File: RpcActivityMBean.java    License: 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 Project: RDFS   Source File: DataNodeActivityMBean.java    License: 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 16
Source Project: RDFS   Source File: FSDataset.java    License: 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 17
Source Project: RDFS   Source File: DataNode.java    License: 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 18
Source Project: hadoop-gpu   Source File: RpcMgt.java    License: 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 Project: hadoop-gpu   Source File: RpcActivityMBean.java    License: 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 20
Source Project: hadoop-gpu   Source File: DataNodeActivityMBean.java    License: 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 21
Source Project: hadoop-gpu   Source File: FSDataset.java    License: 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 22
Source Project: RDFS   Source File: SimulatedFSDataset.java    License: Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example 23
Source Project: RDFS   Source File: BeanTracker.java    License: Apache License 2.0 4 votes vote down vote up
public void register(Object beanObject) {
  StandardMBean bean = this.createBean(beanObject);
  beanName = MBeanUtil.registerMBean(serviceName, name, bean);
}
 
Example 24
Source Project: RDFS   Source File: BeanTracker.java    License: Apache License 2.0 4 votes vote down vote up
public void unregister() {
  if (serviceName != null && name != null) {
    MBeanUtil.unregisterMBean(beanName);
  }
}
 
Example 25
Source Project: RDFS   Source File: RpcMgt.java    License: Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example 26
Source Project: RDFS   Source File: RpcActivityMBean.java    License: Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example 27
Source Project: RDFS   Source File: NameNodeActivtyMBean.java    License: 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 28
Source Project: RDFS   Source File: NameNodeActivtyMBean.java    License: Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}
 
Example 29
Source Project: RDFS   Source File: HighTideNodeActivityMBean.java    License: Apache License 2.0 4 votes vote down vote up
protected HighTideNodeActivityMBean(final MetricsRegistry mr) {
  super(mr, "Activity statistics at the HighTideNode");
  mbeanName = MBeanUtil.registerMBean("HighTideNode", "HighTideNodeActivity", this);
}
 
Example 30
Source Project: RDFS   Source File: HighTideNodeActivityMBean.java    License: Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  if (mbeanName != null)
    MBeanUtil.unregisterMBean(mbeanName);
}