399967 Destroyables destroyed on undeploy and shutdown hook
This commit is contained in:
parent
778ee1411b
commit
97de9fc6be
|
@ -32,12 +32,14 @@ public class StandardUndeployer implements AppLifeCycle.Binding
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(StandardUndeployer.class);
|
||||
|
||||
@Override
|
||||
public String[] getBindingTargets()
|
||||
{
|
||||
return new String[]
|
||||
{ "undeploying" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processBinding(Node node, App app) throws Exception
|
||||
{
|
||||
ContextHandler handler = app.getContextHandler();
|
||||
|
|
|
@ -447,7 +447,6 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
{
|
||||
if (_beans.remove(bean))
|
||||
{
|
||||
boolean managed=bean.isManaged();
|
||||
unmanage(bean);
|
||||
|
||||
for (Container.Listener l:_listeners)
|
||||
|
@ -469,18 +468,6 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
}
|
||||
}
|
||||
|
||||
if (managed && bean._bean instanceof Destroyable)
|
||||
{
|
||||
try
|
||||
{
|
||||
((Destroyable)bean._bean).destroy();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -117,17 +117,17 @@ public class ContainerLifeCycleTest
|
|||
a0.destroy();
|
||||
Assert.assertEquals(3,started.get());
|
||||
Assert.assertEquals(2,stopped.get());
|
||||
Assert.assertEquals(2,destroyed.get());
|
||||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
a1.stop();
|
||||
Assert.assertEquals(3,started.get());
|
||||
Assert.assertEquals(3,stopped.get());
|
||||
Assert.assertEquals(2,destroyed.get());
|
||||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
a1.destroy();
|
||||
Assert.assertEquals(3,started.get());
|
||||
Assert.assertEquals(3,stopped.get());
|
||||
Assert.assertEquals(3,destroyed.get());
|
||||
Assert.assertEquals(2,destroyed.get());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue