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


Java SolrDynamicMBean类代码示例

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


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

示例1: testJmxRegistration

import org.apache.solr.core.JmxMonitoredMap.SolrDynamicMBean; //导入依赖的package包/类
@Test
public void testJmxRegistration() throws Exception {
  List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
  log.info("Servers in testJmxRegistration: " + servers);
  assertNotNull("MBeanServers were null", servers);
  assertFalse("No MBeanServer was found", servers.isEmpty());

  MBeanServer mbeanServer = servers.get(0);
  assertTrue("No MBeans found in server", mbeanServer.getMBeanCount() > 0);

  Set<ObjectInstance> objects = mbeanServer.queryMBeans(null, null);
  assertFalse("No SolrInfoMBean objects found in mbean server", objects
          .isEmpty());
  for (ObjectInstance o : objects) {
    MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(o.getObjectName());
    if (mbeanInfo.getClassName().endsWith(SolrDynamicMBean.class.getName())) {
      assertTrue("No Attributes found for mbean: " + mbeanInfo, mbeanInfo
              .getAttributes().length > 0);
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:TestJmxIntegration.java

示例2: testJmxRegistration

import org.apache.solr.core.JmxMonitoredMap.SolrDynamicMBean; //导入依赖的package包/类
@Test
public void testJmxRegistration() throws Exception {
  assertTrue("No MBeans found in server", mbeanServer.getMBeanCount() > 0);

  Set<ObjectInstance> objects = mbeanServer.queryMBeans(null, null);
  assertFalse("No objects found in mbean server", objects
          .isEmpty());
  int numDynamicMbeans = 0;
  for (ObjectInstance o : objects) {
    assertNotNull("Null name on: " + o.toString(), o.getObjectName());
    MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(o.getObjectName());
    if (mbeanInfo.getClassName().endsWith(SolrDynamicMBean.class.getName())) {
      numDynamicMbeans++;
      MBeanAttributeInfo[] attrs = mbeanInfo.getAttributes();
      assertTrue("No Attributes found for mbean: " + mbeanInfo, 
                 0 < attrs.length);
      for (MBeanAttributeInfo attr : attrs) {
        // ensure every advertised attribute is gettable
        try {
          Object trash = mbeanServer.getAttribute(o.getObjectName(), attr.getName());
        } catch (javax.management.AttributeNotFoundException e) {
          throw new RuntimeException("Unable to featch attribute for " + o.getObjectName()
                                     + ": " + attr.getName(), e);
        }
      }
    }
  }
  assertTrue("No SolrDynamicMBeans found", 0 < numDynamicMbeans);
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:TestJmxIntegration.java


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