@@ -34,11 +34,6 @@ public JedisClusterConnectionHandler(Set<HostAndPort> nodes, final GenericObject
3434 this (nodes , poolConfig , connectionTimeout , soTimeout , infiniteSoTimeout , user , password , clientName , false , null , null , null , null );
3535 }
3636
37- public JedisClusterConnectionHandler (Set <HostAndPort > nodes , final GenericObjectPoolConfig poolConfig ,
38- final JedisSocketConfig socketConfig , String user , String password , String clientName ) {
39- this (nodes , poolConfig , socketConfig , 0 , user , password , clientName );
40- }
41-
4237 @ Deprecated
4338 public JedisClusterConnectionHandler (Set <HostAndPort > nodes , GenericObjectPoolConfig poolConfig ,
4439 int connectionTimeout , int soTimeout , String password , String clientName ,
@@ -47,13 +42,6 @@ public JedisClusterConnectionHandler(Set<HostAndPort> nodes, GenericObjectPoolCo
4742 this (nodes , poolConfig , connectionTimeout , soTimeout , null , password , clientName , ssl , sslSocketFactory , sslParameters , hostnameVerifier , portMap );
4843 }
4944
50- public JedisClusterConnectionHandler (Set <HostAndPort > nodes , GenericObjectPoolConfig poolConfig ,
51- int connectionTimeout , int soTimeout , String password , String clientName ,
52- boolean ssl , SSLSocketFactory sslSocketFactory , SSLParameters sslParameters ,
53- HostnameVerifier hostnameVerifier , HostAndPortMapper portMap ) {
54- this (nodes , poolConfig , connectionTimeout , soTimeout , null , password , clientName , ssl , sslSocketFactory , sslParameters , hostnameVerifier , portMap );
55- }
56-
5745 @ Deprecated
5846 public JedisClusterConnectionHandler (Set <HostAndPort > nodes , GenericObjectPoolConfig poolConfig ,
5947 int connectionTimeout , int soTimeout , String user , String password , String clientName ,
@@ -62,13 +50,6 @@ public JedisClusterConnectionHandler(Set<HostAndPort> nodes, GenericObjectPoolCo
6250 this (nodes , poolConfig , connectionTimeout , soTimeout , 0 , user , password , clientName , ssl , sslSocketFactory , sslParameters , hostnameVerifier , portMap );
6351 }
6452
65- public JedisClusterConnectionHandler (Set <HostAndPort > nodes , GenericObjectPoolConfig poolConfig ,
66- int connectionTimeout , int soTimeout , String user , String password , String clientName ,
67- boolean ssl , SSLSocketFactory sslSocketFactory , SSLParameters sslParameters ,
68- HostnameVerifier hostnameVerifier , HostAndPortMapper portMap ) {
69- this (nodes , poolConfig , connectionTimeout , soTimeout , 0 , user , password , clientName , ssl , sslSocketFactory , sslParameters , hostnameVerifier , portMap );
70- }
71-
7253 @ Deprecated
7354 public JedisClusterConnectionHandler (Set <HostAndPort > nodes , final GenericObjectPoolConfig poolConfig ,
7455 int connectionTimeout , int soTimeout , int infiniteSoTimeout , String user , String password , String clientName ,
@@ -85,29 +66,20 @@ public JedisClusterConnectionHandler(Set<HostAndPort> nodes, final GenericObject
8566 infiniteSoTimeout , user , password , clientName );
8667 }
8768
88- public JedisClusterConnectionHandler (Set <HostAndPort > nodes , final GenericObjectPoolConfig poolConfig ,
89- int connectionTimeout , int soTimeout , int infiniteSoTimeout , String user , String password , String clientName ,
90- boolean ssl , SSLSocketFactory sslSocketFactory , SSLParameters sslParameters ,
91- HostnameVerifier hostnameVerifier , HostAndPortMapper portMap ) {
92- this (nodes , poolConfig ,
93- DefaultJedisSocketConfig .builder ().withConnectionTimeout (connectionTimeout ).withSoTimeout (soTimeout )
94- .withSsl (ssl ).withSslSocketFactory (sslSocketFactory ).withSslParameters (sslParameters )
95- .withHostnameVerifier (hostnameVerifier ).withHostAndPortMapper (portMap ).build (),
96- infiniteSoTimeout , user , password , clientName );
97- }
98-
9969 @ Deprecated
10070 public JedisClusterConnectionHandler (Set <HostAndPort > nodes , final JedisSocketConfig seedNodesSocketConfig ,
10171 final GenericObjectPoolConfig poolConfig , final JedisSocketConfig clusterNodesSocketConfig ,
10272 int infiniteSoTimeout , String user , String password , String clientName ) {
103- this .cache = new JedisClusterInfoCache (poolConfig , clusterNodesSocketConfig , infiniteSoTimeout , user , password , clientName );
104- initializeSlotsCache (nodes , seedNodesSocketConfig , infiniteSoTimeout , user , password , clientName );
73+ final JedisClientConfig clientConfig = DefaultJedisClientConfig .builder ().withInfiniteSoTimeout (infiniteSoTimeout )
74+ .withUser (user ).withPassword (password ).withClinetName (clientName ).build ();
75+ this .cache = new JedisClusterInfoCache (poolConfig , clusterNodesSocketConfig , clientConfig );
76+ initializeSlotsCache (nodes , seedNodesSocketConfig , clientConfig );
10577 }
10678
10779 public JedisClusterConnectionHandler (Set <HostAndPort > nodes , final GenericObjectPoolConfig poolConfig ,
108- final JedisSocketConfig socketConfig , int infiniteSoTimeout , String user , String password , String clientName ) {
109- this .cache = new JedisClusterInfoCache (poolConfig , socketConfig , infiniteSoTimeout , user , password , clientName );
110- initializeSlotsCache (nodes , socketConfig , infiniteSoTimeout , user , password , clientName );
80+ final JedisSocketConfig socketConfig , final JedisClientConfig clientConfig ) {
81+ this .cache = new JedisClusterInfoCache (poolConfig , socketConfig , clientConfig );
82+ initializeSlotsCache (nodes , socketConfig , clientConfig );
11183 }
11284
11385 abstract Jedis getConnection ();
@@ -122,18 +94,18 @@ public Map<String, JedisPool> getNodes() {
12294 return cache .getNodes ();
12395 }
12496
125- private void initializeSlotsCache (Set <HostAndPort > startNodes , final JedisSocketConfig socketConfig ,
126- int infiniteSoTimeout , String user , String password , String clientName ) {
97+ private void initializeSlotsCache (Set <HostAndPort > startNodes , JedisSocketConfig socketConfig ,
98+ JedisClientConfig clientConfig ) {
12799
128100 for (HostAndPort hostAndPort : startNodes ) {
129- try (Jedis jedis = new Jedis (hostAndPort , socketConfig , infiniteSoTimeout )) {
130- if (user != null ) {
131- jedis .auth (user , password );
132- } else if (password != null ) {
133- jedis .auth (password );
101+ try (Jedis jedis = new Jedis (hostAndPort , socketConfig , clientConfig . getInfiniteSoTimeout () )) {
102+ if (clientConfig . getUser () != null ) {
103+ jedis .auth (clientConfig . getUser (), clientConfig . getPassword () );
104+ } else if (clientConfig . getPassword () != null ) {
105+ jedis .auth (clientConfig . getPassword () );
134106 }
135- if (clientName != null ) {
136- jedis .clientSetname (clientName );
107+ if (clientConfig . getClientName () != null ) {
108+ jedis .clientSetname (clientConfig . getClientName () );
137109 }
138110 cache .discoverClusterNodesAndSlots (jedis );
139111 return ;
0 commit comments