Example usage for org.apache.hadoop.metrics2.util MBeans register

List of usage examples for org.apache.hadoop.metrics2.util MBeans register

Introduction

In this page you can find the example usage for org.apache.hadoop.metrics2.util MBeans register.

Prototype

static public ObjectName register(String serviceName, String nameName, Object theMbean) 

Source Link

Document

Register the MBean using our standard MBeanName format "hadoop:service=,name=" Where the and are the supplied parameters.

Usage

From source file:com.alibaba.wasp.fserver.FServer.java

License:Apache License

/**
 * Register bean with platform management server
 *///  ww w .j  a  va 2 s .  c  om
void registerMBean() {
    MXBeanImpl mxBeanInfo = MXBeanImpl.init(this);
    mxBean = MBeans.register("FServer", "FServer", mxBeanInfo);
    LOG.info("Registered FServer MXBean");
}

From source file:org.apache.cassandra.hadoop.trackers.TrackerInitializer.java

License:Apache License

/**
 * The thread for the Task Tracker.//  w w  w .jav a2s. c o  m
 */
private static Thread getTaskTrackerThread() {
    Thread taskTrackerThread = new Thread(new Runnable() {

        public void run() {
            taskTracker = null;

            while (true) {
                try {
                    taskTracker = new TaskTracker(new CassandraJobConf());
                    taskTrackerMBean = MBeans.register("TaskTracker", "TaskTrackerInfo", taskTracker);
                    logger.info("Hadoop Task Tracker Started... ");
                    taskTracker.run();
                    logger.info("TaskTracker has finished");
                    break;
                } catch (Throwable t) {
                    // Shutdown the Task Tracker
                    if (t instanceof InterruptedException) {
                        try {
                            if (taskTracker != null) {
                                taskTracker.shutdown();
                                logger.info("Task tracker was shutdown");
                            }
                        } catch (Exception e) {
                            logger.warn("Interruption when shutting down the task tracker");
                        }
                        break;
                    }

                    // on OOM shut down the tracker
                    if (t instanceof OutOfMemoryError || t.getCause() instanceof OutOfMemoryError) {
                        break;
                    }
                }
            }
        }
    }, "TASK-TRACKER-INIT");

    return taskTrackerThread;
}