jedis中的JedisPoolConfig没有setMaxActive和setMaxWait属性

来源:互联网 发布:网络上赌博赢了5千万 编辑:程序博客网 时间:2024/05/22 06:20

下载了最新的jedis jar包,2.7.2,使用中发现直接使用jedis api操作,JedisPoolConfig没有setMaxActive和setMaxWait属性
下面是可见的一段代码。

JedisPoolConfig config = new JedisPoolConfig();config.setMaxActive(Integer.valueOf(bundle.getString("redis.pool.maxActive")));config.setMaxIdle(Integer.valueOf(bundle.getString("redis.pool.maxIdle")));config.setMaxWait(Long.valueOf(bundle.getString("redis.pool.maxWait")));config.setTestOnBorrow(Boolean.valueOf(bundle.getString("redis.pool.testOnBorrow")));config.setTestOnReturn(Boolean.valueOf(bundle.getString("redis.pool.testOnReturn")));pool = new JedisPool(config, bundle.getString("redis.ip1"),Integer.valueOf(bundle.getString("redis.port")));

构造连接池配置文件,但是让我十分蛋疼的就是,setMaxActive和setMaxWait提示没这个方法,查看源码JedisPoolConfig继承至GenericObjectPoolConfig,其父类中确实也没有MaxActive这个属性,WHY?
最终发现解决方法:
pool2中修改如下:

maxActive  ==>  maxTotalmaxWait ==> maxWaitMillis
1 0
原创粉丝点击