I use Servlet/EJB model. When the user requests for a statement report for his past transactions, it takes hours for the server to generate the report. So the response is not sent from the server till the request is processed.
For eg. Client requests report -> Servlet receives request -> Calls EJB to process it , EJB generates the report after hours -> sends response to servlet -> responds to Client.
But is it possible to respond to the user as soon as the request is received in the servlet. For eg.
Client requests report -> Servlet receives request -> Servlet responds 'Report will be available soon'
Servlet -> Calls EJB to process it , EJB generates the report after hours -> sends response to servlet ->responds to Client when client requests the report again.
That is , can I create a thread from Servlet and use that for calling the EJB, while the Servlet responds to the user stating that the request will be processed soon