I have a scenario and cant find reasonable answer. So posting the question directly !
Scenario -
I make a ajax request and send a file to be uploaded to the server.
On server(tomcat), I download the file and start processing it.
I run the download-file method on main thread and process-file method on new thread since it takes too long for processing and I dont want user to wait so long.
My Issue :
The Ajax response will catch the response in call back method for download-file method.
My process-file method also return the status response which I require to display on front-end when the processing is complete.
But I cannot because Runnable Interface has return type void for its run method.
Question -
- How can I get result from process-file method and send in as response to front-end
- If I am able to acheive above, how can I catch the response on front end javascript since main thread response will be caught in ajax success method already.