kill parent and retain child process?

Reply

Join Date: Apr 2006
Posts: 4
Reputation: uth is an unknown quantity at this point 
Solved Threads: 0
uth uth is offline Offline
Newbie Poster

kill parent and retain child process?

 
0
  #1
Apr 23rd, 2006
Is there anyway to create a new thread..basically create an object of a class within an existing thread and kill this existing thread so only the newly created child remains?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 71
Reputation: Kate Albany is an unknown quantity at this point 
Solved Threads: 1
Kate Albany Kate Albany is offline Offline
Junior Poster in Training

Re: kill parent and retain child process?

 
0
  #2
Apr 24th, 2006
uth,


You can create a new thread at any time. Then if you so desire, let the 'main' thread die by letting the 'public static main' function return. If the thread you created is a 'daemon' thread the JVM will exit all together. However if the thread you created was a 'user' thread the JVM will not exit straight away, instead another thread will be automatically created called 'DestroyJavaVM' which will wait until all 'user' threads return and then kill the JVM. But why would you want to do this, one thread is as good as any other.


Kate
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 4
Reputation: uth is an unknown quantity at this point 
Solved Threads: 0
uth uth is offline Offline
Newbie Poster

Re: kill parent and retain child process?

 
0
  #3
Apr 24th, 2006
Hi Kate,

What I need to do is have another instance of the same class running and shut down the existing instance. Will try what you suggested today!Thanks!

Originally Posted by Kate Albany
uth,


You can create a new thread at any time. Then if you so desire, let the 'main' thread die by letting the 'public static main' function return. If the thread you created is a 'daemon' thread the JVM will exit all together. However if the thread you created was a 'user' thread the JVM will not exit straight away, instead another thread will be automatically created called 'DestroyJavaVM' which will wait until all 'user' threads return and then kill the JVM. But why would you want to do this, one thread is as good as any other.


Kate
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1
Reputation: sgul is an unknown quantity at this point 
Solved Threads: 0
sgul sgul is offline Offline
Newbie Poster

Re: kill parent and retain child process?

 
0
  #4
Jul 11th, 2008
hi!!
i wanna ask did u find any solution of below situation. Actually i want to do erxactly the same, kill the exixting thread before creating new thread.

Thx
Originally Posted by uth View Post
Hi Kate,

What I need to do is have another instance of the same class running and shut down the existing instance. Will try what you suggested today!Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC