2011-09-28 22 views
7

मैं प्रत्येक घंटे नौकरी चलाने के लिए क्वार्ट्ज का उपयोग कर रहा हूं। सर्वलेट टोमकैट पर चल रहा है और जब संदर्भ नष्ट हो जाता है तो सुनने के लिए मैं ServletConextListener का उपयोग कर रहा हूं।क्वार्ट्ज: मेमोरी लीक?

"प्रकट होता है [MyScheduler_Worker -1] नाम का एक धागा शुरू कर दिया है लेकिन इसे रोकने में नाकाम रही है":

जब मैं बिल्ला शट डाउन, मैं संदेश मिलता है।

:

लेकिन बाद में मैं यह संदेश दिखाई दे "[डीबग] 28 सितं, 11: 45:। 26.671 AM MyScheduler_Worker -1 [org.quartz.simpl.SimpleThreadPool]

WorkerThread बंद हो जाता है"

तो क्या यह मानना ​​सुरक्षित है कि इस धागे की वजह से कोई स्मृति रिसाव नहीं है?

यहाँ कैसे मेरी लॉग लग रहा है:

{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

बिलाव कहा जाता है कि बंद करने के लिए सूत्र क्वार्ट्ज के लिए पर्याप्त समय देने के लिए नहीं। लेकिन मैं अभी तक इसे सत्यापित करने में सक्षम नहीं हूं। – Codo

उत्तर

0

आप मान सकते हैं कि वहाँ कोई स्मृति रिसाव क्योंकि आप धागा बंद संदेश दिखाई है। हालांकि, बंद होने से पहले धागे को साफ़ करके चेतावनी आना संभव है।

The shutdown-hook plugin catches the event of the JVM terminating, and calls shutdown on the scheduler. 

विवरण: - http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigPlugins

4

मैं जानता हूँ कि यह एक पुरानी धागा है, लेकिन इस मामले में अन्य लोगों ने उसे तलाश कर रहे हैं।

हम अपने ServletContextListener.shutDown() विधि में क्वार्ट्ज शेड्यूलर को बंद करने के लिए कोड जोड़ते समय तक हर समय धागे की चेतावनियां प्राप्त करने के लिए उपयोग करते हैं।

बंद करने के लिए समय-निर्धारक:

  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; 
       } 
      } 
संबंधित मुद्दे