Browse Source

Restore original DefaultLifecycleProcessor behavior for the time being

Issue: SPR-16901
pull/1848/merge
Juergen Hoeller 7 years ago
parent
commit
b71795ba36
  1. 12
      spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java

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

@ -354,7 +354,9 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor @@ -354,7 +354,9 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
}
Collections.sort(this.members);
for (LifecycleGroupMember member : this.members) {
doStart(this.lifecycleBeans, member.name, this.autoStartupOnly);
if (this.lifecycleBeans.containsKey(member.name)) {
doStart(this.lifecycleBeans, member.name, this.autoStartupOnly);
}
}
}
@ -369,7 +371,13 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor @@ -369,7 +371,13 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
CountDownLatch latch = new CountDownLatch(this.smartMemberCount);
Set<String> countDownBeanNames = Collections.synchronizedSet(new LinkedHashSet<>());
for (LifecycleGroupMember member : this.members) {
doStop(this.lifecycleBeans, member.name, latch, countDownBeanNames);
if (this.lifecycleBeans.containsKey(member.name)) {
doStop(this.lifecycleBeans, member.name, latch, countDownBeanNames);
}
else if (member.bean instanceof SmartLifecycle) {
// Already removed: must have been a dependent bean from another phase
latch.countDown();
}
}
try {
latch.await(this.timeout, TimeUnit.MILLISECONDS);

Loading…
Cancel
Save