Skip to content

Commit 974f192

Browse files
authored
Merge pull request #5 from redis-developer/topic/hu-maintenace-notifications-config-rename
Maintenance notification settings rename
2 parents 4a4311e + ad8cdce commit 974f192

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/main/java/io/lettuce/test/WorkloadRunnerBase.java

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import io.lettuce.core.AbstractRedisClient;
44
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;
77
import io.lettuce.core.RedisURI;
88
import io.lettuce.core.SocketOptions;
99
import io.lettuce.core.TimeoutOptions;
@@ -319,16 +319,16 @@ protected ClientOptions createClientOptions(ClientOptionsConfig config) {
319319
if (config.getMaintenanceEventsConfig() != null) {
320320
MaintenanceEventsConfig maintEventsCfg = config.getMaintenanceEventsConfig();
321321
if (maintEventsCfg.isEnabled()) {
322-
MaintenanceEventsOptions options;
322+
MaintNotificationsConfig options;
323323
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);
326326
log.info("Enabling supportMaintenanceEvents with address type: {}", addrType);
327327
} else {
328-
options = MaintenanceEventsOptions.enabled();
328+
options = MaintNotificationsConfig.enabled();
329329
log.info("Enabling supportMaintenanceEvents with default (auto resolve) address type.");
330330
}
331-
builder.supportMaintenanceEvents(options);
331+
builder.maintNotificationsConfig(options);
332332
}
333333
}
334334

@@ -362,17 +362,7 @@ private void applyTimeoutOptions(TimeoutOptions.Builder builder, TimeoutOptionsC
362362
}
363363

364364
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());
376366
}
377367
}
378368

0 commit comments

Comments
 (0)