Could not get a resource from the pool 错误分析
来源:互联网 发布:flash cc mac 编辑:程序博客网 时间:2024/06/05 11:41
1 Could not get a resource from the pool
1.1 当jedispool中的jedis被取完 等待超过你设置的 MaxWaitMillis 就会抛出Could not get a resource from the pool
if(p == null) {
if(borrowMaxWaitMillis < 0L) {
p = (PooledObject)this.idleObjects.takeFirst();
} else {
waitTime = System.currentTimeMillis();
p = (PooledObject)this.idleObjects.pollFirst(borrowMaxWaitMillis, TimeUnit.MILLISECONDS);
waitTime = System.currentTimeMillis() - waitTime; //等待时间超过 borrowMaxWaitMillis 的时候 p =null
}
}
if(p == null) {
throw new NoSuchElementException("Timeout waiting for idle object"); 抛出异常 被pool这个类捕捉
}
pool 源码
try {
return this.internalPool.borrowObject();
} catch (Exception var2) {
throw new JedisConnectionException("Could not get a resource from the pool", var2);
}
所以只要把jedis配置MaxWaitMillis 设置的大一点 就可以降低 由于MaxWaitMillis 导致的
Could not get a resource from the pool
1.2 加快从jedispool中获取get jedis 和return jedis的 速度
从GenericObjectPool 源代码borrowObject(long borrowMaxWaitMillis)方法可以看出
boolean validate = false;
Throwable validationThrowable1 = null;
try {
validate = this.factory.validateObject(p); 获取直接先验证是否可以用
} catch (Throwable var13) {
PoolUtils.checkRethrow(var13);
validationThrowable1 = var13;
}
try {
return jedis.isConnected() && jedis.ping().equals("PONG");
} catch (Exception var4) {
return false;
}
操作jedis 的时候 设置 testOnBorrow、testOnReturn 都改为false 要比true 快上1.4倍
- Could not get a resource from the pool 错误分析
- redis JedisConnectionException: Could not get a resource from the pool
- Could not get a resource from the pool
- Could not get a resource from the pool
- Redis:Could not get a resource from the pool
- Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
- redis---Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
- 急求大婶指导redis Could not get a resource from the pool 异常
- Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- 处理应用端连接redis报could not get a resource from the pool问题
- redis提示Could not get a resource from the pool(jedis连接池配置)
- Invocation of init method failed; Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- 为tomcat分配内存
- linux 管道重定向
- 我没有解决的蜜汁错误
- ToolBar的使用
- 列表和元组
- Could not get a resource from the pool 错误分析
- NDK 配置到实现(Eclipse)
- 缓存机制
- 290.Word Pattern--hashmap使用,字符匹配
- HTML5基础-Mark标签高亮显示文本
- SeaJS与RequireJS
- 使用nginx lua实现网站统计中的数据收集
- 左滑删除,iOScell设置
- unity3d小常识