|
|
|
@ -250,13 +250,13 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor |
|
|
|
|
|
|
|
|
|
|
|
lifecycleBeans.forEach((beanName, bean) -> { |
|
|
|
lifecycleBeans.forEach((beanName, bean) -> { |
|
|
|
if (!autoStartupOnly || isAutoStartupCandidate(beanName, bean)) { |
|
|
|
if (!autoStartupOnly || isAutoStartupCandidate(beanName, bean)) { |
|
|
|
int phase = getPhase(bean); |
|
|
|
int startupPhase = getPhase(bean); |
|
|
|
phases.computeIfAbsent( |
|
|
|
phases.computeIfAbsent(startupPhase, |
|
|
|
phase, |
|
|
|
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly) |
|
|
|
p -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly) |
|
|
|
|
|
|
|
).add(beanName, bean); |
|
|
|
).add(beanName, bean); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (!phases.isEmpty()) { |
|
|
|
if (!phases.isEmpty()) { |
|
|
|
phases.values().forEach(LifecycleGroup::start); |
|
|
|
phases.values().forEach(LifecycleGroup::start); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -307,13 +307,14 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor |
|
|
|
private void stopBeans() { |
|
|
|
private void stopBeans() { |
|
|
|
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans(); |
|
|
|
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans(); |
|
|
|
Map<Integer, LifecycleGroup> phases = new TreeMap<>(Comparator.reverseOrder()); |
|
|
|
Map<Integer, LifecycleGroup> phases = new TreeMap<>(Comparator.reverseOrder()); |
|
|
|
|
|
|
|
|
|
|
|
lifecycleBeans.forEach((beanName, bean) -> { |
|
|
|
lifecycleBeans.forEach((beanName, bean) -> { |
|
|
|
int shutdownPhase = getPhase(bean); |
|
|
|
int shutdownPhase = getPhase(bean); |
|
|
|
phases.computeIfAbsent( |
|
|
|
phases.computeIfAbsent(shutdownPhase, |
|
|
|
shutdownPhase, |
|
|
|
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, false) |
|
|
|
p -> new LifecycleGroup(shutdownPhase, this.timeoutPerShutdownPhase, lifecycleBeans, false) |
|
|
|
|
|
|
|
).add(beanName, bean); |
|
|
|
).add(beanName, bean); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (!phases.isEmpty()) { |
|
|
|
if (!phases.isEmpty()) { |
|
|
|
phases.values().forEach(LifecycleGroup::stop); |
|
|
|
phases.values().forEach(LifecycleGroup::stop); |
|
|
|
} |
|
|
|
} |
|
|
|
|