簡體   English   中英

無法停止輔助線程,可能會導致內存泄漏。

[英]Failed to stop the worker thread, likely to create a Memory leak.

我正在使用實現ServletContextListener的Servlet來啟動Crystal Scheduler實例@ starup。 在contextDestroyed()方法中,調度程序實例已停止。

@Override
public void contextDestroyed(ServletContextEvent sce) {
    try {
        Scheduler scheduler = QuartzSchedulerUtil.getCurrentScheduler();
        scheduler.shutdown(true);
        // Sleep for a bit so that we don't get any errors
        Thread.sleep(1000);
        Driver mySqlDriver = DriverManager.getDriver(hibernateConnectionUrl);
        DriverManager.deregisterDriver(mySqlDriver);
    } catch (SchedulerException ex) {
        Logger.getLogger(QuartzServlet.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InterruptedException ex) {
        Logger.getLogger(QuartzServlet.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(QuartzServlet.class.getName()).log(Level.SEVERE, null, ex);
    }        
    System.out.println("THE QUARTZ APP STOPPED");
}

但是,在部署應用程序時,我收到內存泄漏警告,指定woker線程沒有停止。

Jul 10, 2012 3:46:12 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/latest-raisin]
appears to have started a thread named [Timer-0] but has failed to
stop it. This is very likely to create a memory leak.

Jul 10, 2012 3:46:12 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/latest-raisin]
appears to have started a thread named 
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but
has failed to stop it. This is very likely to create a memory leak.

Jul 10, 2012 3:46:12 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/latest-raisin]
appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but
has failed to stop it. This is very likely to create a memory leak.

Jul 10, 2012 3:46:12 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/latest-raisin]
appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but
has failed to stop it. This is very likely to create a memory leak.

我嘗試了帖子中提到的解決方案-http://forums.terracotta.org/forums/posts/list/15/4341.page,但是在取消部署該應用程序時仍然收到嚴重的內存泄漏警告。

您可以將org.quartz.scheduler.interruptJobsOnShutdown的屬性設置為在要關閉時仍在執行中的作業中斷。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM