338607 improve destruction of handlers

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2845 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-03-02 01:19:32 +00:00
parent 7b892d18a0
commit d77069a8ea
5 changed files with 42 additions and 6 deletions

View File

@ -53,7 +53,7 @@ public class StandardUndeployer implements AppLifeCycle.Binding
{
Log.debug("Removing handler: " + child);
coll.removeHandler(child);
((ContextHandler)child).destroy();
child.destroy();
Log.debug(String.format("After removal: %d (originally %d)",coll.getHandlers().length,originalCount));
}
else if (child instanceof HandlerCollection)

View File

@ -21,7 +21,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.EventListener;

View File

@ -298,5 +298,16 @@ public class HandlerCollection extends AbstractHandlerContainer
return list;
}
/* ------------------------------------------------------------ */
@Override
public void destroy()
{
if (!isStopped())
throw new IllegalStateException("!STOPPED");
Handler[] children=getChildHandlers();
setHandlers(null);
for (Handler child: children)
child.destroy();
super.destroy();
}
}

View File

@ -164,5 +164,19 @@ public class HandlerWrapper extends AbstractHandlerContainer
}
/* ------------------------------------------------------------ */
@Override
public void destroy()
{
if (!isStopped())
throw new IllegalStateException("!STOPPED");
Handler child=getHandler();
if (child!=null)
{
setHandler(null);
child.destroy();
}
super.destroy();
}
}

View File

@ -155,7 +155,6 @@ public class HotSwapHandler extends AbstractHandlerContainer
server.getContainer().update(this, null,_handler, "handler");
}
/* ------------------------------------------------------------ */
@Override
protected Object expandChildren(Object list, Class byClass)
@ -163,5 +162,18 @@ public class HotSwapHandler extends AbstractHandlerContainer
return expandHandler(_handler,list,byClass);
}
/* ------------------------------------------------------------ */
@Override
public void destroy()
{
if (!isStopped())
throw new IllegalStateException("!STOPPED");
Handler child=getHandler();
if (child!=null)
{
setHandler(null);
child.destroy();
}
super.destroy();
}
}