• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java KVTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public byte[] getKVListByNamespace(final String namespace) {
    try {
        this.lock.readLock().lockInterruptibly();
        try {
            HashMap<String, String> kvTable = this.configTable.get(namespace);
            if (null != kvTable) {
                KVTable table = new KVTable();
                table.setTable(kvTable);
                return table.encode();
            }
        }
        finally {
            this.lock.readLock().unlock();
        }
    }
    catch (InterruptedException e) {
        log.error("getKVListByNamespace InterruptedException", e);
    }

    return null;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:22,代码来源:KVConfigManager.java


示例2: list

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
    public Map<String, Object> list() {
        try {
            Map<String, Object> resultMap = Maps.newHashMap();
            ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
            logger.info("op=look_clusterInfo {}", JsonUtil.obj2String(clusterInfo));
            Map<String/*brokerName*/, Map<Long/* brokerId */, Object/* brokerDetail */>> brokerServer = Maps.newHashMap();
            for (BrokerData brokerData : clusterInfo.getBrokerAddrTable().values()) {
                Map<Long, Object> brokerMasterSlaveMap = Maps.newHashMap();
                for (Map.Entry<Long/* brokerId */, String/* broker address */> brokerAddr : brokerData.getBrokerAddrs().entrySet()) {
                    KVTable kvTable = mqAdminExt.fetchBrokerRuntimeStats(brokerAddr.getValue());
//                KVTable kvTable = mqAdminExt.fetchBrokerRuntimeStats("127.0.0.1:10911");
                    brokerMasterSlaveMap.put(brokerAddr.getKey(), kvTable.getTable());
                }
                brokerServer.put(brokerData.getBrokerName(), brokerMasterSlaveMap);
            }
            resultMap.put("clusterInfo", clusterInfo);
            resultMap.put("brokerServer", brokerServer);
            return resultMap;
        } catch (Exception err) {
            throw Throwables.propagate(err);
        }
    }
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:24,代码来源:ClusterServiceImpl.java


示例3: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public byte[] getKVListByNamespace(final String namespace) {
    try {
        this.lock.readLock().lockInterruptibly();
        try {
            HashMap<String, String> kvTable = this.configTable.get(namespace);
            if (null != kvTable) {
                KVTable table = new KVTable();
                table.setTable(kvTable);
                return table.encode();
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (InterruptedException e) {
        log.error("getKVListByNamespace InterruptedException", e);
    }

    return null;
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:20,代码来源:KVConfigManager.java


示例4: brokerStats

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@CmdTrace(cmdClazz = BrokerStatusSubCommand.class)
public Table brokerStats(String brokerAddr) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);
        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());
        return Table.Map2VTable(tmp);
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:21,代码来源:BrokerService.java


示例5: getBrokerRuntimeInfo

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public KVTable getBrokerRuntimeInfo(final String addr, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_RUNTIME_INFO, null);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:19,代码来源:MQClientAPIImpl.java


示例6: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
/**
 * Name Server: 获取指定Namespace下的所有KV
 */
public KVTable getKVListByNamespace(final String namespace, final long timeoutMillis)
        throws RemotingException, MQClientException, InterruptedException {
    GetKVListByNamespaceRequestHeader requestHeader = new GetKVListByNamespaceRequestHeader();
    requestHeader.setNamespace(namespace);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_KVLIST_BY_NAMESPACE, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:24,代码来源:MQClientAPIImpl.java


示例7: getBrokerRuntimeInfo

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public KVTable getBrokerRuntimeInfo(final String addr, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_BROKER_RUNTIME_INFO_VALUE, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:18,代码来源:MQClientAPIImpl.java


示例8: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
/**
 * Name Server: 获取指定Namespace下的所有KV
 */
public KVTable getKVListByNamespace(final String namespace, final long timeoutMillis)
        throws RemotingException, MQClientException, InterruptedException {
    GetKVListByNamespaceRequestHeader requestHeader = new GetKVListByNamespaceRequestHeader();
    requestHeader.setNamespace(namespace);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_KVLIST_BY_NAMESPACE_VALUE,
                requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:25,代码来源:MQClientAPIImpl.java


示例9: execute

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String brokerAddr = commandLine.getOptionValue('b').trim();

        //获取broker一些全局统计信息 例如commitlog  全局offset等信息
        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());

        Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
        while (it.hasNext()) {
            Entry<String, String> next = it.next();
            System.out.printf("%-32s: %s\n", next.getKey(), next.getValue());
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:31,代码来源:BrokerStatusSubCommand.java


示例10: execute

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String brokerAddr = commandLine.getOptionValue('b').trim();

        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());

        Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
        while (it.hasNext()) {
            Entry<String, String> next = it.next();
            System.out.printf("%-32s: %s\n", next.getKey(), next.getValue());
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:30,代码来源:BrokerStatusSubCommand.java


示例11: execute

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String brokerAddr = commandLine.getOptionValue('b').trim();

        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

        // 为了排序
        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());

        Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
        while (it.hasNext()) {
            Entry<String, String> next = it.next();
            System.out.printf("%-32s: %s\n", next.getKey(), next.getValue());
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:31,代码来源:BrokerStatsSubCommand.java


示例12: getBrokerRuntimeInfo

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
private RemotingCommand getBrokerRuntimeInfo(ChannelHandlerContext ctx, RemotingCommand request) {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    HashMap<String, String> runtimeInfo = this.prepareRuntimeInfo();
    KVTable kvTable = new KVTable();
    kvTable.setTable(runtimeInfo);

    byte[] body = kvTable.encode();
    response.setBody(body);
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:14,代码来源:AdminBrokerProcessor.java


示例13: getBrokerRuntimeInfo

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
private RemotingCommand getBrokerRuntimeInfo(ChannelHandlerContext ctx, RemotingCommand request) {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    HashMap<String, String> runtimeInfo = this.prepareRuntimeInfo();
    KVTable kvTable = new KVTable();
    kvTable.setTable(runtimeInfo);

    byte[] body = kvTable.encode();
    response.setBody(body);
    response.setCode(ResponseCode.SUCCESS_VALUE);
    response.setRemark(null);
    return response;
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:14,代码来源:AdminBrokerProcessor.java


示例14: printClusterMoreStats

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
        RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s\n",//
        "#Cluster Name",//
        "#Broker Name",//
        "#InTotalYest",//
        "#OutTotalYest",//
        "#InTotalToday",//
        "#OutTotalToday"//
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

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

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long InTotalYest = 0;
                    long OutTotalYest = 0;
                    long InTotalToday = 0;
                    long OutTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        InTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        OutTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        InTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        OutTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    }
                    catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d\n",//
                        clusterName,//
                        brokerName,//
                        InTotalYest,//
                        OutTotalYest,//
                        InTotalToday,//
                        OutTotalToday//
                        );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.println("");
        }
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:70,代码来源:ClusterListSubCommand.java


示例15: getKvTable

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public KVTable getKvTable() {
    return kvTable;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:4,代码来源:RegisterBrokerResult.java


示例16: setKvTable

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
public void setKvTable(KVTable kvTable) {
    this.kvTable = kvTable;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:4,代码来源:RegisterBrokerResult.java


示例17: fetchBrokerRuntimeStats

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public KVTable fetchBrokerRuntimeStats(String brokerAddr)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {
    return MQAdminInstance.threadLocalMQAdminExt().fetchBrokerRuntimeStats(brokerAddr);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:7,代码来源:MQAdminExtImpl.java


示例18: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public KVTable getKVListByNamespace(String namespace)
        throws RemotingException, MQClientException, InterruptedException {
    return MQAdminInstance.threadLocalMQAdminExt().getKVListByNamespace(namespace);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:6,代码来源:MQAdminExtImpl.java


示例19: fetchBrokerRuntimeStats

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public KVTable fetchBrokerRuntimeStats(final String brokerAddr) throws RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {
    return this.defaultMQAdminExtImpl.fetchBrokerRuntimeStats(brokerAddr);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExt.java


示例20: getKVListByNamespace

import com.alibaba.rocketmq.common.protocol.body.KVTable; //导入依赖的package包/类
@Override
public KVTable getKVListByNamespace(String namespace) throws RemotingException, MQClientException,
        InterruptedException {
    return defaultMQAdminExtImpl.getKVListByNamespace(namespace);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExt.java



注:本文中的com.alibaba.rocketmq.common.protocol.body.KVTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SqlFunction类代码示例发布时间:2022-05-22
下一篇:
Java WritableSerialization类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap