9293949596979899100101102
if (count > 5) { sem.release(); return null; } System.out.println(count); throw new RetryException(); } }; CoreUtils.retryHelper(stpe, es, c, 0, 1, TimeUnit.MILLISECONDS, 10, TimeUnit.MILLISECONDS); sem.acquire(); stpe.shutdown();
110111112113114115116117118119120
ExecutorService es = Executors.newFixedThreadPool(1); final AtomicInteger count = new AtomicInteger(); Callable<Object> c = new Callable<Object>() { public Object call() throws Exception { count.incrementAndGet(); throw new RetryException(); } }; // attempt 5 times try {