下载了最新的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