Skip to content

Commit

Permalink
Polishing (aligned with main)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Jun 11, 2024
1 parent eca2b96 commit fce2f49
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ private void startBeans(boolean autoStartupOnly) {

lifecycleBeans.forEach((beanName, bean) -> {
if (!autoStartupOnly || isAutoStartupCandidate(beanName, bean)) {
int phase = getPhase(bean);
phases.computeIfAbsent(
phase,
p -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly)
int startupPhase = getPhase(bean);
phases.computeIfAbsent(startupPhase,
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly)
).add(beanName, bean);
}
});

if (!phases.isEmpty()) {
phases.values().forEach(LifecycleGroup::start);
}
Expand Down Expand Up @@ -307,13 +307,14 @@ private boolean toBeStarted(String beanName, Lifecycle bean) {
private void stopBeans() {
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans();
Map<Integer, LifecycleGroup> phases = new TreeMap<>(Comparator.reverseOrder());

lifecycleBeans.forEach((beanName, bean) -> {
int shutdownPhase = getPhase(bean);
phases.computeIfAbsent(
shutdownPhase,
p -> new LifecycleGroup(shutdownPhase, this.timeoutPerShutdownPhase, lifecycleBeans, false)
phases.computeIfAbsent(shutdownPhase,
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, false)
).add(beanName, bean);
});

if (!phases.isEmpty()) {
phases.values().forEach(LifecycleGroup::stop);
}
Expand Down

0 comments on commit fce2f49

Please sign in to comment.