Why never daemon threads with default threadfactory?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Why never daemon threads with default threadfactory?

Peter Veentjer - Anchor Men
Why are the threads created with the default thread
factory never deamon threads? even though their threadgroup
could have the daemon property set to true.
 
 
 
 

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: Why never daemon threads with defaultthreadfactory?

David Holmes
Peter,

> Why are the threads created with the default thread
> factory never deamon threads? even though their threadgroup
> could have the daemon property set to true.

First, daemon threads and daemon threadgroups are completely unrelated.
Daemon threads won't keep the VM alive while they are executing. Daemon
thread groups are automatically destroyed when they become empty.

The default thread factory doesn't create daemon threads because the common
case is that you want any tasks submitted to an executor to actually get
executed. Daemon threads wouldn't support this unless you always used an
application thread to wait until the executor had finished.

If you truly want daemon threads it is easy to change the thread factory.

Note that daemon threads are deceptive creatures. Only the most trivial of
tasks can be arbitrarily terminated in the middle of processing - as would
happen if the JVM terminated.

Cheers,
David Holmes

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: Why never daemon threads with defaultthreadfactory?

Peter Veentjer - Anchor Men


>>The default thread factory doesn't create daemon threads because the
>>common case is that you want any tasks submitted to an executor to
>>actually get executed. Daemon threads wouldn't support this unless you

>>always used an application thread to wait until the executor had
>>finished.
Aha ok.

>>If you truly want daemon threads it is easy to change the thread
>>factory.
I already did and that was why I was wondering why the daemon property
with the default threadfactory Was set to false even though the daemon
property of the Threadgroup is true.

>>Note that daemon threads are deceptive creatures.
>>Only the most trivial of tasks can be arbitrarily terminated in the
>>middle of processing - as would happen if the JVM terminated.
I know (it happend to me once). But I`m creating a new threadfactory
where I have more control and was wondering why things are done in the
default threadfactory.

Met vriendelijke groet,

Peter Veentjer
Anchor Men Interactive Solutions - duidelijk in zakelijke
internetoplossingen

Praediniussingel 41
9711 AE Groningen

T: 050-3115222
F: 050-5891696
E: [hidden email]
I : www.anchormen.nl

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: Why never daemon threads withdefaultthreadfactory?

David Holmes
Peter,

> I already did and that was why I was wondering
> why the daemon property with the default threadfactory
> Was set to false even though the daemon property of the
> Threadgroup is true.

I don't know what you are talking about here. The default ThreadFactory
doesn't create or modify the ThreadGroup that will be used. If the group is
a daemon group then it has nothing to do with the thread factory.

And as I said: being a daemon Threadgroup has absolutely NO connection with
daemon threads.

Cheers,
David Holmes

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: Why never daemon threads withdefaultthreadfactory?

Peter Veentjer - Anchor Men

>> I already did and that was why I was wondering
>> why the daemon property with the default threadfactory
>> Was set to false even though the daemon property of the
>> Threadgroup is true.
>
>I don't know what you are talking about here. The default ThreadFactory
>doesn't create or modify the ThreadGroup that will be used. If the
group is
>a daemon group then it has nothing to do with the thread factory.
>
>And as I said: being a daemon Threadgroup has absolutely NO connection
with
>daemon threads.
Aha ok.. I thought there was some relation: if a threadgroup is a daemon
and a thread created ( and linked to that threadgroup) would also be a
daemon.
But clearly that isn`t the case.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest