public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmMemMgrPoolRelEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmMemMgrPoolRelTable" + "\" must implement the \"" +
"JvmMemMgrPoolRelEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
java类javax.management.ObjectName的实例源码
JvmMemMgrPoolRelTableMeta.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
JmxUtils.java 文件源码
项目:Byter
阅读 32
收藏 0
点赞 0
评论 0
/**
* creates a ObjectName with specific packagename and type.
* @param packageName desired packageName
* @param type desired type
* @param concatRandomInt concat a int at the type
* @return null(default) | instanced ObjectName
*/
public static ObjectName objectName(final String packageName, final String type, final boolean concatRandomInt){
try{
if(!concatRandomInt)
return new ObjectName( packageName+":type="+type);
else{
writerId++;
return new ObjectName( packageName+":type="+type+"-id-"+writerId);
}
} catch (MalformedObjectNameException e) {
log.log(Level.WARNING, "ObjectName is malformed!");
return null;
}
}
PogamutJMX.java 文件源码
项目:Pogamut3
阅读 18
收藏 0
点赞 0
评论 0
/**
* Creates hierarchical ObjectNames given a parent and name of the MBean.
* Extra elements can be inserted into the path through typeExtra param.
*
* @param parent
* parent's ObjectName
* @param childName
* name of this object, if null no name element will be appended
* @return ObjectName of form: domain=[parent's domain],type=[parent's
* type].[parent's name],name=[name]
* @throws PogamutJMXNameException
*/
public static ObjectName getObjectName(ObjectName parent, String childName) throws PogamutJMXNameException {
NullCheck.check(parent, "parent");
NullCheck.check(childName, "childName");
String parentDomain = parent.getKeyProperty("domain");
String parentType = parent.getKeyProperty("type");
String parentName = parent.getKeyProperty("name");
String childType = parentType + "." + parentName;
return getObjectName(parentDomain, childType, childName);
}
StatusTransformer.java 文件源码
项目:tomcat7
阅读 29
收藏 0
点赞 0
评论 0
/**
* Write JSP monitoring information.
*/
public static void writeJspMonitor(PrintWriter writer,
Set<ObjectName> jspMonitorONs,
MBeanServer mBeanServer,
int mode)
throws Exception {
int jspCount = 0;
int jspReloadCount = 0;
Iterator<ObjectName> iter = jspMonitorONs.iterator();
while (iter.hasNext()) {
ObjectName jspMonitorON = iter.next();
Object obj = mBeanServer.getAttribute(jspMonitorON, "jspCount");
jspCount += ((Integer) obj).intValue();
obj = mBeanServer.getAttribute(jspMonitorON, "jspReloadCount");
jspReloadCount += ((Integer) obj).intValue();
}
if (mode == 0) {
writer.print("<br>");
writer.print(" JSPs loaded: ");
writer.print(jspCount);
writer.print(" JSPs reloaded: ");
writer.print(jspReloadCount);
} else if (mode == 1) {
// for now we don't write out anything
}
}
SystemClassLoaderTest.java 文件源码
项目:jdk8u-jdk
阅读 21
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
// Instantiate the MBean server
//
System.out.println("Create the MBean server");
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
ClassLoader mbsClassLoader = mbs.getClass().getClassLoader();
String testClassName = Test.class.getName();
// Check that the MBeanServer class loader does not know our test class
try {
Class.forName(testClassName, true, mbsClassLoader);
System.out.println("TEST IS INVALID: MBEANSERVER'S CLASS LOADER " +
"KNOWS OUR TEST CLASS");
System.exit(1);
} catch (ClassNotFoundException e) {
// As required
}
// Register the MBean
//
System.out.println("Create MBean from this class");
ObjectName objectName = new ObjectName("whatever:type=whatever");
mbs.createMBean(testClassName, objectName);
// Test OK!
//
System.out.println("Bye! Bye!");
}
ConfigRegistryImplLookupTest.java 文件源码
项目:hashsdn-controller
阅读 18
收藏 0
点赞 0
评论 0
private static void registerRuntimeBean(final RuntimeBean object, final BaseJMXRegistrator baseJMXRegistrator,
final ObjectName runtimeON) throws InstanceAlreadyExistsException {
String factoryName = ObjectNameUtil.getFactoryName(runtimeON);
String instanceName = ObjectNameUtil.getInstanceName(runtimeON);
Map<String, String> properties = ObjectNameUtil.getAdditionalPropertiesOfRuntimeBeanName(runtimeON);
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator = baseJMXRegistrator
.createRuntimeBeanRegistrator(new ModuleIdentifier(factoryName, instanceName));
assertThat(properties.isEmpty(), is(true));
runtimeBeanRegistrator.registerRoot(object);
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 21
收藏 0
点赞 0
评论 0
@Override
public synchronized void addNotificationListener(ObjectName name, ObjectName listener,
NotificationFilter filter, Object handback)
throws InstanceNotFoundException {
mbs.addNotificationListener(name, listener, filter, handback);
Listener1 l = new Listener1(name, listener, filter, handback);
listeners.add(l);
listeners1.add(l);
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 26
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectInstance createMBean(String className, ObjectName name)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException {
throw new UnsupportedOperationException("Not supported by PogamutMBeanServer yet...");
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 21
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectInstance createMBean(String className, ObjectName name,
ObjectName loaderName) throws ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException,
InstanceNotFoundException {
throw new UnsupportedOperationException("Not supported by PogamutMBeanServer yet...");
}
ScanManager.java 文件源码
项目:jdk8u-jdk
阅读 30
收藏 0
点赞 0
评论 0
public Map<String,DirectoryScannerMXBean> getDirectoryScanners() {
final Map<String,DirectoryScannerMXBean> proxyMap = newHashMap();
for (Entry<ObjectName,DirectoryScannerMXBean> item : scanmap.entrySet()){
proxyMap.put(item.getKey().getKeyProperty("name"),item.getValue());
}
return proxyMap;
}