本文整理汇总了Java中org.apache.hadoop.metrics2.MetricsPlugin类的典型用法代码示例。如果您正苦于以下问题:Java MetricsPlugin类的具体用法?Java MetricsPlugin怎么用?Java MetricsPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetricsPlugin类属于org.apache.hadoop.metrics2包,在下文中一共展示了MetricsPlugin类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlugin
import org.apache.hadoop.metrics2.MetricsPlugin; //导入依赖的package包/类
<T extends MetricsPlugin> T getPlugin(String name) {
String classKey = name.isEmpty() ? "class" : name +".class";
String pluginClassName = getString(classKey);
if (pluginClassName == null || pluginClassName.isEmpty()) {
return null;
}
try {
Class<?> pluginClass = Class.forName(pluginClassName);
@SuppressWarnings("unchecked")
T plugin = (T) pluginClass.newInstance();
plugin.init(name.isEmpty() ? this : subset(name));
return plugin;
}
catch (Exception e) {
throw new MetricsConfigException("Error creating plugin: "+
pluginClassName, e);
}
}
示例2: getPlugin
import org.apache.hadoop.metrics2.MetricsPlugin; //导入依赖的package包/类
<T extends MetricsPlugin> T getPlugin(String name) {
String clsName = getClassName(name);
if (clsName == null) return null;
try {
Class<?> cls = Class.forName(clsName, true, getPluginLoader());
@SuppressWarnings("unchecked")
T plugin = (T) cls.newInstance();
plugin.init(name.isEmpty() ? this : subset(name));
return plugin;
} catch (Exception e) {
throw new MetricsConfigException("Error creating plugin: "+ clsName, e);
}
}
示例3: getPlugin
import org.apache.hadoop.metrics2.MetricsPlugin; //导入依赖的package包/类
<T extends MetricsPlugin> T getPlugin(String name) {
String clsName = getClassName(name);
if (clsName == null) return null;
try {
Class<?> cls = Class.forName(clsName, true, getPluginLoader());
@SuppressWarnings("unchecked")
T plugin = (T) cls.newInstance();
plugin.init(name.isEmpty() ? this : subset(name));
return plugin;
}
catch (Exception e) {
throw new MetricsConfigException("Error creating plugin: "+ clsName, e);
}
}