private <P, R> RetryContextImpl<P, R> createFirstRetryOperationContext(final Throwable throwable, final CompletableFuture<R> result, final Function<P, CompletionStage<R>> f, final P parameterObject, final AutoCloseable service) { final long attemptCount = 1L; final Instant now = Instant.now(); return new RetryContextImpl<>(now, attemptCount, throwable, parameterObject, throwable, parameterObject, result, f, service, this::schedule); }
private RetryContextImpl<Object, Object> getRetryContext(final Throwable latestError) { return new RetryContextImpl<>(null, null, null, null, latestError, null, null, null, null, null); } }
RetryContextImpl<P, R> withNewFailedAttempt(final Throwable error, final Object parameter) { final long attemptCount = getAttempt() + 1; return new RetryContextImpl<>(getStartTimestamp(), attemptCount, getFirstError(), getFirstParameter(), error, parameter, getResult(), getFunction(), getService(), this::schedule); } }