2011-09-28 32 views
7

Her saat başı bir iş yapmak için Quartz kullanıyorum. Servlet Tomcat üzerinde çalışıyor ve bağlam yok olduğunda dinlemek için ServletConextListener kullanıyorum.Kuvars: Bellek Kaçak?

"[MyScheduler_Worker-1] adında bir Konuyu başlatan görünüyor ama bunu durdurmak için başarısız oldu": Ne tomcat kapattığınızda

, mesajı aldım.

:

Ama daha sonra ben bu mesajı görüyorsanız "[DEBUG] 28 Eylül 11: 45:. MyScheduler_Worker-1 [org.quartz.simpl.SimpleThreadPool]

WorkerThread kapatıldığında 26,671 AM"

Bu iş parçacığı nedeniyle bellek sızıntısı olmadığını varsaymak güvenli midir? İşte

benim günlük görünür:

{SEVERE: The web application [/*************] appears to have started a thread 

named [MyScheduler_Worker-1] but has failed to stop it. This is very likely to c 

reate a memory leak. 

Sep 28, 2011 11:45:26 AM org.apache.catalina.loader.WebappClassLoader clearRefer 

encesThreads 

SEVERE: The web application [/*************] appears to have started a thread 

named [MyScheduler_Worker-2] but has failed to stop it. This is very likely to c 

reate a memory leak. 

Sep 28, 2011 11:45:26 AM org.apache.catalina.loader.WebappClassLoader clearRefer 

encesThreads 

SEVERE: The web application [/*************] appears to have started a thread 

named [MyScheduler_Worker-3] but has failed to stop it. This is very likely to c 

reate a memory leak. 

[DEBUG] 28 Sep 11:45:26.671 AM MyScheduler_Worker-2 [org.quartz.simpl.SimpleThre 

adPool] 

WorkerThread is shut down. 



[DEBUG] 28 Sep 11:45:26.671 AM MyScheduler_Worker-1 [org.quartz.simpl.SimpleThre 

adPool] 

WorkerThread is shut down. 



[DEBUG] 28 Sep 11:45:26.671 AM MyScheduler_Worker-3 [org.quartz.simpl.SimpleThre 

adPool] 

WorkerThread is shut down. 
+0

Tomcat kapatma konuları Quartz için yeterli zaman vermek değil söylenir. Ama henüz bunu doğrulayamadım. – Codo

cevap

4

Ben bu eski bir iplik ama durumda biliyorum diğerleri onu arıyor.

Quartz Scheduler'ı ServletContextListener.shutDown() yöntemimizde kapatmak için kod ekleyene kadar her zaman iş parçacığının uyarılarını almak için kullanırız.

kapatma için Zamanlayıcı:

  quartzScheduler.shutdown(); 

      int ct = 0; 

      // Try waiting for the scheduler to shutdown. Only wait 30 seconds. 
      while(ct < 30) { 
       ct++; 
       // Sleep for a second so the quartz worker threads die. This 
       // suppresses a warning from Tomcat during shutdown. 
       Thread.sleep(1000); 
       if (quartzScheduler.isShutdown()) { 
        break; 
       } 
      } 
İlgili konular