Looking for help with HikariConfigMXBean to dynamically change setMaximumPoolSize at runtime.

1,427 views
Skip to first unread message

ME Jones

unread,
Feb 6, 2018, 4:45:33 PM2/6/18
to HikariCP
Hi All,

I am trying to dynamically adjust the Max Pool Size at runtime, however continue to get the following (attached pic) error.










Here is the code snippet. 
I can obtain a reference to the PoolMXBean and see idleConnections, but when i get a reference to the ConfigMXBean and try to adjust Max Pool Size i get the error listed above.
"The configuration of the pool is sealed once started.  Use HikariConfigMXBean for runtime changes."

Any help is appreciated.
Thanks,

                                            try {
                                                MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
                                                ObjectName poolName = new ObjectName(MessageFormat.format("com.zaxxer.hikari:type=Pool ({0})", jtdsHikariDataSource.getPoolName()));
                                                HikariPoolMXBean poolProxy = JMX.newMXBeanProxy(mBeanServer, poolName, HikariPoolMXBean.class);
                                                HikariConfigMXBean hikariConfigMXBean = JMX.newMXBeanProxy(mBeanServer, poolName, HikariConfigMXBean.class);
                                                hikariConfigMXBean.setMaximumPoolSize(currentPoolSize);
                                                int idleConnections = poolProxy.getIdleConnections();
//                                                HikariConfigMXBean hikariConfigMXBean = jtdsHikariDataSource.getHikariConfigMXBean();
//                                                hikariConfigMXBean.setMaximumPoolSize(currentPoolSize);
//                                                jtdsHikariDataSource.setMaximumPoolSize(currentPoolSize);
                                                compareMaximumPoolSize = currentPoolSize;
                                                System.out.println(MessageFormat.format("jtdsHikariDataSource.getMaximumPoolSize = {0}", String.valueOf(jtdsHikariDataSource.getMaximumPoolSize())));
                                                poolProxy = null;
                                                hikariConfigMXBean = null;
                                            } catch (MalformedObjectNameException malformedObjectNameException) {
                                                Helper.logStackTrace(malformedObjectNameException);
                                            }


Brett Wooldridge

unread,
Feb 7, 2018, 9:38:08 AM2/7/18
to HikariCP
This was a bug.  I have just fixed it, and will be releasing a new binary shortly.

-Brett

ME Jones

unread,
Feb 7, 2018, 11:35:33 AM2/7/18
to HikariCP
Thanks Brett,
Reply all
Reply to author
Forward
0 new messages