[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-swing-dev
Subject:    <Swing Dev> Ways to cancel SwingWorker running task
From:       roman () kennke ! org (Roman Kennke)
Date:       2011-07-14 0:20:19
Message-ID: 1310602819.4690.5.camel () moonlight
[Download RAW message or body]

Hi Xmly,

> After running some tests with JDK6.0, I find Thread.stop can terminate
> the thread even if it's uninterruptible(ThreadDeath exception on the
> running thread stack). Seems some statements in the article are
> obsolete now?

No they're not. There are very good reasons to try and avoid
Thread.stop(). The most significant being that the ThreadDeath is an (or
rather, *the*) asynchronous exception, meaning it can be thrown at each
point of execution in a thread. I.e. it is pointless to try to catch and
handle it. This basically implies that it's very difficult for the
thread pool to take care of such a situation. I don't know if and to
which extent the JDK thread pools handle ThreadDeath, but I'd assume
that they can seriously mess up things.

Maybe it would help to understand why your task is non-interruptible and
try to find a solution to this. I encountered several cases of
non-interruptible situations (e.g. non-interruptible sockets) all of
which I found a clean solution for. Can you give us a little background
on this?

Best regards, Roman


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic