diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java index 3862d9155..fac83394d 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java @@ -65,6 +65,7 @@ import org.springframework.data.redis.core.types.Expiration; import org.springframework.data.redis.core.types.RedisClientInfo; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; +import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; @@ -770,7 +771,7 @@ public class JedisConnection extends AbstractRedisConnection { throw new InvalidDataAccessApiUsageException("No ongoing transaction. Did you forget to call multi?"); } List results = transaction.exec(); - return convertPipelineAndTxResults && results != null && !results.isEmpty() + return convertPipelineAndTxResults && !CollectionUtils.isEmpty(results) ? new TransactionResultConverter>(txResults, JedisConverters.exceptionConverter()) .convert(results) : results; @@ -3401,19 +3402,13 @@ public class JedisConnection extends AbstractRedisConnection { .geoRadiusResponseToGeoResultsConverter(within.getRadius().getMetric()); try { if (isPipelined()) { - pipeline( - new JedisResult( - pipeline.georadius(key, within.getCenter().getX(), within.getCenter().getY(), - within.getRadius().getValue(), JedisConverters.toGeoUnit(within.getRadius().getMetric())), - converter)); + pipeline(new JedisResult(pipeline.georadius(key, within.getCenter().getX(), within.getCenter().getY(), + within.getRadius().getValue(), JedisConverters.toGeoUnit(within.getRadius().getMetric())), converter)); return null; } if (isQueueing()) { - transaction( - new JedisResult( - transaction.georadius(key, within.getCenter().getX(), within.getCenter().getY(), - within.getRadius().getValue(), JedisConverters.toGeoUnit(within.getRadius().getMetric())), - converter)); + transaction(new JedisResult(transaction.georadius(key, within.getCenter().getX(), within.getCenter().getY(), + within.getRadius().getValue(), JedisConverters.toGeoUnit(within.getRadius().getMetric())), converter)); return null; } diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java index 51721012a..4db269daf 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java @@ -266,18 +266,16 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, */ protected Pool createRedisPool() { - return useSsl - ? new JedisPool(getPoolConfig(), getShardInfo().getHost(), getShardInfo().getPort(), - getTimeoutFrom(getShardInfo()), getShardInfo().getPassword(), true) - : new JedisPool(getPoolConfig(), getShardInfo().getHost(), getShardInfo().getPort(), - getTimeoutFrom(getShardInfo()), getShardInfo().getPassword()); + return new JedisPool(getPoolConfig(), getShardInfo().getHost(), getShardInfo().getPort(), + getTimeoutFrom(getShardInfo()), getShardInfo().getPassword(), useSsl); } private JedisCluster createCluster() { JedisCluster cluster = createCluster(this.clusterConfig, this.poolConfig); - this.clusterCommandExecutor = new ClusterCommandExecutor(new JedisClusterConnection.JedisClusterTopologyProvider( - cluster), new JedisClusterConnection.JedisClusterNodeResourceProvider(cluster), EXCEPTION_TRANSLATION); + this.clusterCommandExecutor = new ClusterCommandExecutor( + new JedisClusterConnection.JedisClusterTopologyProvider(cluster), + new JedisClusterConnection.JedisClusterNodeResourceProvider(cluster), EXCEPTION_TRANSLATION); return cluster; } @@ -300,14 +298,8 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, int redirects = clusterConfig.getMaxRedirects() != null ? clusterConfig.getMaxRedirects().intValue() : 5; - if (poolConfig != null) { - return StringUtils.hasText(getPassword()) - ? new JedisCluster(hostAndPort, timeout, timeout, redirects, getPassword(), poolConfig) - : new JedisCluster(hostAndPort, timeout, redirects, poolConfig); - } - return StringUtils.hasText(getPassword()) - ? new JedisCluster(hostAndPort, timeout, timeout, redirects, getPassword(), poolConfig) + ? new JedisCluster(hostAndPort, timeout, timeout, redirects, password, poolConfig) : new JedisCluster(hostAndPort, timeout, redirects, poolConfig); } @@ -349,8 +341,8 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, } Jedis jedis = fetchJedisConnector(); - JedisConnection connection = (usePool ? new JedisConnection(jedis, pool, dbIndex) : new JedisConnection(jedis, - null, dbIndex)); + JedisConnection connection = (usePool ? new JedisConnection(jedis, pool, dbIndex) + : new JedisConnection(jedis, null, dbIndex)); connection.setConvertPipelineAndTxResults(convertPipelineAndTxResults); return postProcessConnection(connection); }