DWR

ScheduledThreadPoolExecutor does not shut down

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 3.0.M1
  • Fix Version/s: 3.0.RC1
  • Component/s: Engine
  • Description:
    The executor in DefaultScriptSessionManager does not shut down when DWR's container is closed. This will cause Tomcat to hang on shutdown.

Issue Links

Activity

Hide
Steve Kondik added a comment - 05/Mar/08 9:03 PM

Also, the executor in PurgingDownloadManager stays around, and the field is protected so we can't shut it down from a listener.

Show
Steve Kondik added a comment - 05/Mar/08 9:03 PM Also, the executor in PurgingDownloadManager stays around, and the field is protected so we can't shut it down from a listener.
Hide
Mike Wilson added a comment - 14/Sep/08 9:15 AM

As discussed on the mailing list, I think it is very important for drop-in compatibility with 2.0 that DWR 3 doesn't require an extra Listener to shutdown cleanly for non-reverse-Ajax applications. So there should also be shutdown code in Servlet.destroy().

Show
Mike Wilson added a comment - 14/Sep/08 9:15 AM As discussed on the mailing list, I think it is very important for drop-in compatibility with 2.0 that DWR 3 doesn't require an extra Listener to shutdown cleanly for non-reverse-Ajax applications. So there should also be shutdown code in Servlet.destroy().
Hide
Deno Vichas added a comment - 22/Apr/09 11:12 PM

DefaultScriptSessionManager creates non-daemon thread. see - http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html this will cause tomcat to hang. i believe this could be fixed by;

public class DaemonThreadFactory implements ThreadFactory {
public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setDaemon(true); return t; }
}

....

ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory());

i'm not sure where all the changes that need to be made to implement this.

Show
Deno Vichas added a comment - 22/Apr/09 11:12 PM DefaultScriptSessionManager creates non-daemon thread. see - http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html this will cause tomcat to hang. i believe this could be fixed by; public class DaemonThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setDaemon(true); return t; } } .... ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory()); i'm not sure where all the changes that need to be made to implement this.
Hide
David Marginian added a comment - 25/Apr/09 6:00 AM

The thread is non-daemon but DWR does not create a ScheduledThreadPoolExecutor. DWR overrides it with org.directwebremoting.impl.AutoShutdownScheduledThreadPoolExecutor which is supposed to handle the shutdown - if the DwrListener is registered.

Show
David Marginian added a comment - 25/Apr/09 6:00 AM The thread is non-daemon but DWR does not create a ScheduledThreadPoolExecutor. DWR overrides it with org.directwebremoting.impl.AutoShutdownScheduledThreadPoolExecutor which is supposed to handle the shutdown - if the DwrListener is registered.

People

Dates

  • Created:
    05/Mar/08 7:36 PM
    Updated:
    25/Apr/09 6:00 AM
    Resolved:
    16/Sep/08 8:45 AM