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


Java ZKMBeanInfo类代码示例

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


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

示例1: validateAllMXBeanAreUnregistered

import org.apache.zookeeper.jmx.ZKMBeanInfo; //导入依赖的package包/类
/**
 * <p>
 * This test ensures that all JXM beans associated to a {@link QuorumPeer}
 * are unregistered when shuted down ({@link QuorumUtil#shutdown(int)}). It
 * allows a successfull restarting of several zookeeper servers (
 * {@link QuorumPeer}) running on the same JVM.
 * <p>
 * See ZOOKEEPER-1214 for details.
 */
@Test
public void validateAllMXBeanAreUnregistered() throws IOException {
    QuorumUtil qU = new QuorumUtil(1);
    LOG.info(">-->> Starting up all servers...");
    qU.startAll();
    LOG.info(">-->> Servers up and running...");

    int leaderIndex = qU.getLeaderServer();
    int firstFollowerIndex = 0;
    int secondFollowerIndex = 0;

    switch (leaderIndex) {
    case 1:
        firstFollowerIndex = 2;
        secondFollowerIndex = 3;
        break;
    case 2:
        firstFollowerIndex = 1;
        secondFollowerIndex = 3;
        break;
    case 3:
        firstFollowerIndex = 1;
        secondFollowerIndex = 2;
        break;

    default:
        Assert.fail("Unexpected leaderIndex value: " + leaderIndex);
        break;
    }

    LOG.info(">-->> Shuting down server [{}]", firstFollowerIndex);
    qU.shutdown(firstFollowerIndex);
    LOG.info(">-->> Shuting down server [{}]", secondFollowerIndex);
    qU.shutdown(secondFollowerIndex);
    LOG.info(">-->> Restarting server [{}]", firstFollowerIndex);
    qU.restart(firstFollowerIndex);
    LOG.info(">-->> Restarting server [{}]", secondFollowerIndex);
    qU.restart(secondFollowerIndex);

    qU.shutdownAll();
    Set<ZKMBeanInfo> pending = MBeanRegistry.getInstance()
            .getRegisteredBeans();
    Assert.assertTrue("The following beans should have been unregistered: "
            + pending, pending.isEmpty());
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:55,代码来源:QuorumUtilTest.java


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