Your question is composed of two parts.
Processing in background
This is one of the cases where threading can be an excellent tool for firing asynchronous methods.
The idea is to start a thread during the request of the user, and let it run in parallel, even after the response has already been returned to the user, and the thread original where the request was processed has already been completed.
When the thread running in background Finish your workload the application can be notified. This 'status' can be later obtained, and a checkout message displayed to the user.
There is a recommendation to use the resources provided by the container (Weblogic, Websphere, Tomcat, etc.), including threads. For this, use what is usually referenced by Container Managed threads. The implementation will depend, in this case, on the container chosen by you.
Asynchronous notification
Asynchronous notification occurs differently. Your application should ask from time to time if there is any notification to display (pooling) or implement some server-side notification technology (push server), as Websockets or similar.
References (in English):
JEE6 tutorial: invoking asynchronous methods
Jboss Developer: How to use Container Managed threads
Why Booting Threads in Java EE Containers Is Not Recommended?
Working with threads in a Java web application
Oracle: Java API for Websocket
I don’t think this is too broad. See the answers. @Kyllopardiun et al., do not want to reconsider?
– bfavaretto
I agree with @bfavaretto, so much so that the current answers effectively answer the question and go the same way I would answer, which (for me at least) shows that it is not so wide.
– utluiz
I agree, and I really believe that the question is not that wide, forgive me if I did not know how to express myself correctly. And really both answers were more than efficient to help me. Thank you.
– Erico Souza