>From sun java doc:
Registers a new virtual-machine shutdown hook.
 The Java virtual machine shuts down in response to two kinds of events:
 The program exits normally, when the last non-daemon thread exits or
when the exit (equivalently, System.exit) method is invoked, or
 The virtual machine is terminated in response to a user interrupt, such
as typing ^C, or a system-wide event, such as user logoff or system
shutdown.

In rare circumstances the virtual machine may abort, that is, stop
running without shutting down cleanly. This occurs when the virtual
machine is terminated externally, for example with the SIGKILL signal on
Unix or the TerminateProcess call on Microsoft Windows. The virtual
machine may also abort if a native method goes awry by, for example,
corrupting internal data structures or attempting to access nonexistent
memory. If the virtual machine aborts then no guarantee can be made
about whether or not any shutdown hooks will be run.

[EMAIL PROTECTED] a écrit :
> Hi Chuck,
>
> Digging through the Cobertura code, it looks like it's making the following
> call:
>
>       Runtime.getRuntime().addShutdownHook(new Thread(saveTimer));
>
> it's run() method simply has the call to save the project data.
>
> This should be "guaranteed" to run (with the usual limitations of sudden
> errors etc.) when the jvm shuts down, shouldn't it?
>
> cheers,
>
> David
> x54680
>
>
>                                                                            
>              "Caldarale,                                                   
>              Charles R"                                                    
>              <Chuck.Caldarale@                                          To 
>              unisys.com>               "Tomcat Users List"                 
>                                        <users@tomcat.apache.org>           
>              02/20/2007 02:40                                           cc 
>              PM                                                            
>                                                                    Subject 
>                                        RE: Tomcat & Cobertura              
>              Please respond to                                             
>                "Tomcat Users                                               
>                    List"                                                   
>              <[EMAIL PROTECTED]                                             
>                  che.org>                                                  
>                                                                            
>                                                                            
>
>
>
>   
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Subject: RE: Tomcat & Cobertura
>>
>> Any idea what's hidden in tomcat5.exe that is different from
>> running startup.bat, and prevents Cobertura from recognizing
>> when the server is shutdown?
>>     
>
> The service launcher (tomcat5.exe) has more control over the operation
> of the JVM than the standard launcher (java.exe) does.  I have no idea
> whether or not the service launcher makes use of that control.
>
> For system properties, you can use the tomcat5w.exe utility to set or
> examine the ones in use with the service.  Note that this utility also
> has a provision for setting the working directory, although Tomcat
> itself makes no use of that.
>
> How is Cobertura supposed to get control during Tomcat termination?  If
> it's using a lifetime listener as defined in the servlet spec, that
> should function the same regardless of whether Tomcat is run from the
> command prompt or as a service.  If Cobertura is relying on some other
> mechanism (e.g., System.runFinalization() or
> System.runFinalizersOnExit()), that can be problematic, since there's no
> guarantee it will ever actually occur.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to