Skip to content

Commit 016ec71

Browse files
authored
change switch to jdk-17 (#1070)
1 parent 6ef88ec commit 016ec71

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/ConfigReloadAutoConfiguration.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,20 @@ public TaskSchedulerWrapper<TaskScheduler> taskScheduler() {
6464
public ConfigurationUpdateStrategy configurationUpdateStrategy(ConfigReloadProperties properties,
6565
ConfigurableApplicationContext ctx, Optional<RestartEndpoint> restarter, ContextRefresher refresher) {
6666
String strategyName = properties.getStrategy().name();
67-
switch (properties.getStrategy()) {
68-
case RESTART_CONTEXT:
69-
restarter.orElseThrow(() -> new AssertionError("Restart endpoint is not enabled"));
70-
return new ConfigurationUpdateStrategy(strategyName, () -> {
71-
wait(properties);
72-
restarter.get().restart();
73-
});
74-
case REFRESH:
75-
return new ConfigurationUpdateStrategy(strategyName, refresher::refresh);
76-
case SHUTDOWN:
77-
return new ConfigurationUpdateStrategy(strategyName, () -> {
67+
return switch (properties.getStrategy()) {
68+
case RESTART_CONTEXT -> {
69+
restarter.orElseThrow(() -> new AssertionError("Restart endpoint is not enabled"));
70+
yield new ConfigurationUpdateStrategy(strategyName, () -> {
71+
wait(properties);
72+
restarter.get().restart();
73+
});
74+
}
75+
case REFRESH -> new ConfigurationUpdateStrategy(strategyName, refresher::refresh);
76+
case SHUTDOWN -> new ConfigurationUpdateStrategy(strategyName, () -> {
7877
wait(properties);
7978
ctx.close();
8079
});
81-
}
82-
throw new IllegalStateException("Unsupported configuration update strategy: " + strategyName);
80+
};
8381
}
8482

8583
private static void wait(ConfigReloadProperties properties) {

0 commit comments

Comments
 (0)