|
2 | 2 |
|
3 | 3 | import io.lettuce.core.AbstractRedisClient; |
4 | 4 | import io.lettuce.core.ClientOptions; |
5 | | -import io.lettuce.core.MaintenanceEventsOptions; |
6 | | -import io.lettuce.core.MaintenanceEventsOptions.AddressType; |
| 5 | +import io.lettuce.core.MaintNotificationsConfig; |
| 6 | +import io.lettuce.core.MaintNotificationsConfig.EndpointType; |
7 | 7 | import io.lettuce.core.RedisURI; |
8 | 8 | import io.lettuce.core.SocketOptions; |
9 | 9 | import io.lettuce.core.TimeoutOptions; |
@@ -319,16 +319,16 @@ protected ClientOptions createClientOptions(ClientOptionsConfig config) { |
319 | 319 | if (config.getMaintenanceEventsConfig() != null) { |
320 | 320 | MaintenanceEventsConfig maintEventsCfg = config.getMaintenanceEventsConfig(); |
321 | 321 | if (maintEventsCfg.isEnabled()) { |
322 | | - MaintenanceEventsOptions options; |
| 322 | + MaintNotificationsConfig options; |
323 | 323 | if (maintEventsCfg.getMovingEndpointAddressType() != null) { |
324 | | - AddressType addrType = AddressType.valueOf(maintEventsCfg.getMovingEndpointAddressType()); |
325 | | - options = MaintenanceEventsOptions.enabled(addrType); |
| 324 | + EndpointType addrType = EndpointType.valueOf(maintEventsCfg.getMovingEndpointAddressType()); |
| 325 | + options = MaintNotificationsConfig.enabled(addrType); |
326 | 326 | log.info("Enabling supportMaintenanceEvents with address type: {}", addrType); |
327 | 327 | } else { |
328 | | - options = MaintenanceEventsOptions.enabled(); |
| 328 | + options = MaintNotificationsConfig.enabled(); |
329 | 329 | log.info("Enabling supportMaintenanceEvents with default (auto resolve) address type."); |
330 | 330 | } |
331 | | - builder.supportMaintenanceEvents(options); |
| 331 | + builder.maintNotificationsConfig(options); |
332 | 332 | } |
333 | 333 | } |
334 | 334 |
|
@@ -362,17 +362,7 @@ private void applyTimeoutOptions(TimeoutOptions.Builder builder, TimeoutOptionsC |
362 | 362 | } |
363 | 363 |
|
364 | 364 | if (config.getTimeoutsRelaxingDuringMaintenance() != null) { |
365 | | - try { |
366 | | - Method timeoutsRelaxingDuringMaintenance = builder.getClass().getMethod("timeoutsRelaxingDuringMaintenance", |
367 | | - Duration.class); |
368 | | - timeoutsRelaxingDuringMaintenance.invoke(builder, config.getTimeoutsRelaxingDuringMaintenance()); |
369 | | - log.info("ProactiveTimeoutsRelaxingMethod enabled successfully."); |
370 | | - } catch (NoSuchMethodException e) { |
371 | | - throw new IllegalStateException( |
372 | | - "The method 'timeoutsRelaxingDuringMaintenance' is not available in this build.", e); |
373 | | - } catch (IllegalAccessException | InvocationTargetException e) { |
374 | | - throw new RuntimeException("Failed to invoke 'timeoutsRelaxingDuringMaintenance' method.", e); |
375 | | - } |
| 365 | + builder.relaxedTimeoutsDuringMaintenance(config.getTimeoutsRelaxingDuringMaintenance()); |
376 | 366 | } |
377 | 367 | } |
378 | 368 |
|
|
0 commit comments