@Test(timeout = 3000L) public void test002() throws Exception { long startTime = System.currentTimeMillis(); String result = RetryUtil.executeWithRetry(new SomeService(), 4, 1000L, false); long endTime = System.currentTimeMillis(); Assert.assertEquals(result, OK); long executeTime = endTime - startTime; System.out.println("executeTime:" + executeTime); Assert.assertTrue(executeTime < 3 * 1000L); }
public static <T> T executeWithRetry(Callable<T> callable, int retryTimes, long sleepTimeInMilliSecond, boolean exponential) throws Exception { Retry retry = new Retry(); return retry.doRetry(callable, retryTimes, sleepTimeInMilliSecond, exponential, null); }
RetryUtil { public static <T> T executeWithRetry(Callable<T> callable, int retryTimes, long sleepTimeInMilliSecond, boolean exponential) throws Exception { Retry retry = new Retry(); return retry.doRetry(callable, retryTimes, sleepTimeInMilliSecond, exponential, null); } }
RetryUtil { public static <T> T executeWithRetry(Callable<T> callable, int retryTimes, long sleepTimeInMilliSecond, boolean exponential) throws Exception { Retry retry = new Retry(); return retry.doRetry(callable, retryTimes, sleepTimeInMilliSecond, exponential, null); }  }
RetryUtil { public static <T> T executeWithRetry(Callable<T> callable, int retryTimes, long sleepTimeInMilliSecond, boolean exponential) throws Exception { Retry retry = new Retry(); return retry.doRetry(callable, retryTimes, sleepTimeInMilliSecond, exponential, null); }  static T executeWithRetry(Callable<T> callable,
                                         int retryTimes,
                                         long sleepTimeInMilliSecond,
                                         boolean exponential); static T executeWithRetry(Callable<T> callable,
                                         int retryTimes,
                                         long sleepTimeInMilliSecond,
                                         boolean exponential,
                                         List<Class<?>> retryExceptionClasss); static T asyncExecuteWithRetry(Callable<T> callable,
                                              int retryTimes,
                                              long sleepTimeInMilliSecond,
                                              boolean exponential,
                                              long timeoutMs,
                                              ThreadPoolExecutor executor); static ThreadPoolExecutor createThreadPoolExecutor(); }
RetryUtil { public static <T> T executeWithRetry(Callable<T> callable, int retryTimes, long sleepTimeInMilliSecond, boolean exponential) throws Exception { Retry retry = new Retry(); return retry.doRetry(callable, retryTimes, sleepTimeInMilliSecond, exponential, null); }  static T executeWithRetry(Callable<T> callable,
                                         int retryTimes,
                                         long sleepTimeInMilliSecond,
                                         boolean exponential); static T executeWithRetry(Callable<T> callable,
                                         int retryTimes,
                                         long sleepTimeInMilliSecond,
                                         boolean exponential,
                                         List<Class<?>> retryExceptionClasss); static T asyncExecuteWithRetry(Callable<T> callable,
                                              int retryTimes,
                                              long sleepTimeInMilliSecond,
                                              boolean exponential,
                                              long timeoutMs,
                                              ThreadPoolExecutor executor); static ThreadPoolExecutor createThreadPoolExecutor();  }