[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] aspectJ and System.exit().

Thanks Holger,
Runtime.getRuntime.addShutdownHook(Thread hook);
runs very fine ( detects System.exit(), and Control-C on Windows OS)

I can close properly my gzip log files !

Jean-Louis Pasturel

-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Holger Hoffstätte
Envoyé : mardi 18 décembre 2007 14:22
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] 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:

> 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" :-)

aspectj-users mailing list

This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.