Package com.trendmicro.mist

Examples of com.trendmicro.mist.BrokerSpy


                TextFormat.merge(new String(brokerNode.getContent()), brkBuilder);
                brkBuilder.clearStatus().setStatus(ZooKeeperInfo.Broker.Status.OFFLINE);
                brokerNode.setContent(brkBuilder.build().toString().getBytes());

                if(availBrkCnt > 1) {
                    BrokerSpy brokerSpy = new BrokerSpy(broker_ip);
                    ArrayList<Exchange> exchangeList = brokerSpy.getAllExchangeMetadata();

                    ArrayList<MigrateThread> migrateList = new ArrayList<MigrateThread>();
                    for(Exchange exg : exchangeList) {
                        migrateList.add(new MigrateThread(exg));
                    }
View Full Code Here


                    ZooKeeperInfo.Command cmd = ZooKeeperInfo.Command.newBuilder().setType(ZooKeeperInfo.Command.Type.MIGRATE_EXCHANGE).addArgument(nodePath).build();
                    ZNode.createSequentialNode("/local/mist_client/" + host + "/cmd", false, cmd.toString().getBytes());
                }

                if(hasOld) {
                    BrokerSpy brokerSpy = new BrokerSpy(oldhost);

                    for(;;) {
                        String producer = brokerSpy.getExchangeAttribs(miExchange.isQueue(), miExchange.getName(), "NumProducers");
                        String consumer = brokerSpy.getExchangeAttribs(miExchange.isQueue(), miExchange.getName(), "NumConsumers");
                        if(producer.compareTo("0") == 0 && consumer.compareTo("1") == 0)
                            break;
                        else {
                            myConsole.logResponse("[%s] waiting for %s producer(s) and %d consumer(s) to migrate%n", miExchange.toString(), producer, (Integer.valueOf(consumer) - 1));
                            Utils.justSleep(1000);
                        }
                    }

                    for(;;) {
                        String pending = brokerSpy.getExchangeAttribs(miExchange.isQueue(), miExchange.getName(), "NumMsgs");
                        if(pending.compareTo("0") == 0)
                            break;
                        try {
                            pendingCnt = Integer.valueOf(pending);
                        }
View Full Code Here

        return hostname;
    }
   
    private boolean isExchangeInUse(String broker, Exchange exchange) {
        BrokerSpy spy = new BrokerSpy(broker);
        try {
            spy.jmxConnectServer();
            Map<String, String> map = spy.getExchangeAttribMap(exchange);
            if(map.isEmpty())
                return false;
            else if(Long.valueOf(map.get("NumMsgs")) > 0)
                return true;
            else if(Integer.valueOf(map.get("NumConsumers")) > 0)
                return true;
            else if(Integer.valueOf(map.get("NumProducers")) > 0)
                return true;
            else
                return false;
        }
        catch(Exception e) {
            logger.error(e.getMessage(), e);
            return true;
        }
        finally {
            spy.jmxCloseServer();
        }
    }
View Full Code Here

TOP

Related Classes of com.trendmicro.mist.BrokerSpy

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.