|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2024 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
61 | 61 | * interactions on a {@link org.springframework.context.ConfigurableApplicationContext}.
|
62 | 62 | *
|
63 | 63 | * <p>As of 6.1, this also includes support for JVM checkpoint/restore (Project CRaC)
|
64 |
| - * when the {@code org.crac:crac} dependency on the classpath. |
| 64 | + * when the {@code org.crac:crac} dependency is on the classpath. All running beans |
| 65 | + * will get stopped and restarted according to the CRaC checkpoint/restore callbacks. |
65 | 66 | *
|
66 | 67 | * @author Mark Fisher
|
67 | 68 | * @author Juergen Hoeller
|
@@ -379,7 +380,7 @@ else if (bean instanceof SmartLifecycle) {
|
379 | 380 | }
|
380 | 381 |
|
381 | 382 |
|
382 |
| - // overridable hooks |
| 383 | + // Overridable hooks |
383 | 384 |
|
384 | 385 | /**
|
385 | 386 | * Retrieve all applicable Lifecycle beans: all singletons that have already been created,
|
@@ -493,11 +494,13 @@ else if (member.bean instanceof SmartLifecycle) {
|
493 | 494 | }
|
494 | 495 | }
|
495 | 496 | try {
|
496 |
| - latch.await(this.timeout, TimeUnit.MILLISECONDS); |
497 |
| - if (latch.getCount() > 0 && !countDownBeanNames.isEmpty() && logger.isInfoEnabled()) { |
498 |
| - logger.info("Shutdown phase " + this.phase + " ends with " + countDownBeanNames.size() + |
499 |
| - " bean" + (countDownBeanNames.size() > 1 ? "s" : "") + |
500 |
| - " still running after timeout of " + this.timeout + "ms: " + countDownBeanNames); |
| 497 | + if (!latch.await(this.timeout, TimeUnit.MILLISECONDS)) { |
| 498 | + // Count is still >0 after timeout |
| 499 | + if (!countDownBeanNames.isEmpty() && logger.isInfoEnabled()) { |
| 500 | + logger.info("Shutdown phase " + this.phase + " ends with " + countDownBeanNames.size() + |
| 501 | + " bean" + (countDownBeanNames.size() > 1 ? "s" : "") + |
| 502 | + " still running after timeout of " + this.timeout + "ms: " + countDownBeanNames); |
| 503 | + } |
501 | 504 | }
|
502 | 505 | }
|
503 | 506 | catch (InterruptedException ex) {
|
|
0 commit comments