Advertisement

Redis工具库

阅读量:

出现"Could not get a resource from the pool"这一错误的应对措施归纳如下:

1. 参数配置不当,可能与连接池容量不足存在关联

2. 与jedis库的版本兼容性问题相关(重点阐述该方面内容

  1. 服务器运行效能不足所致

问题:当前所采用的redis版本为2.9.0,关闭redis的操作方式为:

复制代码
 public String get(String key) {

    
     Jedis redis = null;
    
     try {
    
     redis = redisPool.getResource();
    
     return redis.get(key);
    
     } catch (JedisConnectionException e) {
    
     if (redis != null) {
    
         redisPool.returnBrokenResource(redis);
    
         redis = null;
    
     }
    
     throw e;
    
     } finally {
    
     if (redis != null) {
    
         re

全部评论 (0)

还没有任何评论哟~