Adapt to changes in Jedis 3.6.

Closes #2017
Original Pull Request: #2021
This commit is contained in:
Mark Paluch
2021-03-24 12:03:32 +01:00
committed by Christoph Strobl
parent 4a2abdcd9b
commit 284dfbcca6
6 changed files with 28 additions and 23 deletions

View File

@@ -274,7 +274,7 @@ class JedisClusterStreamCommands implements RedisStreamCommands {
try {
List<byte[]> response = connection.getCluster().xpending(key, group,
List<Object> response = connection.getCluster().xpending(key, group,
JedisConverters.toBytes(getLowerValue(range)), JedisConverters.toBytes(getUpperValue(range)),
options.getCount().intValue(), JedisConverters.toBytes(options.getConsumerName()));

View File

@@ -118,7 +118,7 @@ public class JedisConnection extends AbstractRedisConnection {
}
private static DefaultJedisClientConfig createConfig(int dbIndex, @Nullable String clientName) {
return DefaultJedisClientConfig.builder().databse(dbIndex).clientName(clientName).build();
return DefaultJedisClientConfig.builder().database(dbIndex).clientName(clientName).build();
}
/**

View File

@@ -281,7 +281,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
// force initialization (see Jedis issue #82)
jedis.connect();
potentiallySetClientName(jedis);
return jedis;
} catch (Exception ex) {
throw new RedisConnectionFailureException("Cannot get Jedis connection", ex);
@@ -361,7 +360,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
builder.connectionTimeoutMillis(getConnectTimeout());
builder.socketTimeoutMillis(getReadTimeout());
builder.databse(getDatabase());
builder.database(getDatabase());
if (!ObjectUtils.isEmpty(username)) {
builder.user(username);
@@ -498,8 +497,15 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
}
Jedis jedis = fetchJedisConnector();
JedisConnection connection = (getUsePool() ? new JedisConnection(jedis, pool, getDatabase(), getClientName())
: new JedisConnection(jedis, null, getDatabase(), getClientName()));
JedisClientConfig sentinelConfig = this.clientConfig;
SentinelConfiguration sentinelConfiguration = getSentinelConfiguration();
if (sentinelConfiguration != null) {
sentinelConfig = createClientConfig(null, sentinelConfiguration.getSentinelPassword());
}
JedisConnection connection = (getUsePool() ? new JedisConnection(jedis, pool, this.clientConfig, sentinelConfig)
: new JedisConnection(jedis, null, this.clientConfig, sentinelConfig));
connection.setConvertPipelineAndTxResults(convertPipelineAndTxResults);
return postProcessConnection(connection);
}
@@ -896,7 +902,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
return jedis;
}
} catch (Exception ex) {
log.warn(String.format("Ping failed for sentinel host:%s", node.getHost()), ex);
log.warn(String.format("Ping failed for sentinel host: %s", node.getHost()), ex);
} finally {
if (!success && jedis != null) {
jedis.close();
@@ -922,10 +928,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
return convertedNodes;
}
private void potentiallySetClientName(Jedis jedis) {
clientConfiguration.getClientName().ifPresent(jedis::clientSetname);
}
private int getReadTimeout() {
return Math.toIntExact(clientConfiguration.getReadTimeout().toMillis());
}