logo       

Re: aspectJ and System.exit().: msg#01347

Subject: Re: aspectJ and System.exit().
Jean-Louis PASTUREL wrote:
> Aspect regarding, is there a means to know when a JVM is exiting on
> System signal (like Control-C or kill -9 )?

There are the regular shutdown hooks, which are sadly much less useful
than they first appear to be:
http://java.sun.com/j2se/1.4.2/docs/guide/lang/hook-design.html

> If yes is-it possible to apply an advice “before” ?

You can always advise your own code to run before System.exit at either
call or execution. "around" might even work as well because of the way
"finally" works, though I would not bet on "after" :-)

Holger


<Prev in Thread] Current Thread [Next in Thread>