Skip to content

Commit

Permalink
Polish #3304
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Sep 23, 2024
1 parent 1683255 commit 51e4f31
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/main/java/redis/clients/jedis/JedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,19 @@ public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfi
Duration.ofMillis((long) clientConfig.getSocketTimeoutMillis() * maxAttempts));
}

/**
* Creates a JedisCluster with multiple entry points.<br>
* You can specify the timeout and the maximum attempts.<br>
*
* Additionally, you are free to provide a {@link JedisClientConfig} instance.<br>
* You can use the {@link DefaultJedisClientConfig#builder()} builder pattern to customize your configuration, including socket timeouts,
* username and passwords as well as SSL related parameters.
*
* @param clusterNodes Nodes to connect to.
* @param clientConfig Client configuration parameters.
* @param maxAttempts maximum attempts for executing a command.
* @param maxTotalRetriesDuration Maximum time used for reconnecting.
*/
public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfig, int maxAttempts,
Duration maxTotalRetriesDuration) {
this(new ClusterConnectionProvider(clusterNodes, clientConfig), maxAttempts, maxTotalRetriesDuration,
Expand All @@ -246,28 +259,14 @@ public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfi
maxAttempts, maxTotalRetriesDuration, clientConfig.getRedisProtocol());
}

/**
* Creates a JedisCluster with multiple entry points.<br>
* You can specify the timeout and the maximum attempts.<br>
*
* Additionally, you are free to provide a {@link JedisClientConfig} instance.<br>
* You can use the {@link DefaultJedisClientConfig#builder()} builder pattern to customize your configuration, including socket timeouts,
* username and passwords as well as SSL related parameters.
*
* @param clusterNodes Nodes to connect to.
* @param clientConfig Client configuration parameters.
* @param maxAttempts maximum attempts for executing a command.
* @param maxTotalRetriesDuration Maximum time used for reconnecting.
*/
public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfig, int maxAttempts,
Duration maxTotalRetriesDuration, GenericObjectPoolConfig<Connection> poolConfig) {
this(new ClusterConnectionProvider(clusterNodes, clientConfig, poolConfig), maxAttempts, maxTotalRetriesDuration,
clientConfig.getRedisProtocol());
}

// Uses a fetched connection to process protocol. Should be avoided if possible.
public JedisCluster(ClusterConnectionProvider provider, int maxAttempts,
Duration maxTotalRetriesDuration) {
public JedisCluster(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) {
super(provider, maxAttempts, maxTotalRetriesDuration);
}

Expand Down

0 comments on commit 51e4f31

Please sign in to comment.