What are those java threads starting with "pool"?

mavroprovato picture mavroprovato · Sep 26, 2011 · Viewed 7.3k times · Source

I have a problem with a Tomcat server that is unable to shutdown gracefully. I have taken a thread dump after I issued the shutdown command, and it looks like this:

http://pastebin.com/7SW4wZN9

The thread which I believe is the "suspect" that does not allow the VM to shut down is the one named "pool-4-thread-1". The rest of them are either daemon threads or internal VM threads. While trying to find out what this thread is for, I noticed that there are other java programs out there that create threads with similar names (For example, JVisualVM creates such threads).

So I'm wondering if someone else knows what this thread is and how it can be created.

Answer

Thilo picture Thilo · Sep 26, 2011

These threads are probably created by an ExecutorService that you created in your code somewhere (directly or indirectly through a library) and that needs to be shutdown (for example in a ServletContextListener).