DATAREDIS-524 - Polishing.
Some formatting changes. Original Pull Request: #204
This commit is contained in:
@@ -120,26 +120,18 @@ public class DefaultLettucePool implements LettucePool, InitializingBean {
|
||||
*/
|
||||
private RedisURI getRedisURI() {
|
||||
|
||||
if (isRedisSentinelAware()) {
|
||||
RedisURI redisURI = LettuceConverters.sentinelConfigurationToRedisURI(sentinelConfiguration);
|
||||
RedisURI redisUri = isRedisSentinelAware()
|
||||
? LettuceConverters.sentinelConfigurationToRedisURI(sentinelConfiguration) : createSimpleHostRedisURI();
|
||||
|
||||
if (StringUtils.hasText(password)) {
|
||||
redisURI.setPassword(password);
|
||||
}
|
||||
|
||||
return redisURI;
|
||||
if (StringUtils.hasText(password)) {
|
||||
redisUri.setPassword(password);
|
||||
}
|
||||
|
||||
return createSimpleHostRedisURI();
|
||||
return redisUri;
|
||||
}
|
||||
|
||||
private RedisURI createSimpleHostRedisURI() {
|
||||
RedisURI.Builder builder = RedisURI.Builder.redis(hostName, port);
|
||||
if (password != null) {
|
||||
builder.withPassword(password);
|
||||
}
|
||||
builder.withTimeout(timeout, TimeUnit.MILLISECONDS);
|
||||
return builder.build();
|
||||
return RedisURI.Builder.redis(hostName, port).withTimeout(timeout, TimeUnit.MILLISECONDS).build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -68,6 +68,7 @@ import com.lambdaworks.redis.resource.ClientResources;
|
||||
* @author Costin Leau
|
||||
* @author Jennifer Hickey
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Balázs Németh
|
||||
*/
|
||||
@@ -608,13 +609,13 @@ public class LettuceConnectionFactory implements InitializingBean, DisposableBea
|
||||
|
||||
private RedisURI getSentinelRedisURI() {
|
||||
|
||||
RedisURI redisURI = LettuceConverters.sentinelConfigurationToRedisURI(sentinelConfiguration);
|
||||
RedisURI redisUri = LettuceConverters.sentinelConfigurationToRedisURI(sentinelConfiguration);
|
||||
|
||||
if (StringUtils.hasText(password)) {
|
||||
redisURI.setPassword(password);
|
||||
redisUri.setPassword(password);
|
||||
}
|
||||
|
||||
return redisURI;
|
||||
return redisUri;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,6 +635,7 @@ public class LettuceConnectionFactory implements InitializingBean, DisposableBea
|
||||
|
||||
@Override
|
||||
public RedisSentinelConnection getSentinelConnection() {
|
||||
|
||||
if (!(client instanceof RedisClient)) {
|
||||
throw new InvalidDataAccessResourceUsageException("Unable to connect to sentinels using " + client.getClass());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user