• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MQAdminExt类的典型用法和代码示例

java 2次浏览

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

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

示例1: fetchMasterAddrByClusterName

点赞 2

import com.alibaba.rocketmq.tools.admin.MQAdminExt; //导入依赖的package包/类
public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName)
        throws InterruptedException, RemotingConnectException, RemotingTimeoutException,
        RemotingSendRequestException, MQBrokerException {
    Set<String> masterSet = new HashSet<String>();

    ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();

    Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName);

    if (brokerNameSet != null) {
        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
                if (addr != null) {
                    masterSet.add(addr);
                }
            }
        }
    }
    else {
        System.out
            .printf("[error] Make sure the specified clusterName exists or the nameserver which connected is correct.");
    }

    return masterSet;
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:29,
代码来源:CommandUtil.java

示例2: fetchBrokerNameByClusterName

点赞 2

import com.alibaba.rocketmq.tools.admin.MQAdminExt; //导入依赖的package包/类
public static Set<String> fetchBrokerNameByClusterName(final MQAdminExt adminExt, final String clusterName)
        throws Exception {
    ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();
    Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName);
    if (brokerNameSet.isEmpty()) {
        throw new Exception(
            "Make sure the specified clusterName exists or the nameserver which connected is correct.");
    }
    return brokerNameSet;
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:11,
代码来源:CommandUtil.java

示例3: fetchBrokerNameByAddr

点赞 2

import com.alibaba.rocketmq.tools.admin.MQAdminExt; //导入依赖的package包/类
public static String fetchBrokerNameByAddr(final MQAdminExt adminExt, final String addr) throws Exception {
    ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();
    HashMap<String/* brokerName */, BrokerData> brokerAddrTable =
            clusterInfoSerializeWrapper.getBrokerAddrTable();
    Iterator<Map.Entry<String, BrokerData>> it = brokerAddrTable.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<String, BrokerData> entry = it.next();
        HashMap<Long, String> brokerAddrs = entry.getValue().getBrokerAddrs();
        if (brokerAddrs.containsValue(addr))
            return entry.getKey();
    }
    throw new Exception(
        "Make sure the specified broker addr exists or the nameserver which connected is correct.");
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:15,
代码来源:CommandUtil.java

示例4: threadLocalMQAdminExt

点赞 2

import com.alibaba.rocketmq.tools.admin.MQAdminExt; //导入依赖的package包/类
public static MQAdminExt threadLocalMQAdminExt() {
    DefaultMQAdminExt defaultMQAdminExt = mqAdminExtThreadLocal.get();
    if (defaultMQAdminExt == null) {
        throw new IllegalStateException("defaultMQAdminExt should be init before you get this");
    }
    return defaultMQAdminExt;
}
 

开发者ID:didapinchegit,
项目名称:rocket-console,
代码行数:8,
代码来源:MQAdminInstance.java

示例5: destroyMQAdminInstance

点赞 2

import com.alibaba.rocketmq.tools.admin.MQAdminExt; //导入依赖的package包/类
public static void destroyMQAdminInstance() {
    Integer nowCount = initCounter.get() - 1;
    if (nowCount > 0) {
        initCounter.set(nowCount);
        return;
    }
    MQAdminExt mqAdminExt = mqAdminExtThreadLocal.get();
    if (mqAdminExt != null) {
        mqAdminExt.shutdown();
        mqAdminExtThreadLocal.remove();
        initCounter.remove();
    }
}
 

开发者ID:didapinchegit,
项目名称:rocket-console,
代码行数:14,
代码来源:MQAdminInstance.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)