File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

stop parent process

 
Lee Xu
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Is it possible to stop parent process before the end of child process? How? I got this question during interview.
Thanks
 
James Gray
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should probably preface this answer with that fact that I have never launched a single process from a Java application before.
However, a quick trip over to the API and I'm pretty sure I can safely say yes. The Process object, returned by Runtime.exec(), has a destory() method that appearently forcably terminates the process.
That's a pretty ugly interview question, in my opinion. Is it common to be such a specific question in Java position interviews?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this even a Java question? is what I'm curious about, since process creation and handling is not a platform-independent discussion.
When a parent dies, it may HUP dependent child processes; you may see this behavior when you close the window that launched your browser, taking the browser with it.
nohup(1), when used to load a command, allows the resulting process to ignore the death of its parent and continue processing.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Sagar Bilgi
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it was more of an OS question. I know at least in Unix, if a parent process dies before the child completes execution the child becomes an orphan process and is adopted by the init process.( I think it has a PID of 1 )
Sagar
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic