I have a program (actually an eclipse plugin) that has to shut down a program even if it becomes frozen and the user has to use ctrl+alt+delete. If the java program is
shut down using this and the java program doesn't shut down a certain program that it was using via a socket (sbcl.exe), sbcl.exe suddenly starts sucking down resources (50 percent
or more of cpu). I don't want the user to have to use ctrl+alt+delete to shut down sbcl also. So my question is, is there anyway to make sure that this program shuts down when the java program shuts down (forcibly)?
When you forcibly stop a program, that program doesn't get any chance to do anything before the operating system stops it. There is nothing you can do inside your Java program to make it stop the other program (sbcl.exe) when the Java program is forcibly stopped.
What you could do is make a small third program, which periodically checks if the Java program is still running or if it has been shut down cleanly. If it isn't running and hasn't shutdown cleanly, then that third program kills sbcl.exe.
Don't you have the source code of sbcl.exe? Isn't it strange that it starts sucking up resources if the Java program isn't running?
Ya, it is strange, but sbcl.exe is a reputable open source software. And I can run it outside my java program, and it doesn't suck down resources. So i think it is safe. Thanks, i will try that solution.