@@ -281,7 +281,6 @@ protected Jedis fetchJedisConnector() {
281
281
// force initialization (see Jedis issue #82)
282
282
jedis .connect ();
283
283
284
- potentiallySetClientName (jedis );
285
284
return jedis ;
286
285
} catch (Exception ex ) {
287
286
throw new RedisConnectionFailureException ("Cannot get Jedis connection" , ex );
@@ -361,7 +360,7 @@ private JedisClientConfig createClientConfig(@Nullable String username, RedisPas
361
360
builder .connectionTimeoutMillis (getConnectTimeout ());
362
361
builder .socketTimeoutMillis (getReadTimeout ());
363
362
364
- builder .databse (getDatabase ());
363
+ builder .database (getDatabase ());
365
364
366
365
if (!ObjectUtils .isEmpty (username )) {
367
366
builder .user (username );
@@ -498,8 +497,15 @@ public RedisConnection getConnection() {
498
497
}
499
498
500
499
Jedis jedis = fetchJedisConnector ();
501
- JedisConnection connection = (getUsePool () ? new JedisConnection (jedis , pool , getDatabase (), getClientName ())
502
- : new JedisConnection (jedis , null , getDatabase (), getClientName ()));
500
+ JedisClientConfig sentinelConfig = this .clientConfig ;
501
+
502
+ SentinelConfiguration sentinelConfiguration = getSentinelConfiguration ();
503
+ if (sentinelConfiguration != null ) {
504
+ sentinelConfig = createClientConfig (null , sentinelConfiguration .getSentinelPassword ());
505
+ }
506
+
507
+ JedisConnection connection = (getUsePool () ? new JedisConnection (jedis , pool , this .clientConfig , sentinelConfig )
508
+ : new JedisConnection (jedis , null , this .clientConfig , sentinelConfig ));
503
509
connection .setConvertPipelineAndTxResults (convertPipelineAndTxResults );
504
510
return postProcessConnection (connection );
505
511
}
@@ -896,7 +902,7 @@ private Jedis getActiveSentinel() {
896
902
return jedis ;
897
903
}
898
904
} catch (Exception ex ) {
899
- log .warn (String .format ("Ping failed for sentinel host:%s" , node .getHost ()), ex );
905
+ log .warn (String .format ("Ping failed for sentinel host: %s" , node .getHost ()), ex );
900
906
} finally {
901
907
if (!success && jedis != null ) {
902
908
jedis .close ();
@@ -922,10 +928,6 @@ private static Set<HostAndPort> convertToJedisSentinelSet(Collection<RedisNode>
922
928
return convertedNodes ;
923
929
}
924
930
925
- private void potentiallySetClientName (Jedis jedis ) {
926
- clientConfiguration .getClientName ().ifPresent (jedis ::clientSetname );
927
- }
928
-
929
931
private int getReadTimeout () {
930
932
return Math .toIntExact (clientConfiguration .getReadTimeout ().toMillis ());
931
933
}
0 commit comments