首页  

dubbo获取线程池等信息     所属分类 dubbo 浏览量 1055
telnet 可获取 状态信息
 dubbo telnet 命令使用 

dubbo>status -l 
+------------+--------+--------------------------------------------------------+
| resource   | status | message                                                |
+------------+--------+--------------------------------------------------------+
| threadpool | OK     | Pool status:OK, max:10, core:10, largest:10, active:1, task:93, service port: 20882 |
| load       | OK     | load:0.1,cpu:32                                        |
| memory     | OK     | max:27305M,total:2077M,used:910M,free:1167M            |
| server     | OK     | /10.57.31.22:20882(clients:4)                          |
| registry   | OK     | 127.0.0.1:6001(connected)                              |
| spring     | OK     | classpath:spring/dubbo-provider.xml                    |
| summary    | OK     |                                                        |
+------------+--------+--------------------------------------------------------+

status命令处理类
com.alibaba.dubbo.remoting.telnet.support.command.StatusTelnetHandler


ExtensionLoader<StatusChecker> extensionLoader = ExtensionLoader.getExtensionLoader(StatusChecker.class);
List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), "status");

com.alibaba.dubbo.common.status.StatusChecker 有以下实现

DataSourceStatusChecker
LoadStatusChecker
MemoryStatusChecker
RegistryStatusChecker    注册中心信息
ServerStatusChecker      dubbo 连接信息
SpringStatusChecker
ThreadPoolStatusChecker  线程池信息

参考各个StatusChecker实现代码 ,获取相关状态信息 及 监控指标



Collection<Registry> regsitries = AbstractRegistryFactory.getRegistries();
Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers();
	
DataStore dataStore = ExtensionLoader.getExtensionLoader(DataStore.class).getDefaultExtension();
Map<String, Object> executors = dataStore.get(Constants.EXECUTOR_SERVICE_COMPONENT_KEY);




实现代码 DubboStatusUtil

完整代码
https://gitee.com/dyyx/dubbodemo/blob/master/dubbo-hello-provider/src/main/java/dyyx/util/DubboStatusUtil.java

上一篇     下一篇
做好项目管理的七个技巧

BlockingQueue add offer put 区别

dubbo注册过程简介

dubbo SPI 机制简介

dubbo各个模块简介

基于netty的RESTFUL框架