Results 1 to 2 of 2
Thread: Loading Servlet
- 08-02-2009, 11:34 AM #1Member
- Join Date
- Dec 2007
- Rep Power
I've read this paragraph in a textbook introducing servlets:
A servlet is loaded by the servlet container the first time the servlet is requested. The servlet then is forwarded the user request, processes it, and returns the response to the servlet container, which in turn sends the response back to the user. After that, the servlet stays in memory waiting for other requests-it will not be unloaded from the memory unless the servlet container sees a shortage of memory. Each time the servlet is requested, however, the servlet container compares the timestamp of the loaded servlet with the servlet class file. If the class file timestamp is more recent, the servlet is reloaded into memory. This way, you don't need to restart the servlet container every time you update your servlet.
I can't get the statement in bold. What is that timestamp being compared and why would the timestamp of the loaded servlet differ than that of the servlet class file?
- 10-05-2009, 11:11 PM #2
it is possible to update the .class file in a running deployed application instance, such as from uploading a new .war file (but that usually triggers a context reload anyway).
the web applicatation container's class loader would have custom logic to inspect the file system's copy of the .class file to read its modified timestamp and compare to its own last loaded time.
- By balachandarr in forum Java ServletReplies: 0Last Post: 04-15-2009, 05:06 PM
- By desukishore in forum Advanced JavaReplies: 1Last Post: 02-05-2009, 05:02 PM
- By StewS in forum Java ServletReplies: 1Last Post: 12-02-2008, 01:23 AM
- By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 04:47 PM
- By oregon in forum Java ServletReplies: 1Last Post: 08-05-2007, 07:02 PM