tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: servlet lifetime question
Date Fri, 20 Aug 2004 13:17:01 GMT

Hi,
How are you testing to see that the "finalizer" has run?  What you're
saying doesn't jive with what I know of Tomcat ;)  That said, the
servlet container is free to destroy and recreate servlet instances as
it sees fit.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Tobias Eriksson [mailto:tobias.eriksson@comopt.com]
>Sent: Friday, August 20, 2004 8:46 AM
>To: Tomcat Users List
>Subject: servlet lifetime question
>
>Hi
> I have a servlet creating a bean and then publishing it on a jsp page.
>In the logs I can see that the FINALIZER for the servlet and bean is
run
>after a short while.
> There are a few things that I don't understand here, but foremost
>1) Why is the bean garbage collected when I in the servlet and jsp page
>have set the scope to be SESSION?
>
>mailbox = (MailBean) request.getSession().getAttribute( "mailbox" );
>if( mailbox == null ) {
>	mailbox = new MailBean( request.getContextPath() );
>}
>mailbox.populateLocalStore();
>
>request.getSession().setAttribute("mailbox", mailbox);
>
>RequestDispatcher dispatcher =
>getServletContext().getRequestDispatcher("/inbox.jsp");
>
>dispatcher.forward( request, response );
>
>2) When I press [REFRESH] in the browser, and then look in Tomcat's
>stdout-log, I can see that the finalizer for both the servlet and the
>bean has been run, but what puzzles me is that I can then see that the
>doGet() method of the servlet is run on every REFRESH but then the
>servlet does not exists anymore. How is this possible?
>
>InboxServlet constructor running!!!
>InboxServlet doGet running!!!
>MailBean Constructed...
>Parsing POP3 Folder:INBOX Number of messages: 1
>InboxServlet finalizer running!!!
>MailBean finalizer running...
>Adding message with subject: test 4
>1 Messages added to the folder; INBOX
>found 17 messages in inbox
>InboxServlet doGet running!!!
>
>3) Does anyone know of or have a nice mail servlet/jsp solution?
>
>By the way, appreciate all the quick responses I got so far, thanx
guys.
>
>Regards
> Tobias
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message