@@ -250,13 +250,13 @@ private void startBeans(boolean autoStartupOnly) {
250
250
251
251
lifecycleBeans .forEach ((beanName , bean ) -> {
252
252
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 )
257
256
).add (beanName , bean );
258
257
}
259
258
});
259
+
260
260
if (!phases .isEmpty ()) {
261
261
phases .values ().forEach (LifecycleGroup ::start );
262
262
}
@@ -307,13 +307,14 @@ private boolean toBeStarted(String beanName, Lifecycle bean) {
307
307
private void stopBeans () {
308
308
Map <String , Lifecycle > lifecycleBeans = getLifecycleBeans ();
309
309
Map <Integer , LifecycleGroup > phases = new TreeMap <>(Comparator .reverseOrder ());
310
+
310
311
lifecycleBeans .forEach ((beanName , bean ) -> {
311
312
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 )
315
315
).add (beanName , bean );
316
316
});
317
+
317
318
if (!phases .isEmpty ()) {
318
319
phases .values ().forEach (LifecycleGroup ::stop );
319
320
}
0 commit comments