Proxool支持一个连接数查看器,对于监控程序是否有连接释放很有好处,可惜最新的0.9.1版本有BUG,导致了以前的配置无法使用。网上有些办法说采用修改后打包jar,都OO了,弄那么复杂干啥,写个类直接覆盖几个方法就可以:
package com.mycompany;
public class ProxoolDataSource extends org.logicalcobwebs.proxool.ProxoolDataSource {
public void setHouseKeepingSleepTime(long houseKeepingSleepTime) {
super.setHouseKeepingSleepTime((int)houseKeepingSleepTime);
}
public void setMaximumConnectionLifetime(long maximumConnectionLifetime){
super.setMaximumConnectionLifetime((int)maximumConnectionLifetime);
}
public void setOverloadWithoutRefusalLifetime(long overloadWithoutRefusalLifetime) {
super.setOverloadWithoutRefusalLifetime((int)overloadWithoutRefusalLifetime);
}
public void setRecentlyStartedThreshold(long recentlyStartedThreshold) {
super.setRecentlyStartedThreshold((int)recentlyStartedThreshold);
}
}
然后在spring配置里指向这个类,完工
针对Proxool 0.9.1版本中存在的BUG,本文介绍了一种简单的方法来解决连接池配置失效的问题。通过继承`ProxoolDataSource`类并覆盖几个关键方法,可以有效监控连接数并确保连接正常释放。
314

被折叠的 条评论
为什么被折叠?



