Probably it's a false problem.
I tried a load test with 600 task executed by 10 thread and I had no problems.
I don't see any WildFly or Java EE constructs in this code, so the behaviour/semantic should be exactly like what the javadoc of Executors#newFixedThreadPool dictates.
Mario Rossi wrote:
The statement executor.shutdown() seems not to kill the threads .
Can you get a thread dump and point us to the threads that you think are still running and not killed?
Also I'd like to add that using a spin loop to wait for the executor shutdown is probably a bad idea; there is an awaitTermination method which is probably better.
Finally it's likely better to share a single thread pool over the life of the application than to create a new one on every request. Java EE 7 has a facility for using thread pools safely from a Java EE application.