简体   繁体   中英

Force the execution of a function before exception handling (JAVA)

I am currently working on a big project (multiples sources files). I would like to fix an abnormal behavior by adding a function execution before the program's stop with exception (I mean I have to add this fonctionnality into a lots of existing functions). Is-it a simple solution (avoiding adding a line for each function) to force the execution ?

thanks a lot

Tis是面向方面编程的完美用例https://en.wikipedia.org/wiki/Aspect-oriented_programming

before the program's stop with exception

You can use addShutdownHook method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM