943,590 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 9133
  • Java RSS
Apr 23rd, 2006
0

kill parent and retain child process?

Expand Post »
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?
Similar Threads
uth
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uth is offline Offline
4 posts
since Apr 2006
Apr 24th, 2006
0

Re: kill parent and retain child process?

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
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
Kate Albany is offline Offline
71 posts
since Jun 2005
Apr 24th, 2006
0

Re: kill parent and retain child process?

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!

Quote 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
uth
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uth is offline Offline
4 posts
since Apr 2006
Jul 11th, 2008
0

Re: kill parent and retain child process?

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
Click to Expand / Collapse  Quote originally posted by uth ...
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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sgul is offline Offline
1 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: need help with very very basic java
Next Thread in Java Forum Timeline: J2EE and TCP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC