当前位置: 首页>>代码示例>>Java>>正文


Java ModelMBean类代码示例

本文整理汇总了Java中javax.management.modelmbean.ModelMBean的典型用法代码示例。如果您正苦于以下问题:Java ModelMBean类的具体用法?Java ModelMBean怎么用?Java ModelMBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModelMBean类属于javax.management.modelmbean包,在下文中一共展示了ModelMBean类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerManagedResource

import javax.management.modelmbean.ModelMBean; //导入依赖的package包/类
@Override
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
	Assert.notNull(managedResource, "Managed resource must not be null");
	Assert.notNull(objectName, "ObjectName must not be null");
	try {
		if (isMBean(managedResource.getClass())) {
			doRegister(managedResource, objectName);
		}
		else {
			ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
			doRegister(mbean, objectName);
			injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
		}
	}
	catch (JMException ex) {
		throw new UnableToRegisterMBeanException(
				"Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:MBeanExporter.java

示例2: createMBean

import javax.management.modelmbean.ModelMBean; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>Connector</code> object.
 *
 * @param connector The Connector to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Connector connector)
    throws Exception {

    String mname = createManagedName(connector);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ModelMBean mbean = managed.createMBean(connector);
    ObjectName oname = createObjectName(domain, connector);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:27,代码来源:MBeanUtils.java

示例3: testHappyPath

import javax.management.modelmbean.ModelMBean; //导入依赖的package包/类
@Test
public void testHappyPath() throws MalformedObjectNameException, JMException {
    TestMbean testMbean = new TestMbean();
    ModelMBean mbean = defaultManagementMBeanAssembler.assemble(testMbean, new ObjectName("org.flowable.jmx.Mbeans:type=something"));
    assertNotNull(mbean);
    assertNotNull(mbean.getMBeanInfo());
    assertNotNull(mbean.getMBeanInfo().getAttributes());
    MBeanAttributeInfo[] attributes = mbean.getMBeanInfo().getAttributes();
    assertEquals(2, attributes.length);
    assertTrue((attributes[0].getName().equals("TestAttributeString") && attributes[1].getName().equals("TestAttributeBoolean") || (attributes[1].getName().equals("TestAttributeString") && attributes[0]
            .getName().equals("TestAttributeBoolean"))));
    assertNotNull(mbean.getMBeanInfo().getOperations());
    MBeanOperationInfo[] operations = mbean.getMBeanInfo().getOperations();
    assertNotNull(operations);
    assertEquals(3, operations.length);

}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:18,代码来源:DefaultManagementMBeanAssemblerTest.java

示例4: main

import javax.management.modelmbean.ModelMBean; //导入依赖的package包/类
public static void main(String[] args)
{
  RemoteServiceStat rss = new RemoteServiceStat();
  ModelMBean mmb =  MBeanHelper.createModelMBean(rss);
  MBeanAttributeInfo[] attrs= mmb.getMBeanInfo().getAttributes();
  for(MBeanAttributeInfo inf:attrs)
  {
    String getMethodName = (String) inf.getDescriptor().getFieldValue("getMethod");
    try
    {
      Method m= rss.getClass().getMethod(getMethodName);
      AggregateAttribute aa= m.getAnnotation(AggregateAttribute.class);
      System.out.println(inf.getName()+" "+aa.value()+" "+inf.getType() );
    }
    catch (NoSuchMethodException | SecurityException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    
  }
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:23,代码来源:TestAnnotations.java

示例5: registerManagedResource

import javax.management.modelmbean.ModelMBean; //导入依赖的package包/类
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
	Assert.notNull(managedResource, "Managed resource must not be null");
	Assert.notNull(objectName, "ObjectName must not be null");
	try {
		if (isMBean(managedResource.getClass())) {
			doRegister(managedResource, objectName);
		}
		else {
			ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
			doRegister(mbean, objectName);
			injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
		}
	}
	catch (JMException ex) {
		throw new UnableToRegisterMBeanException(
				"Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:19,代码来源:MBeanExporter.java


注:本文中的javax.management.modelmbean.ModelMBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。