Hi, So, which version of NetBeans are you using?
The behaviour was changed in 6.3, see "Interruption of tasks" at http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/RequestProcessor.html
HTH, Antonio On 25/07/18 19:48, Oliver Rettig wrote:
Hallo, I have implemented some long running processes with usage of RequestProcessor and ProgressHandle. I want to be able to cancel the processes via UI, so I use requestProcessor = new RequestProcessor("ProcessData",1, true); to create cancelable tasks: RequestProcessor.Task task = requestProcessor.create(runnable);andProgressHandleFactory.createHandle("blablabla", task); to create the ProgressHandle. In the runnable I try to detect the cancelation by if (Thread.interrupted ()) as explained here: https://netbeans.org/download/5_5/org-openide-util/org/openide/util/ RequestProcessor.html but no interruption is detected if I press the cancel button in the progress-ui after pressing the "yes" button in the message window to allow cancelation. I have also found https://rubenlaguna.com/post/2010-01-18-cancellable-tasks-and-progress-indicators-netbeans-platform/ with the suggestion to use Thread.sleep(0) (or any other blocking operation) inside the run() which should result in throwing an InterruptedException which I can catch. But also this exception is never thrown if I press the cancel button. Some explaination about fireing of InterruptedException I have found here: https://dzone.com/articles/interruptedexception-and Any ideas? best regards Oliver
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
