@@ -147,10 +147,10 @@ public static interface StrategySupplier {
147
147
//////////// Failover Config ////////////
148
148
149
149
/** Whether to retry failed commands during failover */
150
- private boolean retryOnFailover = false ;
150
+ private boolean retryOnFailover ;
151
151
152
- /** Whether failback is enabled */
153
- private boolean failback = false ;
152
+ /** Whether failback is supported by client */
153
+ private boolean isFailbackSupported ;
154
154
155
155
public MultiClusterClientConfig (ClusterConfig [] clusterConfigs ) {
156
156
this .clusterConfigs = clusterConfigs ;
@@ -220,8 +220,13 @@ public boolean isRetryOnFailover() {
220
220
return retryOnFailover ;
221
221
}
222
222
223
- public boolean isFailback () {
224
- return failback ;
223
+ /** Whether failback is supported by client */
224
+ public boolean isFailbackSupported () {
225
+ return isFailbackSupported ;
226
+ }
227
+
228
+ public static Builder builder (ClusterConfig [] clusterConfigs ) {
229
+ return new Builder (clusterConfigs );
225
230
}
226
231
227
232
public static class ClusterConfig {
@@ -284,7 +289,6 @@ public static class Builder {
284
289
285
290
private float weight = 1.0f ;
286
291
private StrategySupplier healthCheckStrategySupplier = EchoStrategy .DEFAULT ;
287
- private boolean healthCheckEnabled = true ;
288
292
289
293
public Builder (HostAndPort hostAndPort , JedisClientConfig clientConfig ) {
290
294
this .hostAndPort = hostAndPort ;
@@ -318,7 +322,6 @@ public Builder healthCheckStrategy(HealthCheckStrategy healthCheckStrategy) {
318
322
}
319
323
320
324
public Builder healthCheckEnabled (boolean healthCheckEnabled ) {
321
- this .healthCheckEnabled = healthCheckEnabled ;
322
325
if (!healthCheckEnabled ) {
323
326
this .healthCheckStrategySupplier = null ;
324
327
} else if (healthCheckStrategySupplier == null ) {
@@ -354,7 +357,7 @@ public static class Builder {
354
357
private List <Class <? extends Throwable >> fallbackExceptionList = FALLBACK_EXCEPTIONS_DEFAULT ;
355
358
356
359
private boolean retryOnFailover = false ;
357
- private boolean failback = false ;
360
+ private boolean isFailbackSupported = true ;
358
361
359
362
public Builder (ClusterConfig [] clusterConfigs ) {
360
363
@@ -453,8 +456,8 @@ public Builder retryOnFailover(boolean retryOnFailover) {
453
456
return this ;
454
457
}
455
458
456
- public Builder failback (boolean failback ) {
457
- this .failback = failback ;
459
+ public Builder failbackSupported (boolean supported ) {
460
+ this .isFailbackSupported = supported ;
458
461
return this ;
459
462
}
460
463
@@ -484,7 +487,7 @@ public MultiClusterClientConfig build() {
484
487
config .fallbackExceptionList = this .fallbackExceptionList ;
485
488
486
489
config .retryOnFailover = this .retryOnFailover ;
487
- config .failback = this .failback ;
490
+ config .isFailbackSupported = this .isFailbackSupported ;
488
491
489
492
return config ;
490
493
}
0 commit comments