From ThreadPoolExecutor JavaDoc (emphasis mine)
New tasks submitted in method
execute(java.lang.Runnable)
will be rejected when theExecutor
has been shut down, and also when theExecutor
uses finite bounds for both maximum threads and work queue capacity, and is saturated. In either case, the execute method invokes theRejectedExecutionHandler.rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)
method of itsRejectedExecutionHandler
. Four predefined handler policies are provided:
- In the default
ThreadPoolExecutor.AbortPolicy
, the handler throws a runtimeRejectedExecutionException
upon rejection.- In
ThreadPoolExecutor.CallerRunsPolicy
, the thread that invokes execute itself runs the task. This provides a simple feedback control mechanism that will slow down the rate that new tasks are submitted.- In
ThreadPoolExecutor.DiscardPolicy
, a task that cannot be executed is simply dropped.- In
ThreadPoolExecutor.DiscardOldestPolicy
, if the executor is not shut down, the task at the head of the work queue is dropped, and then execution is retried (which can fail again, causing this to be repeated.)It is possible to define and use other kinds of
RejectedExecutionHandler
classes. Doing so requires some care especially when policies are designed to work only under particular capacity or queuing policies.
Presumably therefore, reloading the war triggers a shutdown of the Executor
. Try putting the relevant libraries in the war, so that Tomcat’s ClassLoader
has a better chance of correctly reloading your app.