Forums Register Login

Forcibly Shutting Java Program Down

+Pie Number of slices to send: Send
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)?
Thanks!
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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.
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 944 times.
Similar Threads
How to stop rmi server?
Unable to shutdown Jboss 3.0.6
Determining the exiting of a class - help!!!!
Editing in Eclipse - shortcut to copy a line?
System.exit(0);
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:53:43.