Re: Continuously re-spawning a stopped/killed thread

Thorsten via Concurrency-interest <[email protected]> Fri, 18 Dec 2020 13:42:26 +0100
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <[email protected]>
Am 18/12/2020 um 13:15 schrieb Volkan Yazıcı:
> Then we received the complaint regarding ThreadDeath. Rather than 
> trying to engineer a smart try-catch block, I want to return back to 
> the first simple form where I only catch Exceptions, but then I need 
> to get the thread automatically respawned on unintended deaths. I 
> thought of leveraging the "unhandled exception handler" mechanism of 
> Executors for this automatic respawning. What do you think?

Hello,

I think that's overengineering for a use case that probably never 
existed. What is this 'complain' about?  Why does someone call 
Thread#stop instead of the official API and what does he expect do 
happen?  If you ignore ThreadDeath, your Thread might continue running. 
If you handle it, your Thread will die, and the rest of you library 
might run into problems because your Thread ist gone. If you respawn 
your Thread, it could be the opposite of what the user wanted, because 
he tried to 'stop' the tread and its immediatly back. So any 'solution' 
is just a hack with sideeffects.


Best Regards,

Thorsten
<https://en.wikipedia.org/wiki/Overengineering>



      <https://en.wikipedia.org/wiki/Overengineering>

<https://en.wikipedia.org/wiki/Overengineering>

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