Package twitter4j.management

Examples of twitter4j.management.APIStatistics


public class MBeanServerRunner {
    public static void main(String[] args) throws Exception {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName name = new ObjectName("twitter4j.mbean:type=APIStatistics");
        ObjectName name2 = new ObjectName("twitter4j.mbean:type=APIStatisticsOpenMBean");
        APIStatistics statsMBean = new APIStatistics(100);
        mbs.registerMBean(statsMBean, name);
        APIStatisticsOpenMBean openMBean = new APIStatisticsOpenMBean(statsMBean);
        mbs.registerMBean(openMBean, name2);

        for (int i = 0; i < 10; i++) {
            statsMBean.methodCalled("foo", 5, true);
            statsMBean.methodCalled("bar", 2, true);
            statsMBean.methodCalled("baz", 10, true);
            statsMBean.methodCalled("foo", 2, false);
        }

        Thread.sleep(1000 * 60 * 60);
    }
View Full Code Here

TOP

Related Classes of twitter4j.management.APIStatistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.