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配置里指向这个类,完工