@Test public void canInvokeVoidReturningMethodsSafely() { LongConsumer longConsumer = mock(LongConsumer.class); RetryableException retryableException = createRetryableException(QosException.retryOther(createUrl())); doThrow(retryableException).doNothing().when(longConsumer).accept(42L); LongConsumer proxyConsumer = FastFailoverProxy.newProxyInstance(LongConsumer.class, () -> longConsumer, clock); assertThatCode(() -> proxyConsumer.accept(42L)).doesNotThrowAnyException(); verify(longConsumer, times(2)).accept(42L); }
public static <U> U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate) { return newProxyInstance(interfaceClass, delegate, Clock.systemUTC()); }
FastFailoverProxy extends AbstractInvocationHandler { public static <U> U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate) { return newProxyInstance(interfaceClass, delegate, Clock.systemUTC()); } }
FastFailoverProxy extends AbstractInvocationHandler { public static <U> U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate) { return newProxyInstance(interfaceClass, delegate, Clock.systemUTC()); } private  FastFailoverProxy(Supplier<T> delegate, Clock clock); }
FastFailoverProxy extends AbstractInvocationHandler { public static <U> U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate) { return newProxyInstance(interfaceClass, delegate, Clock.systemUTC()); } private  FastFailoverProxy(Supplier<T> delegate, Clock clock); static U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate); }
FastFailoverProxy extends AbstractInvocationHandler { public static <U> U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate) { return newProxyInstance(interfaceClass, delegate, Clock.systemUTC()); } private  FastFailoverProxy(Supplier<T> delegate, Clock clock); static U newProxyInstance(Class<U> interfaceClass, Supplier<U> delegate);  }