I planned to use executor framework in one of my web application for background process such as sending mail and logging the details.When i start reading about the Executor API , i understood that it offers thread pooling facility. But i have a thought like we no need thread pooling mechanism in web applications. Because by default my application server controlling the thread polling and all right. So my point here is we no need to implement thread pooling in web application scenarios? Is this point is right or wrong?
Share
It depends which threads you are referring to.
The threads used to handle requests coming into the application server are handled by the container itself. You don’t need to worry about that.
However, if your application needs to handle longer tasks that are initiated by requests, and you want to respond to the requests quickly, then you can have threads handle these tasks. To do this, you can start a number of threads at the application startup and use them when you need to run a long task. See this.