Java Code Examples for redis.clients.jedis.ShardedJedisPool#returnBrokenResource()

The following examples show how to use redis.clients.jedis.ShardedJedisPool#returnBrokenResource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 2
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 3
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 4
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 5
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 6
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 7
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 8
Source File: RedisCommand.java    From netty-cookbook with Apache License 2.0 5 votes vote down vote up
public static void freeRedisResource(ShardedJedisPool jedisPool, ShardedJedis shardedJedis, boolean isCommited){
	if (shardedJedis != null && jedisPool != null) {			
		if (isCommited) {				
			jedisPool.returnResource(shardedJedis);
		} else {
			jedisPool.returnBrokenResource(shardedJedis);
		}
	}
}
 
Example 9
Source File: JRedisCache.java    From springJredisCache with Apache License 2.0 3 votes vote down vote up
/**
 * 运行时异常,IO异常,销毁jedis对象
 *
 * @param ex
 * @param shardedJedisPool
 * @param shardedJedis
 */
protected void coverShardJedisException(Exception ex, ShardedJedisPool shardedJedisPool, ShardedJedis shardedJedis) {
    if (shardedJedis == null) throw new NullPointerException();
    if (ex instanceof JRedisCacheException || ex instanceof IOException) {
        shardedJedisPool.returnBrokenResource(shardedJedis); //销毁该对象
    }
}