@@ -28,35 +28,46 @@ public class RedisClusterClient extends UnifiedJedis {
2828 public static final int DEFAULT_MAX_ATTEMPTS = 5 ;
2929
3030 /**
31- * Creates a RedisClusterClient instance. The provided node is used to make the first contact with the cluster.
31+ * Creates a RedisClusterClient instance. The provided node is used to make the first contact with
32+ * the cluster.
3233 * <p>
33- * Here, the default timeout of {@value redis.clients.jedis.RedisClusterClient#DEFAULT_TIMEOUT} ms is being used with
34- * {@value redis.clients.jedis.RedisClusterClient#DEFAULT_MAX_ATTEMPTS} maximum attempts.
34+ * Here, the default timeout of {@value redis.clients.jedis.RedisClusterClient#DEFAULT_TIMEOUT} ms
35+ * is being used with {@value redis.clients.jedis.RedisClusterClient#DEFAULT_MAX_ATTEMPTS} maximum
36+ * attempts.
3537 * @param node Node to first connect to.
3638 */
3739 public RedisClusterClient (HostAndPort node ) {
38- super (new ClusterConnectionProvider (Collections .singleton (node ), DefaultJedisClientConfig .builder ().timeoutMillis (DEFAULT_TIMEOUT ).build ()),
40+ super (
41+ new ClusterConnectionProvider (Collections .singleton (node ),
42+ DefaultJedisClientConfig .builder ().timeoutMillis (DEFAULT_TIMEOUT ).build ()),
3943 DEFAULT_MAX_ATTEMPTS , Duration .ofMillis ((long ) DEFAULT_TIMEOUT * DEFAULT_MAX_ATTEMPTS ));
4044 }
4145
4246 /**
4347 * Creates a RedisClusterClient with multiple entry points.
4448 * <p>
45- * Here, the default timeout of {@value redis.clients.jedis.RedisClusterClient#DEFAULT_TIMEOUT} ms is being used with
46- * {@value redis.clients.jedis.RedisClusterClient#DEFAULT_MAX_ATTEMPTS} maximum attempts.
49+ * Here, the default timeout of {@value redis.clients.jedis.RedisClusterClient#DEFAULT_TIMEOUT} ms
50+ * is being used with {@value redis.clients.jedis.RedisClusterClient#DEFAULT_MAX_ATTEMPTS} maximum
51+ * attempts.
4752 * @param nodes Nodes to connect to.
4853 */
4954 public RedisClusterClient (Set <HostAndPort > nodes ) {
50- super (new ClusterConnectionProvider (nodes , DefaultJedisClientConfig .builder ().timeoutMillis (DEFAULT_TIMEOUT ).build ()),
55+ super (
56+ new ClusterConnectionProvider (nodes ,
57+ DefaultJedisClientConfig .builder ().timeoutMillis (DEFAULT_TIMEOUT ).build ()),
5158 DEFAULT_MAX_ATTEMPTS , Duration .ofMillis ((long ) DEFAULT_TIMEOUT * DEFAULT_MAX_ATTEMPTS ));
5259 }
5360
5461 public RedisClusterClient (Set <HostAndPort > nodes , String user , String password ) {
55- super (new ClusterConnectionProvider (nodes , DefaultJedisClientConfig .builder ().user (user ).password (password ).build ()),
56- DEFAULT_MAX_ATTEMPTS , Duration .ofMillis ((long ) Protocol .DEFAULT_TIMEOUT * DEFAULT_MAX_ATTEMPTS ));
62+ super (
63+ new ClusterConnectionProvider (nodes ,
64+ DefaultJedisClientConfig .builder ().user (user ).password (password ).build ()),
65+ DEFAULT_MAX_ATTEMPTS ,
66+ Duration .ofMillis ((long ) Protocol .DEFAULT_TIMEOUT * DEFAULT_MAX_ATTEMPTS ));
5767 }
5868
59- private RedisClusterClient (CommandExecutor commandExecutor , ConnectionProvider connectionProvider , CommandObjects commandObjects , RedisProtocol redisProtocol , Cache cache ) {
69+ private RedisClusterClient (CommandExecutor commandExecutor , ConnectionProvider connectionProvider ,
70+ CommandObjects commandObjects , RedisProtocol redisProtocol , Cache cache ) {
6071 super (commandExecutor , connectionProvider , commandObjects , redisProtocol , cache );
6172 }
6273
@@ -70,8 +81,8 @@ static public class Builder extends ClusterClientBuilder<RedisClusterClient> {
7081
7182 @ Override
7283 protected RedisClusterClient createClient () {
73- return new RedisClusterClient (commandExecutor , connectionProvider , commandObjects , clientConfig . getRedisProtocol (),
74- cache );
84+ return new RedisClusterClient (commandExecutor , connectionProvider , commandObjects ,
85+ clientConfig . getRedisProtocol (), cache );
7586 }
7687 }
7788
@@ -95,7 +106,8 @@ public Map<String, ConnectionPool> getClusterNodes() {
95106 /**
96107 * Returns the connection for one of the 16,384 slots.
97108 * @param slot the slot to retrieve the connection for.
98- * @return connection of the provided slot. {@code close()} of this connection must be called after use.
109+ * @return connection of the provided slot. {@code close()} of this connection must be called
110+ * after use.
99111 */
100112 public Connection getConnectionFromSlot (int slot ) {
101113 return ((ClusterConnectionProvider ) provider ).getConnectionFromSlot (slot );
@@ -125,7 +137,8 @@ public void ssubscribe(BinaryJedisShardedPubSub jedisPubSub, final byte[]... cha
125137
126138 @ Override
127139 public ClusterPipeline pipelined () {
128- return new ClusterPipeline ((ClusterConnectionProvider ) provider , (ClusterCommandObjects ) commandObjects );
140+ return new ClusterPipeline ((ClusterConnectionProvider ) provider ,
141+ (ClusterCommandObjects ) commandObjects );
129142 }
130143
131144 /**
@@ -140,9 +153,9 @@ public AbstractTransaction transaction(boolean doMulti) {
140153
141154 public final <T > T executeCommandToReplica (CommandObject <T > commandObject ) {
142155 if (!(executor instanceof ClusterCommandExecutor )) {
143- throw new UnsupportedOperationException ("Support only execute to replica in ClusterCommandExecutor" );
156+ throw new UnsupportedOperationException (
157+ "Support only execute to replica in ClusterCommandExecutor" );
144158 }
145159 return ((ClusterCommandExecutor ) executor ).executeCommandToReplica (commandObject );
146160 }
147161}
148-
0 commit comments