The servlet-async
quickstart demonstrates how to use asynchronous servlets to detach long-running tasks and free up the request processing thread.
The servlet-async
quickstart is a sample project showing the use of asynchronous servlets in WildFly Application Server.
It shows how to detach the execution of a long-running task from the request processing thread, so the thread is free to serve other client requests. The long-running tasks are executed using a dedicated thread pool and create the client response asynchronously.
A long-running task in this context does not refer to a computation intensive task executed on the same machine but could for example be contacting a third-party service that has limited resources or only allows for a limited number of concurrent connections. Moving the calls to this service into a separate and smaller sized thread pool ensures that less threads will be busy interacting with the long-running service and that more requests can be served that do not depend on this service.
The application will be running at the following URL http://localhost:8080/{artifactId}/.