Here is a note from the JRun 3.0 Release Notes:

*****
Managing Shutdown Time
During a normal shutdown, JRun shuts down all non-daemon threads (for
example, threads used for servlet request handling) and then exits. If the
normal shutdown sequence does not finish within the control.shutdown.time
period, JRun calls the System.exit() method. 

You can use the global.properties file's control.shutdown.time property to
control how long JRun waits before calling the System.exit() method. If you
set this property to 0, JRun never calls the System.exit() method. 
*****

JRun 3.0 SP1 has an enhancement that allows you more control over the
shutdown process. The final SP1 should be up on the Web site very soon.
Here's the relevant discussion from the SP1 Release Notes:

*****
Coding Exit Handlers
By default, JRun calls System.exit() when shutting down. This behavior may
not be appropriate for OEMs and certain other advanced applications. SP1
includes a feature that allows OEMs and other advanced developers to control
JRun's exit behavior.

To control JRun exit behavior, your applications can now implement a new
interface, allaire.jrun.JRunExitHandler. This interface has a single method:


void exitJRun(int exitCode);

Example Code
After instantiating a new instance of a class that implements
JRunExitHandler, the new exit handler can be set on the JRun class. The
instance is held in a static field, so there can only be one exit handler
active at any given point in time. An example implementation follows: 

        import java.io.*;
        import allaire.jrun.*;
        
        /**
         * Extend the base JRunExitHandler class to provide custom
implementation,
         * which, in this case, is to ignore exits
         */ 
        public class MyJRun
            implements JRunExitHandler
        {
            public static void main(String[] args) throws IOException
            {
                // Set the exit handler.
                JRun.setExitHandler(new MyJRun());
                // Start JRun.
                JRun.main(args);         
            }
        
            public void exitJRun(int exitCode)
            {
                // Ignore
            }
        }

Example Description\

Note the following: 
* The class implements JRunExitHandler. 
* You start JRun by invoking the class (java MyJRun args). 
* The main() method instantiates the class, sets the exit handler on JRun,
and then invokes JRun. 
* You will not be able to restart JRun without writing code to handle the
RESTART_EXIT exit code 
* JRun will clean up its resources cleanly, but if a user has written badly
behaved code (such as spawning a non-daemon thread), it is possible that the
process will not exit properly. 
* For more information on JRunExitHandler, refer to the JavaDocs, which are
accessible from the JRun documentation page. 

If JRun should terminate abnormally, or have a request for a restart, the
exitJRun method will be invoked instead of the default exitJRun supplied by
JRun.

*****

Hope this helps,
Randy Nielsen
Allaire Corp.


-----Original Message-----
From: Khaled Ghanem [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 01, 2000 3:27 AM
To: JRun-Talk
Subject: JRUN shutting down/Restart effects on running threads


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C02B78.F183A3E0
Content-Type: text/plain;
        charset="windows-1256"

Hi all,

When JRUN is restarted or shut down, what happens to
the currently running threads of servlets? Do they get
killed? or does JRUN wait until they finish, or does
it give them some time to finish before killing them?

How do I let JRun execute some code before shutting
down by five minutes?

- Khalid


------_=_NextPart_001_01C02B78.F183A3E0
Content-Type: text/html;
        charset="windows-1256"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1256">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2652.35">
<TITLE>JRUN shutting down/Restart effects on running threads</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Courier New">Hi all,</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">When JRUN is restarted or shut down, what
happens to</FONT>
<BR><FONT SIZE=2 FACE="Courier New">the currently running threads of
servlets? Do they get</FONT>
<BR><FONT SIZE=2 FACE="Courier New">killed? or does JRUN wait until they
finish, or does</FONT>
<BR><FONT SIZE=2 FACE="Courier New">it give them some time to finish before
killing them?</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">How do I let JRun execute some code
before shutting</FONT>
<BR><FONT SIZE=2 FACE="Courier New">down by five minutes?</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">- Khalid</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C02B78.F183A3E0--
----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to