简体   繁体   English

JMX Bean适用于几种类型的请求

[英]JMX Bean for few types of Requests

I want to show performance statistics for particular request type. 我想显示特定请求类型的性能统计信息。 When Controller class gets the HTTP Request from browser, it then marshals request xml in to a request object. 当Controller类从浏览器获取HTTP请求时,它将把请求xml编组到请求对象中。 From request object I can get request type. 从请求对象中,我可以获取请求类型。
Is it possible to inject JMX MBeans for particular request type and broadcast it to JConsole? 是否可以为特定请求类型注入JMX MBean并将其广播到JConsole?

Is it possible to inject JMX MBeans for particular request type and broadcast it to JConsole? 是否可以为特定请求类型注入JMX MBean并将其广播到JConsole?

Jconsole does polling of statistics and you can't "broadcast" a request type that you define since that class won't be in the Jconsole jar. Jconsole会轮询统计信息,并且您不能“广播”您定义的请求类型,因为该类将不在Jconsole jar中。

What you can do is keep a count of the request types in a map and then return a String[] of type -> count string output if you like. 您可以做的是在映射中保留请求类型的计数,然后根据需要返回type -> countString[] type -> count string输出。 Something like: 就像是:

public String[] getResultTypeCount() {
     List<String> list = new ArrayList<String>();
     for (Map.Entry<String, Integer> entry : typeMap.entrySet()) {
         list.add(entry.getKey() + " => " + entry.getValue());
     }
     return list.toArray(new String[list.size()]);
}

You might want to look into JMX notifications . 您可能需要研究JMX通知

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM