Tim Holloway wrote:but you can also spawn an engine thread(s) in your webapp ServletContextListener startup listener.
If you need ReST (or any other HTTP request) to set off a long-running process, then you should use the HTTP request to queue up an out-of-band processor and either poll for completion (as successive periodic HTTP requests) or provide some sort of callback mechanism to notify anyone who wants to know when the long-running request is done. Email, for example.
Paul Clapham wrote:I'm no longer writing web apps, but I have been curious about this for quite a while. Is it okay to just use an ordinary ExecutorService, or when you say "engine thread" does that mean something more limited?
Stephan van Hulst wrote:
You may not create your own ExecutorService, because it will be populated with threads from the JVM directly, while you want the threads to be managed by your application container.