ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "slava.koptilin" <slava.kopti...@gmail.com>
Subject Re: Compute Grid Questions
Date Tue, 18 Jul 2017 11:50:39 GMT
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.

Mime
View raw message