Package com.taobao.metamorphosis.tools.utils

Examples of com.taobao.metamorphosis.tools.utils.JMXClient


        int port = Integer.parseInt(commandLine.getOptionValue("port", "9999"));
        String topic = commandLine.getOptionValue("topic");
        int start = Integer.parseInt(commandLine.getOptionValue("start"));
        int end = Integer.parseInt(commandLine.getOptionValue("end"));

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);
        this.println("connected to " + jmxClient.getAddressAsString());
        ObjectInstance metaConfigInstance = jmxClient.queryMBeanForOne(METACONFIG_NAME);

        if (metaConfigInstance != null) {
            jmxClient.invoke(metaConfigInstance.getObjectName(), "closePartitions", new Object[] { topic, start, end },
                new String[] { "java.lang.String", "int", "int" });
            jmxClient.close();
            this.println("invoke " + metaConfigInstance.getClassName() + "#closePartitions success");
        }
        else {
            this.println("û���ҵ� " + METACONFIG_NAME);
        }
View Full Code Here


                    new Options().addOption("host", true, "host").addOption("port", true, "port"));

        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9999"));

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);

        this.println("connected to " + jmxClient.getAddressAsString());

        ObjectInstance metaConfigInstance = jmxClient.queryMBeanForOne(HANDLE_NANE);
        if (metaConfigInstance != null) {
            jmxClient.invoke(metaConfigInstance.getObjectName(), "restart", new Object[0], new String[0]);
            jmxClient.close();
            this.println("invoke " + metaConfigInstance.getClassName() + "#restart success");
        }
        else {
            this.println("û���ҵ� " + HANDLE_NANE);
        }
View Full Code Here

    @Override
    public void doMain(String[] args) throws Exception {
        CommandLine commandLine = this.getCommandLine(args);
        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9999"));
        JMXClient jmxClient = JMXClient.getJMXClient(host, port);
        this.println("connected to " + jmxClient.getAddressAsString());
        ObjectInstance ttInstance = jmxClient.queryMBeanForOne(TT_NAME);
        if (ttInstance == null) {
            this.println("û���ҵ� " + TT_NAME);
            return;
        }
        if (commandLine.hasOption("start")) {
            jmxClient.invoke(ttInstance.getObjectName(), "startSub", new Object[0], new String[0]);
            this.println("invoke " + ttInstance.getClassName() + "#startSub success");
        }
        else if (commandLine.hasOption("stop")) {
            jmxClient.invoke(ttInstance.getObjectName(), "stopSub", new Object[0], new String[0]);
            this.println("invoke " + ttInstance.getClassName() + "#stopSub success");
        }
        else if (commandLine.hasOption("look")) {
            String ret = (String) jmxClient.getAttribute(ttInstance.getObjectName(), "SubStatus");
            this.println(ret);
        }
        else {
            this.println("unknown option");
        }

        jmxClient.close();
    }
View Full Code Here

                    new Options().addOption("host", true, "host").addOption("port", true, "port"));

        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9123"));

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);

        this.println("connected to " + jmxClient.getAddressAsString());

        ObjectInstance metaConfigInstance = jmxClient.queryMBeanForOne(HANDLE_NANE);
        if (metaConfigInstance != null) {
            Object result = jmxClient.getAttribute(metaConfigInstance.getObjectName(), "Status");
            System.out.println(result);
            jmxClient.close();
            this.println("invoke " + metaConfigInstance.getClassName() + "#reload success");
        }
        else {
            this.println("û���ҵ� " + METACONFIG_NAME);
        }
View Full Code Here

                    new Options().addOption("host", true, "host").addOption("port", true, "port"));

        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9123"));

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);

        this.println("connected to " + jmxClient.getAddressAsString());

        ObjectInstance metaConfigInstance = jmxClient.queryMBeanForOne(METACONFIG_NAME);
        if (metaConfigInstance != null) {
            jmxClient.invoke(metaConfigInstance.getObjectName(), "reload", new Object[0], new String[0]);
            jmxClient.close();
            this.println("invoke " + metaConfigInstance.getClassName() + "#reload success");
        }
        else {
            this.println("û���ҵ� " + METACONFIG_NAME);
        }
View Full Code Here

        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9999"));
        String topic = commandLine.getOptionValue("topic");

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);
        this.println("connected to " + jmxClient.getAddressAsString());
        ObjectInstance metaConfigInstance = jmxClient.queryMBeanForOne(METACONFIG_NAME);

        if (metaConfigInstance != null) {
            jmxClient.invoke(metaConfigInstance.getObjectName(), "openPartitions", new Object[] { topic },
                new String[] { "java.lang.String" });
            jmxClient.close();
            this.println("invoke " + metaConfigInstance.getClassName() + "#openPartitions success");
        }
        else {
            this.println("û���ҵ� " + METACONFIG_NAME);
        }
View Full Code Here

        CommandLine commandLine = this.getCommandLine(args);

        String host = commandLine.getOptionValue("host", "127.0.0.1");
        int port = Integer.parseInt(commandLine.getOptionValue("port", "9999"));

        JMXClient jmxClient = JMXClient.getJMXClient(host, port);
        this.println("connected to " + jmxClient.getAddressAsString());
        ObjectInstance brokerInstance = jmxClient.queryMBeanForOne(METABROKER_NAME);

        if (brokerInstance != null) {
            jmxClient.invoke(brokerInstance.getObjectName(), "stop", new Object[0], new String[0]);
            jmxClient.close();
            this.println("invoke " + brokerInstance.getClassName() + "#stop success");
        }
        else {
            this.println("û���ҵ� " + METABROKER_NAME);
        }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.tools.utils.JMXClient

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.