private void loop()

in harry-core/src/harry/concurrent/InfiniteLoopExecutor.java [99:137]


    private void loop()
    {
        boolean interrupted = false;
        try
        {
            while (true)
            {
                try
                {
                    Object cur = state;
                    if (cur == SHUTTING_DOWN_NOW) break;

                    interrupted |= Thread.interrupted();
                    if (cur == NORMAL && interrupted) cur = INTERRUPTED;
                    task.run((State) cur);

                    interrupted = false;
                    if (cur == SHUTTING_DOWN) break;
                }
                catch (TerminateException ignore)
                {
                    break;
                }
                catch (UncheckedInterruptedException | InterruptedException ignore)
                {
                    interrupted = true;
                }
                catch (Throwable t)
                {
                    logger.error("Exception thrown by runnable, continuing with loop", t);
                }
            }
        }
        finally
        {
            state = TERMINATED;
            isTerminated.signal();
        }
    }