}
/* ------------------------------------------------------------ */
protected void doStop() throws Exception
{
MultiException mex=new MultiException();
for (int i=0;_realms !=null && i<_realms.length; i++)
{
if (_realms[i] instanceof LifeCycle)
((LifeCycle)_realms[i]).stop();
}
if (_graceful>0)
{
if (_connectors!=null)
{
for (int i=_connectors.length;i-->0;)
{
Log.info("Graceful shutdown {}",_connectors[i]);
try{_connectors[i].close();}catch(Throwable e){mex.add(e);}
}
}
Handler[] contexts = getChildHandlersByClass(Graceful.class);
for (int c=0;c<contexts.length;c++)
{
Graceful context=(Graceful)contexts[c];
Log.info("Graceful shutdown {}",context);
context.setShutdown(true);
}
Thread.sleep(_graceful);
}
if (_connectors!=null)
{
for (int i=_connectors.length;i-->0;)
try{_connectors[i].stop();}catch(Throwable e){mex.add(e);}
}
try {super.doStop(); } catch(Throwable e) { mex.add(e);}
if (_sessionIdManager!=null)
_sessionIdManager.stop();
try
{
if (_threadPool instanceof LifeCycle)
((LifeCycle)_threadPool).stop();
}
catch(Throwable e){mex.add(e);}
if (!_dependentLifeCycles.isEmpty())
{
ListIterator itor = _dependentLifeCycles.listIterator(_dependentLifeCycles.size());
while (itor.hasPrevious())
{
try
{
((LifeCycle)itor.previous()).stop();
}
catch (Throwable e) {mex.add(e);}
}
}
mex.ifExceptionThrow();
}