From 18f4a82d7e5e06d340e1e5586a360a1669eab639 Mon Sep 17 00:00:00 2001 From: Jonathan Halterman Date: Wed, 22 Sep 2021 09:08:54 -0700 Subject: [PATCH] Example cleanup --- .../java/net/jodah/failsafe/examples/RetryLoopExample.java | 4 ++-- src/test/java/net/jodah/failsafe/examples/RxJavaExample.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/net/jodah/failsafe/examples/RetryLoopExample.java b/src/test/java/net/jodah/failsafe/examples/RetryLoopExample.java index 5e9f974c..4416d74a 100644 --- a/src/test/java/net/jodah/failsafe/examples/RetryLoopExample.java +++ b/src/test/java/net/jodah/failsafe/examples/RetryLoopExample.java @@ -37,7 +37,7 @@ public class RetryLoopExample { public static void main(String... args) throws Throwable { RetryPolicy retryPolicy = new RetryPolicy<>().handle(IllegalStateException.class).withBackoff(10, 40, ChronoUnit.MILLIS); - Execution execution = new Execution(retryPolicy); + Execution execution = new Execution<>(retryPolicy); while (!execution.isComplete()) { try { @@ -50,7 +50,7 @@ public static void main(String... args) throws Throwable { } } - assertEquals(execution.getLastResult(), Integer.valueOf(5)); + assertEquals(execution.getLastResult(), 5); assertEquals(execution.getAttemptCount(), 3); } } diff --git a/src/test/java/net/jodah/failsafe/examples/RxJavaExample.java b/src/test/java/net/jodah/failsafe/examples/RxJavaExample.java index afc130c5..40f584fe 100644 --- a/src/test/java/net/jodah/failsafe/examples/RxJavaExample.java +++ b/src/test/java/net/jodah/failsafe/examples/RxJavaExample.java @@ -36,13 +36,13 @@ public static void main(String... args) { else System.out.println("Subscriber completed successfully"); }).retryWhen(attempts -> { - Execution execution = new Execution(retryPolicy); + Execution execution = new Execution<>(retryPolicy); return attempts.flatMap(failure -> { System.out.println("Failure detected"); if (execution.canRetryOn(failure)) return Observable.timer(execution.getWaitTime().toNanos(), TimeUnit.NANOSECONDS); else - return Observable.error(failure); + return Observable.error(failure); }); }).toBlocking().forEach(System.out::println); }