408281 - Inconsistent start/stop handling in ContainerLifeCycle
added stop(LifeCycle) stop removed managed beans always use start(LifeCycle)
This commit is contained in:
parent
d56ee96219
commit
52444486d1
|
@ -107,6 +107,17 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
{
|
{
|
||||||
l.start();
|
l.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the given lifecycle.
|
||||||
|
*
|
||||||
|
* @param l
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected void stop(LifeCycle l) throws Exception
|
||||||
|
{
|
||||||
|
l.stop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the managed lifecycle beans in the reverse order they were added.
|
* Stops the managed lifecycle beans in the reverse order they were added.
|
||||||
|
@ -124,7 +135,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
{
|
{
|
||||||
LifeCycle l = (LifeCycle)b._bean;
|
LifeCycle l = (LifeCycle)b._bean;
|
||||||
if (l.isRunning())
|
if (l.isRunning())
|
||||||
l.stop();
|
stop(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +272,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
{
|
{
|
||||||
LifeCycle l = (LifeCycle)o;
|
LifeCycle l = (LifeCycle)o;
|
||||||
if (!l.isRunning())
|
if (!l.isRunning())
|
||||||
l.start();
|
start(l);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -276,7 +287,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manage(new_bean);
|
manage(new_bean);
|
||||||
l.start();
|
start(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -452,6 +463,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
{
|
{
|
||||||
if (_beans.remove(bean))
|
if (_beans.remove(bean))
|
||||||
{
|
{
|
||||||
|
|
||||||
unmanage(bean);
|
unmanage(bean);
|
||||||
|
|
||||||
for (Container.Listener l:_listeners)
|
for (Container.Listener l:_listeners)
|
||||||
|
@ -472,7 +484,23 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stop managed beans
|
||||||
|
if (bean._managed==Managed.MANAGED && bean._bean instanceof LifeCycle)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stop((LifeCycle)bean._bean);
|
||||||
|
}
|
||||||
|
catch(RuntimeException | Error e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue