當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。