java - What happens to a servlet request after you close the output stream? -
we running on tomcat our application server.
we have servlet generates pdf , returns browser. deletes temporary pdf file.
the issue having timing difficulties delete. on our team decided should wait 20 seconds before delete file, use thread.sleep(20000).
the interesting thing close output stream, wait 20 seconds, , delete file , exit doget().
my question this: since output stream closed on response, returns browser before wait, there performance concerns additional 20 seconds wait? example, tie network connection or such?
well no, have put in application , running quite sometime now, output stream closed, can't communicate user's current request anymore, since doget did not exist servlet's object not destroyed until thread timeout ends.
there no issues regarding network bandwidth, because deletion , waiting happens in memory, background task, thing affects network's bandwidth time taken send response , since respond fast, , finish work later ok.
i suggest use destroy() method instead delete file.
Comments
Post a Comment