本文整理了Java中org.apache.hadoop.metrics2.util.MBeans
类的一些代码示例,展示了MBeans
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MBeans
类的具体详情如下:
包路径:org.apache.hadoop.metrics2.util.MBeans
类名称:MBeans
[英]This util class provides a method to register an MBean using our standard naming convention as described in the doc for {link #register(String,String,Object).
[中]这个util类提供了一种方法,可以使用{link#register(String,String,Object)文档中描述的标准命名约定来注册MBean。
代码示例来源:origin: apache/hbase
/**
* Register an mbean with the underlying metrics system
* @param serviceName Metrics service/system name
* @param metricsName name of the metrics obejct to expose
* @param theMbean the actual MBean
* @return ObjectName from jmx
*/
@Override
public ObjectName register(String serviceName, String metricsName, Object theMbean) {
return MBeans.register(serviceName, metricsName, theMbean);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
synchronized void stopMBeans() {
if (mbeanName != null) {
MBeans.unregister(mbeanName);
mbeanName = null;
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
"JMX bean properties should not be null for "
+ "bean registration.");
ObjectName name = getMBeanName(serviceName, nameName, properties);
if (name != null) {
try {
代码示例来源:origin: apache/hive
private void registerMXBeans() {
buddyAllocatorMXBean = MBeans.register("LlapDaemon", "BuddyAllocatorInfo", allocator);
}
代码示例来源:origin: apache/hive
@Override
public void close() {
LOG.info("Closing LlapIoImpl..");
if (buddyAllocatorMXBean != null) {
MBeans.unregister(buddyAllocatorMXBean);
buddyAllocatorMXBean = null;
}
executor.shutdownNow();
}
代码示例来源:origin: io.fabric8/fabric-hadoop
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
try {
mbs.registerMBean(theMbean, name);
return name;
} catch (InstanceAlreadyExistsException ie) {
LOG.warn(name, ie);
} catch (Exception e) {
LOG.warn("Error registering "+ name, e);
}
return null;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
private MetricsProxy(String namespace) {
MBeans.register(namespace, "FairCallQueue", this);
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public synchronized boolean shutdown() {
LOG.debug("refCount="+ refCount);
if (refCount <= 0) {
LOG.debug("Redundant shutdown", new Throwable());
return true; // already shutdown
}
if (--refCount > 0) return false;
if (monitoring) {
try { stop(); }
catch (Exception e) {
LOG.warn("Error stopping the metrics system", e);
}
}
allSources.clear();
allSinks.clear();
callbacks.clear();
namedCallbacks.clear();
if (mbeanName != null) {
MBeans.unregister(mbeanName);
mbeanName = null;
}
LOG.info(prefix +" metrics system shutdown complete.");
return true;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
try {
mbs.registerMBean(theMbean, name);
LOG.debug("Registered "+ name);
return name;
} catch (InstanceAlreadyExistsException iaee) {
if (LOG.isTraceEnabled()) {
LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
} else {
LOG.warn("Failed to register MBean \""+ name
+ "\": Instance already exists.");
}
} catch (Exception e) {
LOG.warn("Failed to register MBean \""+ name + "\"", e);
}
return null;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
private void initSystemMBean() {
checkNotNull(prefix, "prefix should not be null here!");
if (mbeanName == null) {
mbeanName = MBeans.register(prefix, MS_CONTROL_NAME, this);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
void unregisterSource(String namespace) {
final String name = "DecayRpcSchedulerMetrics2." + namespace;
DefaultMetricsSystem.instance().unregisterSource(name);
if (decayRpcSchedulerInfoBeanName != null) {
MBeans.unregister(decayRpcSchedulerInfoBeanName);
}
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
try {
mbs.registerMBean(theMbean, name);
LOG.debug("Registered "+ name);
return name;
} catch (InstanceAlreadyExistsException iaee) {
if (LOG.isTraceEnabled()) {
LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
} else {
LOG.warn("Failed to register MBean \""+ name
+ "\": Instance already exists.");
}
} catch (Exception e) {
LOG.warn("Failed to register MBean \""+ name + "\"", e);
}
return null;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters.
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
return register(serviceName, nameName, new HashMap<String, String>(),
theMbean);
}
代码示例来源:origin: apache/hive
public void shutdown() {
LOG.info("LlapDaemon shutdown invoked");
if (llapDaemonInfoBean != null) {
try {
MBeans.unregister(llapDaemonInfoBean);
} catch (Throwable ex) {
LOG.info("Error unregistering the bean; ignoring", ex);
}
}
if (pauseMonitor != null) {
pauseMonitor.stop();
}
if (metrics != null) {
LlapMetricsSystem.shutdown();
}
LlapProxy.close();
if (fnLocalizer != null) {
fnLocalizer.close();
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
try {
mbs.registerMBean(theMbean, name);
LOG.debug("Registered "+ name);
return name;
} catch (InstanceAlreadyExistsException iaee) {
if (LOG.isTraceEnabled()) {
LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
} else {
LOG.warn("Failed to register MBean \""+ name
+ "\": Instance already exists.");
}
} catch (Exception e) {
LOG.warn("Failed to register MBean \""+ name + "\"", e);
}
return null;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
synchronized void startMBeans() {
if (mbeanName != null) {
LOG.warn("MBean "+ name +" already initialized!");
LOG.debug("Stacktrace: ", new Throwable());
return;
}
mbeanName = MBeans.register(prefix, name, this);
LOG.debug("MBean for source "+ name +" registered.");
}
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
public void shutdown() {
MBeans.unregister(mxBeanName);
mxBeanName = null;
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
/**
* Register the MBean using our standard MBeanName format
* "hadoop:service=<serviceName>,name=<nameName>"
* Where the <serviceName> and <nameName> are the supplied parameters
*
* @param serviceName
* @param nameName
* @param theMbean - the MBean to register
* @return the named used to register the MBean
*/
static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
try {
mbs.registerMBean(theMbean, name);
LOG.debug("Registered "+ name);
return name;
} catch (InstanceAlreadyExistsException iaee) {
if (LOG.isTraceEnabled()) {
LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
} else {
LOG.warn("Failed to register MBean \""+ name
+ "\": Instance already exists.");
}
} catch (Exception e) {
LOG.warn("Failed to register MBean \""+ name + "\"", e);
}
return null;
}
代码示例来源:origin: apache/hbase
@SuppressWarnings("deprecation")
public IncrementCoalescer(ThriftHBaseServiceHandler hand) {
this.handler = hand;
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
pool =
new ThreadPoolExecutor(CORE_POOL_SIZE, CORE_POOL_SIZE, 50, TimeUnit.MILLISECONDS, queue,
Threads.newDaemonThreadFactory("IncrementCoalescer"));
MBeans.register("thrift", "Thrift", this);
}
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
public void shutdown() {
stopReconstructionInitializer();
blocksMap.close();
MBeans.unregister(mxBeanName);
mxBeanName = null;
}
内容来源于网络,如有侵权,请联系作者删除!