11package redis .clients .jedis ;
22
3- import redis .clients .jedis .MultiClusterClientConfig . ClusterConfig ;
3+ import redis .clients .jedis .MultiDbConfig . DatabaseConfig ;
44import redis .clients .jedis .annots .Experimental ;
55import redis .clients .jedis .builders .MultiDbClientBuilder ;
66import redis .clients .jedis .csc .Cache ;
77import redis .clients .jedis .executors .CommandExecutor ;
8- import redis .clients .jedis .mcf .CircuitBreakerCommandExecutor ;
9- import redis .clients .jedis .mcf .MultiClusterPipeline ;
10- import redis .clients .jedis .mcf .MultiClusterTransaction ;
8+ import redis .clients .jedis .mcf .MultiDbCommandExecutor ;
9+ import redis .clients .jedis .mcf .MultiDbPipeline ;
10+ import redis .clients .jedis .mcf .MultiDbTransaction ;
1111import redis .clients .jedis .providers .ConnectionProvider ;
12- import redis .clients .jedis .mcf .MultiClusterPooledConnectionProvider ;
12+ import redis .clients .jedis .mcf .MultiDbConnectionProvider ;
1313
1414import java .util .Set ;
1515
4343 *
4444 * MultiDbClient client = MultiDbClient.builder()
4545 * .multiDbConfig(
46- * MultiClusterClientConfig .builder()
46+ * MultiDbConfig .builder()
4747 * .endpoint(
48- * ClusterConfig .builder(
48+ * DatabaseConfig .builder(
4949 * primary,
5050 * DefaultJedisClientConfig.builder().build())
5151 * .weight(100.0f)
5252 * .build())
53- * .endpoint(ClusterConfig .builder(
53+ * .endpoint(DatabaseConfig .builder(
5454 * secondary,
5555 * DefaultJedisClientConfig.builder().build())
5656 * .weight(50.0f).build())
7575 * resilience features.
7676 * </p>
7777 * @author Ivo Gaydazhiev
78- * @since 5.2 .0
79- * @see MultiClusterPooledConnectionProvider
80- * @see CircuitBreakerCommandExecutor
81- * @see MultiClusterClientConfig
78+ * @since 7.0 .0
79+ * @see MultiDbConnectionProvider
80+ * @see MultiDbCommandExecutor
81+ * @see MultiDbConfig
8282 */
8383@ Experimental
8484public class MultiDbClient extends UnifiedJedis {
@@ -90,9 +90,8 @@ public class MultiDbClient extends UnifiedJedis {
9090 * the builder pattern for advanced configurations. For most use cases, prefer using
9191 * {@link #builder()} to create instances.
9292 * </p>
93- * @param commandExecutor the command executor (typically CircuitBreakerCommandExecutor)
94- * @param connectionProvider the connection provider (typically
95- * MultiClusterPooledConnectionProvider)
93+ * @param commandExecutor the command executor (typically MultiDbCommandExecutor)
94+ * @param connectionProvider the connection provider (typically MultiDbConnectionProvider)
9695 * @param commandObjects the command objects
9796 * @param redisProtocol the Redis protocol version
9897 * @param cache the client-side cache (may be null)
@@ -103,16 +102,16 @@ public class MultiDbClient extends UnifiedJedis {
103102 }
104103
105104 /**
106- * Returns the underlying MultiClusterPooledConnectionProvider .
105+ * Returns the underlying MultiDbConnectionProvider .
107106 * <p>
108107 * This provides access to multi-cluster specific operations like manual failover, health status
109108 * monitoring, and cluster switch event handling.
110109 * </p>
111110 * @return the multi-cluster connection provider
112- * @throws ClassCastException if the provider is not a MultiClusterPooledConnectionProvider
111+ * @throws ClassCastException if the provider is not a MultiDbConnectionProvider
113112 */
114- private MultiClusterPooledConnectionProvider getMultiClusterProvider () {
115- return (MultiClusterPooledConnectionProvider ) this .provider ;
113+ private MultiDbConnectionProvider getMultiDbConnectionProvider () {
114+ return (MultiDbConnectionProvider ) this .provider ;
116115 }
117116
118117 /**
@@ -124,20 +123,20 @@ private MultiClusterPooledConnectionProvider getMultiClusterProvider() {
124123 * @param endpoint the endpoint to switch to
125124 */
126125 public void setActiveDatabase (Endpoint endpoint ) {
127- getMultiClusterProvider ().setActiveCluster (endpoint );
126+ getMultiDbConnectionProvider ().setActiveDatabase (endpoint );
128127 }
129128
130129 /**
131130 * Adds a pre-configured cluster configuration.
132131 * <p>
133- * This method allows adding a fully configured ClusterConfig instance, providing maximum
132+ * This method allows adding a fully configured DatabaseConfig instance, providing maximum
134133 * flexibility for advanced configurations including custom health check strategies, connection
135134 * pool settings, etc.
136135 * </p>
137- * @param clusterConfig the pre-configured cluster configuration
136+ * @param databaseConfig the pre-configured database configuration
138137 */
139- public void addEndpoint (ClusterConfig clusterConfig ) {
140- getMultiClusterProvider ().add (clusterConfig );
138+ public void addEndpoint (DatabaseConfig databaseConfig ) {
139+ getMultiDbConnectionProvider ().add (databaseConfig );
141140 }
142141
143142 /**
@@ -153,10 +152,10 @@ public void addEndpoint(ClusterConfig clusterConfig) {
153152 * @throws redis.clients.jedis.exceptions.JedisValidationException if the endpoint already exists
154153 */
155154 public void addEndpoint (Endpoint endpoint , float weight , JedisClientConfig clientConfig ) {
156- ClusterConfig clusterConfig = ClusterConfig .builder (endpoint , clientConfig ).weight (weight )
155+ DatabaseConfig databaseConfig = DatabaseConfig .builder (endpoint , clientConfig ).weight (weight )
157156 .build ();
158157
159- getMultiClusterProvider ().add (clusterConfig );
158+ getMultiDbConnectionProvider ().add (databaseConfig );
160159 }
161160
162161 /**
@@ -167,7 +166,7 @@ public void addEndpoint(Endpoint endpoint, float weight, JedisClientConfig clien
167166 * @return the set of all configured endpoints
168167 */
169168 public Set <Endpoint > getEndpoints () {
170- return getMultiClusterProvider ().getEndpoints ();
169+ return getMultiDbConnectionProvider ().getEndpoints ();
171170 }
172171
173172 /**
@@ -179,7 +178,7 @@ public Set<Endpoint> getEndpoints() {
179178 * @return the health status of the endpoint
180179 */
181180 public boolean isHealthy (Endpoint endpoint ) {
182- return getMultiClusterProvider ().isHealthy (endpoint );
181+ return getMultiDbConnectionProvider ().isHealthy (endpoint );
183182 }
184183
185184 /**
@@ -195,7 +194,7 @@ public boolean isHealthy(Endpoint endpoint) {
195194 * healthy clusters available
196195 */
197196 public void removeEndpoint (Endpoint endpoint ) {
198- getMultiClusterProvider ().remove (endpoint );
197+ getMultiDbConnectionProvider ().remove (endpoint );
199198 }
200199
201200 /**
@@ -211,7 +210,7 @@ public void removeEndpoint(Endpoint endpoint) {
211210 * or doesn't exist
212211 */
213212 public void forceActiveEndpoint (Endpoint endpoint , long forcedActiveDurationMs ) {
214- getMultiClusterProvider ().forceActiveCluster (endpoint , forcedActiveDurationMs );
213+ getMultiDbConnectionProvider ().forceActiveDatabase (endpoint , forcedActiveDurationMs );
215214 }
216215
217216 /**
@@ -220,11 +219,11 @@ public void forceActiveEndpoint(Endpoint endpoint, long forcedActiveDurationMs)
220219 * The returned pipeline supports the same resilience features as the main client, including
221220 * automatic failover during batch execution.
222221 * </p>
223- * @return a new MultiClusterPipeline instance
222+ * @return a new MultiDbPipeline instance
224223 */
225224 @ Override
226- public MultiClusterPipeline pipelined () {
227- return new MultiClusterPipeline ( getMultiClusterProvider (), commandObjects );
225+ public MultiDbPipeline pipelined () {
226+ return new MultiDbPipeline ( getMultiDbConnectionProvider (), commandObjects );
228227 }
229228
230229 /**
@@ -233,30 +232,29 @@ public MultiClusterPipeline pipelined() {
233232 * The returned transaction supports the same resilience features as the main client, including
234233 * automatic failover during transaction execution.
235234 * </p>
236- * @return a new MultiClusterTransaction instance
235+ * @return a new MultiDbTransaction instance
237236 */
238237 @ Override
239- public MultiClusterTransaction multi () {
240- return new MultiClusterTransaction ((MultiClusterPooledConnectionProvider ) provider , true ,
241- commandObjects );
238+ public MultiDbTransaction multi () {
239+ return new MultiDbTransaction ((MultiDbConnectionProvider ) provider , true , commandObjects );
242240 }
243241
244242 /**
245243 * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI
246244 * @return transaction object
247245 */
248246 @ Override
249- public MultiClusterTransaction transaction (boolean doMulti ) {
247+ public MultiDbTransaction transaction (boolean doMulti ) {
250248 if (provider == null ) {
251249 throw new IllegalStateException (
252250 "It is not allowed to create Transaction from this " + getClass ());
253251 }
254252
255- return new MultiClusterTransaction ( getMultiClusterProvider (), doMulti , commandObjects );
253+ return new MultiDbTransaction ( getMultiDbConnectionProvider (), doMulti , commandObjects );
256254 }
257255
258256 public Endpoint getActiveEndpoint () {
259- return getMultiClusterProvider ().getCluster ().getEndpoint ();
257+ return getMultiDbConnectionProvider ().getDatabase ().getEndpoint ();
260258 }
261259
262260 /**
0 commit comments