Skip to content

Commit

Permalink
Issue #5851 - remove WebSocketServletFactory as ServletContext attrib…
Browse files Browse the repository at this point in the history
…ute on destroy

Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Jan 5, 2021
1 parent 343e7b2 commit f738493
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 f738493

Please sign in to comment.