public void await() {
        if(0 == delay) {
            log.info("No pause between retry");
            return;
        }
        final Timer wakeup = new Timer();
        final CyclicBarrier wait = new CyclicBarrier(2);
        // Schedule for immediate execution with an interval of 1s
        wakeup.scheduleAtFixedRate(new PauserTimerTask(wait), 0, 1000);
        try {
            // Wait for notify from wakeup timer
            wait.await();
        }
        catch(InterruptedException | BrokenBarrierException e) {
            log.error(e.getMessage(), e);
        }
    }
@Test
    public void testAwait() {
        final AbstractBackgroundAction action = new AbstractBackgroundAction() {
            @Override
            public Object run() throws BackgroundException {
                throw new BackgroundException(new RuntimeException("f"));
            }
        };
        try {
            action.call();
            fail();
        }
        catch(BackgroundException e) {
            //
        }
        new BackgroundActionPauser(new BackgroundActionPauser.Callback() {
            @Override
            public void validate() throws ConnectionCanceledException {
                if(action.isCanceled()) {
                    throw new ConnectionCanceledException();
                }
            }

            @Override
            public void progress(final Integer delay) {
                //
            }
        }).await();
    }