• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LogServlet Sends response first and then processes request

 
Haarshal Kul
Greenhorn
Posts: 3
IBM DB2 Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. If you want the long process to happen independent of the response, you'll need to fire it off in its own thread.
 
Haarshal Kul
Greenhorn
Posts: 3
IBM DB2 Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok that makes sense. I can spawn threads for these.
 
Haarshal Kul
Greenhorn
Posts: 3
IBM DB2 Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic