唯's Blog

笔者是一个热爱编程的 Java 程序员。

0%

JMS_MBean

Mbean

用JMX把需要配置的属性集中在一个类中,然后写一个MBean,再进行相关配置。另外JMX还提供了一个工具页,以方便我们对参数值进行修改。

1
2
3
4
5
6
7
8
9
10
11
12
13

final ObjectName beanConfigName = new ObjectName("com.zaxxer.hikari:type=PoolConfig (" + poolName + ")");

final ObjectName beanPoolName = new ObjectName("com.zaxxer.hikari:type=Pool (" + poolName + ")");

if (!mBeanServer.isRegistered(beanConfigName)) {

mBeanServer.registerMBean(config, beanConfigName);

mBeanServer.registerMBean(hikariPool, beanPoolName);

}