Skip to content

Commit fce2f49

Browse files
committed
Polishing (aligned with main)
1 parent eca2b96 commit fce2f49

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@ private void startBeans(boolean autoStartupOnly) {
250250

251251
lifecycleBeans.forEach((beanName, bean) -> {
252252
if (!autoStartupOnly || isAutoStartupCandidate(beanName, bean)) {
253-
int phase = getPhase(bean);
254-
phases.computeIfAbsent(
255-
phase,
256-
p -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly)
253+
int startupPhase = getPhase(bean);
254+
phases.computeIfAbsent(startupPhase,
255+
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, autoStartupOnly)
257256
).add(beanName, bean);
258257
}
259258
});
259+
260260
if (!phases.isEmpty()) {
261261
phases.values().forEach(LifecycleGroup::start);
262262
}
@@ -307,13 +307,14 @@ private boolean toBeStarted(String beanName, Lifecycle bean) {
307307
private void stopBeans() {
308308
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans();
309309
Map<Integer, LifecycleGroup> phases = new TreeMap<>(Comparator.reverseOrder());
310+
310311
lifecycleBeans.forEach((beanName, bean) -> {
311312
int shutdownPhase = getPhase(bean);
312-
phases.computeIfAbsent(
313-
shutdownPhase,
314-
p -> new LifecycleGroup(shutdownPhase, this.timeoutPerShutdownPhase, lifecycleBeans, false)
313+
phases.computeIfAbsent(shutdownPhase,
314+
phase -> new LifecycleGroup(phase, this.timeoutPerShutdownPhase, lifecycleBeans, false)
315315
).add(beanName, bean);
316316
});
317+
317318
if (!phases.isEmpty()) {
318319
phases.values().forEach(LifecycleGroup::stop);
319320
}

0 commit comments

Comments
 (0)