tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Eriksson" <>
Subject RE: servlet lifetime question
Date Fri, 20 Aug 2004 14:21:44 GMT
 Well, I have a finalizer-"method" in both the servlet and the bean,
which looks something like this:
	 System.out.println("servelet finalizer!!!");


-----Original Message-----
From: Shapira, Yoav [] 
Sent: Friday, August 20, 2004 15:17
To: Tomcat Users List
Subject: RE: servlet lifetime question

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 []
>Sent: Friday, August 20, 2004 8:46 AM
>To: Tomcat Users List
>Subject: servlet lifetime question
> 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
>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() );
>request.getSession().setAttribute("mailbox", mailbox);
>RequestDispatcher dispatcher =
>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
> Tobias
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message