I need an executor service to invoke a 3rd party service, to save from rtt and latency, planning to fire all the 3rd party request concurrently.
I would like to know if I should create an ExecutorService per request ? or store at thread local? or one per application?
What happens if i never call shutdown explicitly?
Thanks.
Most likely you want to have a single
ExecutorServiceper whole application. It’s actually a thread pool in disguise, so you probably don’t need a thread pool per one request or per thread.Calling
shutdown()is not necessary, but if this runs within a web application that you plan to redeploy, it will lead to memory leak.