Page 1 of 1

About Question enthuware.ocpjp.v7.2.1500 :

Posted: Wed Jun 26, 2013 3:50 pm
by The_Nick
"You can stop any thread". As far as I know it's only possible to interrupt a thread or handle the interrupt flag with some flow control in order to terminate it.
Do you mean interrupting the thread by using t.interrupt() with "stop any thread"?
What about deamon thread are they stoppable or is the only way to terminate them terminating all the user threads?
Thanks in advance.

The_Nick.

Re: About Question enthuware.ocpjp.v7.2.1500 :

Posted: Thu Jun 27, 2013 7:26 am
by admin
There is a stop() method in Thread class, which is deprecated but it is there. It can be used to stop any thread - daemon or not.
HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1500 :

Posted: Tue Sep 17, 2013 7:45 am
by The_Nick
Hi,
You say in the explanation that:
For example, the Garbage Collector thread is useful only if some user thread is running. If all the user threads end then what is the use of GC thread? So the program should end when all the non-daemon threads end.
Does it mean that GC thread is always a deamon thread?
I thought it was not guaranteed.
Thanks in advance.

The_Nick.

Re: About Question enthuware.ocpjp.v7.2.1500 :

Posted: Tue Sep 17, 2013 7:51 am
by admin
It is just an example to explain why daemon threads should not keep a program running. But can you please tell me where you saw that GC thread may not be a daemon thread?

thank you,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1500 :

Posted: Wed Sep 18, 2013 8:16 am
by The_Nick
You right, my bad. I think I read only that it's not guaranteed which thread will handle the GC but not what kind of thread. On the other hand I have never read in any official documentation that the GC thread will be surely a daemon thread.
However it makes much more sense thinking that it's a Daemon thread, otherwise what could it be?

Thanks.