@Test(expected = InvokerException.class) public void invocationShouldNotWork() throws InvokerException { Callable<String> task = new WorksInTheSecond(); int trials = 1; int timeout = 1; Invoker<String> invoker = new Invoker<String>("WorksInTheSecond", task, trials, timeout, pauseBetweenTrials, TimeUnit.SECONDS); invoker.invoke(); }
public T invoke() throws InvokerException { Throwable cause = null; for (int tried = 0; tried < trials; tried++) { try { T result = tryToInvoke(); return result; } catch (Exception e) { cause = e; pause(); } } throw new InvokerException(cause); }
Invoker { public T invoke() throws InvokerException { Throwable cause = null; for (int tried = 0; tried < trials; tried++) { try { T result = tryToInvoke(); return result; } catch (Exception e) { cause = e; pause(); } } throw new InvokerException(cause); } }
Invoker { public T invoke() throws InvokerException { Throwable cause = null; for (int tried = 0; tried < trials; tried++) { try { T result = tryToInvoke(); return result; } catch (Exception e) { cause = e; pause(); } } throw new InvokerException(cause); } Invoker(String taskName, Callable<T> task, int trials, int trialTimeout, int pauseBetweenTrials, TimeUnit timeUnit); }
Invoker { public T invoke() throws InvokerException { Throwable cause = null; for (int tried = 0; tried < trials; tried++) { try { T result = tryToInvoke(); return result; } catch (Exception e) { cause = e; pause(); } } throw new InvokerException(cause); } Invoker(String taskName, Callable<T> task, int trials, int trialTimeout, int pauseBetweenTrials, TimeUnit timeUnit); T invoke(); }
Invoker { public T invoke() throws InvokerException { Throwable cause = null; for (int tried = 0; tried < trials; tried++) { try { T result = tryToInvoke(); return result; } catch (Exception e) { cause = e; pause(); } } throw new InvokerException(cause); } Invoker(String taskName, Callable<T> task, int trials, int trialTimeout, int pauseBetweenTrials, TimeUnit timeUnit); T invoke(); static boolean SAVE_HISTORY; }