Results 1 to 2 of 2

Thread: Loading Servlet

  1. #1
    Mindhunter74 is offline Member
    Join Date
    Dec 2007
    Rep Power

    Default Loading Servlet

    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?

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    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.

Similar Threads

  1. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  2. Loading JApplet into Servlet
    By desukishore in forum Advanced Java
    Replies: 1
    Last Post: 02-05-2009, 04:02 PM
  3. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  4. Replies: 1
    Last Post: 08-07-2007, 03:47 PM
  5. problems when loading an image in servlet
    By oregon in forum Java Servlet
    Replies: 1
    Last Post: 08-05-2007, 06:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts