Hi Slava,

I didn't know flags were cleared by *Thread.sleep()*, that makes sense now.

Approach 1 in the code below works fine, but the second approach still
won't interrupt a task with a given name. I'm surely missing something else.

Is *ignite.compute().undeployTask(...)* supposed to work like this?

https://gist.github.com/anonymous/3891dfedf26bfcf3314215004e67daa8

Thanks,
Matt

On Tue, Jul 18, 2017 at 8:50 AM, slava.koptilin <[email protected]>
wrote:

> Hi Matt,
>
> It seems that your code is not quite correct.
> In accordance with the spec Thread.sleep(long millis) clears the
> interrupted
> status in case of InterruptedException is raised.
> Could you try the following implementation of IgniteRunnable?
>
>     public static class MyTask implements IgniteRunnable {
>         @Override public void run() {
>             boolean isInterrupted = false;
>
>             while (!isInterrupted) {
>                 isInterrupted = Thread.currentThread().isInterrupted();
>
>                 try {
>                     Thread.sleep(3000);
>                 }
>                 catch (InterruptedException e) {
>                     isInterrupted = true;
>                 }
>
>                 System.out.println("isInterrupted: " + isInterrupted);
>             }
>         }
>     }
>
> Thanks,
> Slava.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Compute-Grid-Questions-tp14980p15055.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to