Re: Shutdown Hook in Tomcat 5.5.26

2008-03-31 Thread Ho Fat Tsang
Hello Chris,

  Thank for your reply and yes. It seems System.out is subtle at that
moment and it is not a good indicator for validation. I have re-written
something else and it works fine.

But let me elaborate what i want to achieve. I would like to deliver a alert
email when the JVM shutdown. The root cause why the shutdown hook does not
work because there is a hidden exception at the previous implementation
because the webapp class loader reject to load the class after tomcat has
been shutdown.

So i have to use a separate thread with appropriate context class loader to
execute my shutdown hook.

Thank
Twinsen.

On Fri, Mar 28, 2008 at 9:49 PM, Christopher Schultz 
[EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Twinsen,

 Ho Fat Tsang wrote:
 | public class TestThread extend Thread
 | {
 |  public void run()
 |  {
 |System.out.println(Invoking shutdown);
 |  }
 | }
 |
 |   The hook is executed ONLY when i press CTRL+C using console but it
 is not
 | desired solution as my projects required it should run under service /
 | daemon mode.

 Are you sure that System.out is going somewhere predictable when you run
 Tomcat as a service? Can you see other Tomcat shutdown information?

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.8 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkfs90wACgkQ9CaO5/Lv0PCoGQCeOdtgHF0h6ezUFfzTZj8qdKwW
 +l4AmwcJHvMIX9+waoWT42hlC0Gtmbk6
 =uBuo
 -END PGP SIGNATURE-

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




Re: Shutdown Hook in Tomcat 5.5.26

2008-03-28 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Twinsen,

Ho Fat Tsang wrote:
| public class TestThread extend Thread
| {
|  public void run()
|  {
|System.out.println(Invoking shutdown);
|  }
| }
|
|   The hook is executed ONLY when i press CTRL+C using console but it
is not
| desired solution as my projects required it should run under service /
| daemon mode.

Are you sure that System.out is going somewhere predictable when you run
Tomcat as a service? Can you see other Tomcat shutdown information?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfs90wACgkQ9CaO5/Lv0PCoGQCeOdtgHF0h6ezUFfzTZj8qdKwW
+l4AmwcJHvMIX9+waoWT42hlC0Gtmbk6
=uBuo
-END PGP SIGNATURE-

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