class RetryableOnResult implements Retryable<T, E> {

    @Override
    public T exec(DelegateRetry<T, E> delegate) throws E {
        while (counter.getAndIncrement() < param.getNbRetry()) {
            T result = delegate.call();
            boolean attemptExceedNbRetry = counter.get() >= param.getNbRetry();
            boolean shouldStopRetry = retryOn.negate().test(result);
            if (attemptExceedNbRetry || shouldStopRetry) {
                return result;
            }
            sleep(counter.get(), delegate.toString(), param, randomSleep, onResult, result);
        }

        throw new IllegalStateException("Unreachable statement.");
    }

    public  RetryableOnResult(RetryableParameters param, Predicate<T> retryOn, Consumer<T> onResult);
    public  RetryableOnResult(RetryableParameters param, Predicate<T> retryOn);

}