您的位置:首页 > 大数据 > 人工智能

jedis中的JedisPoolConfig没有setMaxActive和setMaxWait属性

2016-10-13 15:38 489 查看
下载了最新的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  ==>  maxTotal
maxWait ==> maxWaitMillis
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: