Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you define an external flag which a thread is suppose to poll and exit when it's set - <strong>it must be <code>volatile</code></strong>. Otherwise the thread might never see the change made by other thread.</p> <p>However there is already a feature like that in standard API - it is called an <code>interrupt()</code> method and <code>Thread.currentThread().isInterrupted()</code>. No need to duplicate already existing logic. See: <a href="https://stackoverflow.com/questions/7786305/stopping-a-specific-java-thread/7786333">Stopping a specific java thread</a>.</p> <p>That being said calling <code>interrupt()</code> on each and every thread is a bad idea as well because there is no guarantee that all threads respond to it. Examining your exceptions I noticed the following threads not being cleaned up properly:</p> <ul> <li><p><code>com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0</code> - close the C3P0 data source. Since you are using Spring simply add <code>destroy-method="close"</code>. We're done with this thread.</p></li> <li><p><code>File Reaper</code> - as far as I can see this thread is created by <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/FileCleaningTracker.html" rel="nofollow noreferrer">FileCleaningTracker</a>. You need to call <code>FileCleaningTracker.exitWhenFinished()</code> explicitly when shutting down your application (or when the class is no longer needed, I never used it) or let Spring to do this (see above). Chances are some 3rd party library uses it and not closing properly - this means it has a bug.</p></li> <li><p><code>pool-1-thread-22</code> - this is one of the threads created by <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html" rel="nofollow noreferrer"><code>Executors</code></a> utility inside <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html" rel="nofollow noreferrer"><code>ExecutorService</code></a>. Make sure you call <code>shutdown()</code> on every such a pool in your application during shutdown.</p></li> <li><p><code>org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-2</code> - Quartz worker thread (the one that actually runs jobs). <code>SchedulerFactoryBean</code> closes the scheduler for you automatically, I think Tomcat is mistaken here, I see this error often as well. Nevertheless looks like setting <code>SchedulerFactoryBean.waitForJobsToCompleteOnShutdown</code> to <code>true</code> solves this.</p></li> <li><p><code>com.iteezy.shared.domain.DirEntry.data</code> - I am not sure about this one. It is either your own thread that needs to be interrupted upon shutdown or H2 database thread (?) Its stack needs to be examined to guess where does it come from.</p></li> </ul> <p>The bottom line is: don't just kill everything that moves (actually, Tomcat does that for you after issuing this warning) but determine where the threads come from and use framework/library specific <code>close()</code> method to allow further cleanup. Be gentle.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload