Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to kill all associated threads and processes  RSS feed

 
Brian Fleming
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'Ello,

I search the forums a bit and tried a few things, but I still have a problem.

I have a simple java app which I use as a wrapper to a command line interface tool (ClearCase if you want to you).

I create a thread and then I make a system call to the command. This command I am executing launches a GUI tool.

When I press my button to execute the system command within my thread, I can not find a way to kill that system call process. No matter what I do, if I kill my Java window, that system call will execute and a few seconds later even though my java app is closed down, the gui tool from the system call pops up.

I want to be able to kill all spawned processes and threads associated with my app. I thought System.exit() would do it. I even tried to call destroy() from my Process object created from:




Any ideas? thanks for your time.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds right. The Process doc says

The subprocess is not killed when there are no more references to the Process object, but rather the subprocess continues executing asynchronously.

There is no requirement that a process represented by a Process object execute asynchronously or concurrently with respect to the Java process that owns the Process object.


Bummer that Process.destroy() does not kill your process. I'd expect that to be unreliable as it counts on the process listening for some signal.
[ July 01, 2006: Message edited by: Stan James ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!