You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by "Higgins, Steven C (Steven)" <sc...@avaya.com> on 2003/04/02 01:13:42 UTC

Shutdown Hooks

I want to handle the case when a Phoenix block calls System.exit().

I'm trying the following but none of the shutdown phase lifecycle methods (i.e. stop() ) are getting called.

        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() { theBlockContext.requestShutdown(); }
        });

Is there a better way?  It seems as if Phoenix is gone before this hook fires.

Steven Higgins

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Shutdown Hooks

Posted by Peter Donald <pe...@realityforge.org>.
On Wed, 2 Apr 2003 09:13, Higgins, Steven C (Steven) wrote:
> I want to handle the case when a Phoenix block calls System.exit().

You can not give that permission to the block and it should not be able to 
call that (unless you explicitly disable the security manager).

> I'm trying the following but none of the shutdown phase lifecycle methods
> (i.e. stop() ) are getting called.
>
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() { theBlockContext.requestShutdown(); }
>         });
>
> Is there a better way?  It seems as if Phoenix is gone before this hook
> fires.

you should not need to even do this as Phoenix will have already registered a 
shutdown hook which will go through and shutdown all the applicatios 
gracefully (or at least attempt to).

-- 
Cheers,

Peter Donald
-------------------------------------------------------
To fight and conquer in all your battles is not supreme 
excellence; supreme excellence consists in breaking the 
enemy's resistance without fighting. - Sun Tzu, 300 B.C.
-------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Shutdown Hooks

Posted by Paul Hammant <Pa...@yahoo.com>.
Steven,

>I want to handle the case when a Phoenix block calls System.exit().
>
>I'm trying the following but none of the shutdown phase lifecycle methods (i.e. stop() ) are getting called.
>
>        Runtime.getRuntime().addShutdownHook(new Thread() {
>            public void run() { theBlockContext.requestShutdown(); }
>        });
>
I had previously thought that Pheonix traps it sys exit itself and calls 
all the shutdown lifecycle methods correctly.  Does not seem to be the 
case in 4.0.x or 4.1..

>Is there a better way?  It seems as if Phoenix is gone before this hook fires.
>
I'll look into it.  No change of not calling system exit I guess (third 
party API)?

- Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org