package com.conversantmedia.util.concurrent;

/**
 * Created by jcairns on 2/18/16.
 */
public abstract class AbstractSpinningCondition implements Condition {

    @Override
    public void awaitNanos(final long timeout) throws InterruptedException {
        long timeNow = System.nanoTime();
        final long expires = timeNow+timeout;

        final Thread t = Thread.currentThread();

        while(test() && test() && test() && test() && expires>timeNow && !t.isInterrupted()) {
            timeNow = System.nanoTime();
        }

        if(t.isInterrupted()) {
            throw new InterruptedException();
        }
    }

    @Override
    public void await() throws InterruptedException {
        final Thread t = Thread.currentThread();

        while(test() && test() && test() && test() && !t.isInterrupted()) {
            ;
        }

        if(t.isInterrupted()) {
            throw new InterruptedException();
        }
    }

    @Override
    public void signal() {

    }
}

@@ -410,38 +410,8 @@
 ) &&
- test() && test() && test() &&
  exp
@@ -740,38 +740,8 @@
 ) &&
- test() && test() && test() &&
  !t.

Remove extra test checks