Skip to content

Commit

Permalink
Merge pull request #5860 from eclipse/jetty-9.4.x-5851-WebSocketServl…
Browse files Browse the repository at this point in the history
…etCleanup

Issue #5851 - remove WebSocketServletFactory as ServletContext attribute on destroy
  • Loading branch information
lachlan-roberts committed Jan 20, 2021
2 parents 2e53ec5 + f738493 commit 7598055
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -91,7 +91,10 @@ public void destroy()
{
try
{
ServletContext ctx = getServletContext();
ctx.removeAttribute(WebSocketServletFactory.class.getName());
factory.stop();
factory = null;
}
catch (Exception ignore)
{
Expand Down Expand Up @@ -135,11 +138,8 @@ public void init() throws ServletException

ServletContext ctx = getServletContext();
factory = WebSocketServletFactory.Loader.load(ctx, policy);

configure(factory);

factory.start();

ctx.setAttribute(WebSocketServletFactory.class.getName(), factory);
}
catch (Exception x)
Expand Down
Expand Up @@ -43,6 +43,7 @@ public static WebSocketServletFactory load(ServletContext ctx, WebSocketPolicy p
{
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);
Expand Down

0 comments on commit 7598055

Please sign in to comment.