| Author |
LogServlet Sends response first and then processes request
|
Haarshal Kul
Greenhorn
Joined: Sep 01, 2011
Posts: 3
|
|
I have a servlet that receives the post http request and logs the data in the HTTP body. It does not return anything back and client does not need anything other than HTTP 200 status.
Lately we have seen a lot of delay in this process due to heavy load. Can I just commit the response using either flushBuffer() or PrintWriter flush() and close()?
Are there any disadvantages to that?
Logging process can it's sweet time once the response is sent. Am I thinking right?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
|
Nope. If you want the long process to happen independent of the response, you'll need to fire it off in its own thread.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Haarshal Kul
Greenhorn
Joined: Sep 01, 2011
Posts: 3
|
|
|
Ok that makes sense. I can spawn threads for these.
|
 |
Haarshal Kul
Greenhorn
Joined: Sep 01, 2011
Posts: 3
|
|
|
Thanks a lot.
|
 |
 |
|
|
subject: LogServlet Sends response first and then processes request
|
|
|