I believe that the JVM Specification reserves the right to *NOT* call
finalizers on JVM exit, in order to avoid potential deadlock issues between
objects requesting synchronization locks. This isn't unique to the servlets
environment.
Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
"I don't even speak for myself; my wife won't let me." --Me
-----Original Message-----
From: guillaume ORIOL <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Saturday, June 19, 1999 9:45 AM
Subject: finalize() never executed
>I have written a Log class that logs errors in a file as they happen in my
>servlet.
>In the servlet's init() method, i put this code:
> String logfile = propr.getProperty("logfile", "errors.log");
> log = new Log(logfile);
>
>In the log class, the constructor begins with:
> public Log(String fichierLog)
> {
> try
> {
> log = new PrintWriter(new FileWriter(logfile, true), true);
> write("Log started.");
> opened = true;
> ...
>
>I wrote a finalize() method for the Log class in order to write a last
>message:
> protected void finalize()
> {
> if(opened == true)
> {
> write("Log stopped.");
> log.close();
> }
> }
>
>The problem is, i never get the message "Log stopped.", even if i close the
>browser
>that initiated the request and even if i stop the web server (i'm working
>with
>Apache 1.3.6/JServ1.0b3 under Win NT4 and i stop it thru the Services
>control panel).
>
>guillaume
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html