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


Java Util.getMBeanServer方法代码示例

本文整理汇总了Java中org.jgroups.util.Util.getMBeanServer方法的典型用法代码示例。如果您正苦于以下问题:Java Util.getMBeanServer方法的具体用法?Java Util.getMBeanServer怎么用?Java Util.getMBeanServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgroups.util.Util的用法示例。


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

示例1: main

import org.jgroups.util.Util; //导入方法依赖的package包/类
public static void main(String[] args) {
    JmxDemo demo=new JmxDemo();
    demo.addNotificationListener(new NotificationListener() {

        @Override
        public void handleNotification(Notification notification, Object handback) {
            System.out.println(">> " + notification + ", handback=" + handback);
        }
    }, null, "myHandback");

    demo.startNotifications();

    MBeanServer server=Util.getMBeanServer();
    if(server != null) {
        try {
            JmxConfigurator.register(demo, server, "demo:name=DemoObject");
            while(true) {
                Util.sleep(10000);
            }
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:26,代码来源:JmxDemo.java

示例2: ReplicatedTree

import org.jgroups.util.Util; //导入方法依赖的package包/类
public ReplicatedTree(String groupname, String props, long state_fetch_timeout, boolean jmx) throws Exception {
    if(groupname != null)
        this.groupname=groupname;
    if(props != null)
        this.props=props;
    this.jmx=jmx;
    this.state_fetch_timeout=state_fetch_timeout;
    channel=new JChannel(this.props);
    channel.setReceiver(this);
    channel.connect(this.groupname);

    if(jmx) {
        MBeanServer server=Util.getMBeanServer();
        if(server == null)
            throw new Exception("No MBeanServers found; need to run with an MBeanServer present, or inside JDK 5");
        JmxConfigurator.registerChannel(channel, server, "jgroups", channel.getClusterName() , true);
    }
    start();
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:20,代码来源:ReplicatedTree.java

示例3: _init

import org.jgroups.util.Util; //导入方法依赖的package包/类
protected void _init(JChannel ch, long sleep_time, String name) throws Exception {
    this.sleep_time=sleep_time;
    channel=ch;
    if(name != null)
        channel.setName(name);
    channel.connect(getClass().getSimpleName());
    channel.setReceiver(receiver);

    try {
        MBeanServer server=Util.getMBeanServer();
        JmxConfigurator.registerChannel(channel, server, "jgroups-" + name, channel.getClusterName(), true);
    }
    catch(Throwable ex) {
        System.err.println("registering the channel with JMX failed: " + ex);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:17,代码来源:UnicastTest.java

示例4: init

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void init(String props, final String name, String cluster_name) throws Exception {
    if(cluster_name != null)
        groupname=cluster_name;
    channel=new JChannel(props);
    if(name != null)
        channel.setName(name);
    disp=new RpcDispatcher(channel, null, this, this);
    disp.setMethodLookup(new MethodLookup() {
        public Method findMethod(short id) {
            return METHODS[id];
        }
    });
    disp.setRequestMarshaller(new CustomMarshaller());
    channel.connect(groupname);
    local_addr=channel.getAddress();

    try {
        MBeanServer server=Util.getMBeanServer();
        JmxConfigurator.registerChannel(channel, server, "jgroups", channel.getClusterName(), true);
    }
    catch(Throwable ex) {
        System.err.println("registering the channel in JMX failed: " + ex);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:25,代码来源:UnicastTestRpc.java

示例5: channelDisconnected

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void channelDisconnected(Channel channel) {
    if(jmx) {
        MBeanServer server=Util.getMBeanServer();
        if(server != null) {
            try {
                JmxConfigurator.unregisterChannel((JChannel)channel,server,cluster_name);
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:14,代码来源:Draw.java

示例6: start

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void start(boolean provider, int size, String props, boolean provider_fails,
                  boolean requester_fails, long delay, String name) throws Exception {
    this.provider=provider;
    this.provider_fails=provider_fails;
    this.requester_fails=requester_fails;
    this.delay=delay;
    channel=new JChannel(props);
    channel.setReceiver(this);
    if(name != null)
        channel.setName(name);
    channel.connect("TestChannel");
    MBeanServer server=Util.getMBeanServer();
    if(server == null)
        throw new Exception("No MBeanServers found;" +
                              "\nLargeState needs to be run with an MBeanServer present, or inside JDK 5");
    JmxConfigurator.registerChannel((JChannel)channel, server, "jgroups", channel.getClusterName(), true);
    System.out.println("-- connected to channel");

    if(provider) {
        this.size=size;
        System.out.println("Waiting for other members to join and fetch large state");
        for(;;) {
            Util.sleep(10000);
        }
    }
    start=System.currentTimeMillis();
    try {
        channel.getState(null, 0);
    }
    catch(Exception ex) {
        ex.printStackTrace();
    }
    finally {
        Util.close(channel);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:37,代码来源:LargeState.java

示例7: start

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void start() throws Exception {
    channel=new JChannel(props);
    channel.setDiscardOwnMessages(true);
    disp=new RpcDispatcher(channel, null, this, this); // no concurrent processing on incoming method calls
    disp.setMethodLookup(new MethodLookup() {
        public Method findMethod(short id) {
            return METHODS[0];
        }
    });


    if(jmx) {
        MBeanServer srv=Util.getMBeanServer();
        if(srv == null)
            throw new Exception("No MBeanServers found;" +
                    "\nDraw needs to be run with an MBeanServer present, or inside JDK 5");
        JmxConfigurator.registerChannel((JChannel)channel, srv, "jgroups", channel.getClusterName(), true);
    }

    channel.connect("RpcDispatcherSpeedTestGroup");

    try {
        if(server) {
            System.out.println("-- Started as server. Press ctrl-c to kill");
            while(true) {
                Util.sleep(10000);
            }
        }
        else {
            invokeRpcs(num, num_threads, async, oob);
        }
    }
    catch(Throwable t) {
        t.printStackTrace(System.err);
    }
    finally {
        channel.close();
        disp.stop();
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:41,代码来源:RpcDispatcherSpeedTest.java

示例8: create

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass
protected void create() {server=Util.getMBeanServer();}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:3,代码来源:JmxTest.java


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