I have 1 more question regarding this matter.
During the upgrade of the servlet, I need to 1. serialize the current session using that servlet 2. undeploy the old servlet 3. deploy the new servlet 4. deserialize the session saved in #1
During this window (from step 1 to 4), if there is a request coming in for those sessions (either during serializion or deserialization), what will happens?
Will that request drop? Or that request will be queued by Tomcat, and it will be served when the whole upgrade is done?
When you redeploy a servlet, you're actually redeploying the entire context (the entire web application). This means if a request comes in between steps (2) and (3) above, Tomcat will return an "No Context Available" error to your user because there will be no web application available to service the request; the request will not be queued.
Once the context has been reloaded, your sessions will be deserialized and available and all requests will/should function properly.
justin
-----Original Message----- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 11:20 AM To: Tomcat Users List Subject: RE: Hotswap servlet code in Tomcat 5?
Hi, Is Counter Serializable?
Yoav Shapira Millennium ChemInformatics
>-----Original Message----- >From: Samuel Cheung [mailto:[EMAIL PROTECTED] >Sent: Monday, March 08, 2004 12:15 PM >To: 'Tomcat Users List' >Subject: RE: Hotswap servlet code in Tomcat 5? > >Thanks. > >I try this, but it is different from what I expected. > >In my doGet() of my servlet, I have a Counter object in my session. >When I reload the page in my browser, I see the value of the counter >increments. (say from "0" to "1" to "2"). > >Then I go to the Tomcat manager web page, and then "undeploy" the original >servlet, and "deploy" a newer version of the same servlet (context name is >the same). The value of the counter starts from "0" again when I reload the >page again. > >The difference between the orginal servlet and the new servlet is the name >of the Method "inc()". I rename it to "newInc()" in the new servlet. > >I am expecting the value of the counter will be "3" when I reload the >browser after I undeploy/deploy the servlet. Is this a correct assumption? > >Here is the portion of the doGet() method in my servlet. > > public void doGet(HttpServletRequest request, > HttpServletResponse response) > throws IOException, ServletException > { > HttpSession session = request.getSession(true); > > Counter sessionCounter = (Counter) >session.getAttribute("session_counter"); > > if (sessionCounter == null) { > sessionCounter = new Counter(); > session.setAttribute("session_counter", sessionCounter); > } > > // rename inc() to newInc() > sessionCounter.inc(); > out.println("session counter ="); > out.println(sessionCounter.getValue()); > } > > >-----Original Message----- >From: Shapira, Yoav [mailto:[EMAIL PROTECTED] >Sent: Friday, March 05, 2004 7:44 AM >To: Tomcat Users List >Subject: RE: Hotswap servlet code in Tomcat 5? > > >Hi, > >>If the objects in the session is serialized to the disk and then >>re-serialized when I re-deploy my servlet, what happens if the class in >my >>newer version of my servlet has >>- added/removed methods/attributes in the class >>- added/removed static variables in the class >> >>How will the hotswap work? > >One has nothing to with the other, unless you're design is so bad that >it places a instance of your servlet class as a session attribute. > >Yoav Shapira > > > >This e-mail, including any attachments, is a confidential business >communication, and may contain information that is confidential, >proprietary >and/or privileged. This e-mail is intended only for the individual(s) to >whom it is addressed, and may not be saved, copied, printed, disclosed or >used by anyone else. If you are not the(an) intended recipient, please >immediately delete this e-mail from your computer system and notify the >sender. Thank you. > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else. If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender. Thank you.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
______________________________________________ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential. See: http://www.nextengine.com/confidentiality.php ______________________________________________
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
