Issue #3440 Stop failed lifecycle

stop in reverse order.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-03-12 22:44:12 +11:00
parent 76a37352f5
commit 7b407ecb6c
1 changed files with 3 additions and 1 deletions

View File

@ -131,7 +131,9 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
catch (Throwable t)
{
// on failure, stop any managed components that have been started
for (Bean b : _beans)
List<Bean> reverse = new ArrayList<>(_beans);
Collections.reverse(reverse);
for (Bean b : reverse)
{
if (b._bean instanceof LifeCycle && b._managed == Managed.MANAGED)
{