Merge pull request #5860 from eclipse/jetty-9.4.x-5851-WebSocketServletCleanup
Issue #5851 - remove WebSocketServletFactory as ServletContext attribute on destroy
This commit is contained in:
commit
759805580b
|
@ -91,7 +91,10 @@ public abstract class WebSocketServlet extends HttpServlet
|
|||
{
|
||||
try
|
||||
{
|
||||
ServletContext ctx = getServletContext();
|
||||
ctx.removeAttribute(WebSocketServletFactory.class.getName());
|
||||
factory.stop();
|
||||
factory = null;
|
||||
}
|
||||
catch (Exception ignore)
|
||||
{
|
||||
|
@ -135,11 +138,8 @@ public abstract class WebSocketServlet extends HttpServlet
|
|||
|
||||
ServletContext ctx = getServletContext();
|
||||
factory = WebSocketServletFactory.Loader.load(ctx, policy);
|
||||
|
||||
configure(factory);
|
||||
|
||||
factory.start();
|
||||
|
||||
ctx.setAttribute(WebSocketServletFactory.class.getName(), factory);
|
||||
}
|
||||
catch (Exception x)
|
||||
|
|
|
@ -43,6 +43,7 @@ public interface WebSocketServletFactory
|
|||
{
|
||||
try
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends WebSocketServletFactory> wsClazz =
|
||||
(Class<? extends WebSocketServletFactory>)Class.forName(DEFAULT_IMPL, true, Thread.currentThread().getContextClassLoader());
|
||||
Constructor<? extends WebSocketServletFactory> ctor = wsClazz.getDeclaredConstructor(ServletContext.class, WebSocketPolicy.class);
|
||||
|
|
Loading…
Reference in New Issue