435988 ContainerLifeCycle: beans never stopped on remove
This commit is contained in:
parent
4c8e2a6635
commit
0aeebc4ec0
|
@ -524,6 +524,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
{
|
||||
if (_beans.remove(bean))
|
||||
{
|
||||
boolean wasManaged = bean.isManaged();
|
||||
|
||||
unmanage(bean);
|
||||
|
||||
|
@ -534,7 +535,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
removeEventListener((Container.Listener)bean._bean);
|
||||
|
||||
// stop managed beans
|
||||
if (bean._managed==Managed.MANAGED && bean._bean instanceof LifeCycle)
|
||||
if (wasManaged && bean._bean instanceof LifeCycle)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -123,10 +123,14 @@ public class ContainerLifeCycleTest
|
|||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
a0.removeBean(a1);
|
||||
Assert.assertEquals(3,started.get());
|
||||
Assert.assertEquals(3,stopped.get());
|
||||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
a0.stop();
|
||||
a0.destroy();
|
||||
Assert.assertEquals(3,started.get());
|
||||
Assert.assertEquals(2,stopped.get());
|
||||
Assert.assertEquals(3,stopped.get());
|
||||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
a1.stop();
|
||||
|
|
Loading…
Reference in New Issue