开发者

JMX MBean to manage dynamic set of properties

开发者 https://www.devze.com 2023-04-09 10:09 出处:网络
The problem might soun开发者_如何学编程d similar to many resolved ones, but I did not shoot this target yet.

The problem might soun开发者_如何学编程d similar to many resolved ones, but I did not shoot this target yet.

I am about to create a MBean that will allow me to specify dynamic set of key-value pairs.

(It is easy to create a solution to specify pre-defined set of params. But what about dynamic ones)

The most relevant code snippets i could find was usage of CompositeData, TabularData

The api is next:

applyNewProperties(Properties props)

UI is next:

mbean method applyNewProperties

Parameters: props

name1  value1
name2  value2
name3  value3
.....
namen value n

The purpose is that jmx-connsole would show it in table form:

input name 1 input value 1
input name 2 input value 2
input name 3 input value 3
....
input name n input value n


The easiest approach would probably be to create an MXBean (which is available since Java 6) which allows you to return objects like maps (or completely custom objects) which are then mapped into Open Types like CompositeData or TabularData instances.


Java 7 brought us DynamicMBean - https://docs.oracle.com/javase/7/docs/api/javax/management/DynamicMBean.html

I believe that's what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号