I have a java program which writes 1 file into multiple files, not all connections are open at the same time.
I want to add an method to remove all of these created files when the program is killed (by using ctrl-c in the command line).
Adding a shutdown hook is always executed when the object is shut down, I only want to remove them if the program is killed. Is there an RuntimeException I can catch?