@Test public void exceptionThrownIfControllerRejects() throws Exception { try { when(guardRail.acquirePermits(eq(1L), anyLong())).thenThrow(new RejectedException(Rejected.MAX_CONCURRENCY_LEVEL_EXCEEDED)); service.call(TestCallables.success(1)); fail(); } catch (RejectedException e) { assertEquals(Rejected.MAX_CONCURRENCY_LEVEL_EXCEEDED, e.reason); } try { when(guardRail.acquirePermits(eq(1L), anyLong())).thenThrow(new RejectedException(Rejected.CIRCUIT_OPEN)); service.call(TestCallables.success(1)); fail(); } catch (RejectedException e) { assertEquals(Rejected.CIRCUIT_OPEN, e.reason); } }
public <T> T call(Callable<T> callable) throws Exception { return call(callable, 1L); }
CallService implements Precipice<TimeoutableResult, Rejected> { public <T> T call(Callable<T> callable) throws Exception { return call(callable, 1L); } }
CallService implements Precipice<TimeoutableResult, Rejected> { public <T> T call(Callable<T> callable) throws Exception { return call(callable, 1L); } CallService(GuardRail<TimeoutableResult, Rejected> guardRail); }
CallService implements Precipice<TimeoutableResult, Rejected> { public <T> T call(Callable<T> callable) throws Exception { return call(callable, 1L); } CallService(GuardRail<TimeoutableResult, Rejected> guardRail); @Override GuardRail<TimeoutableResult, Rejected> guardRail(); T call(Callable<T> callable); T call(Callable<T> callable, long permitNumber); }
CallService implements Precipice<TimeoutableResult, Rejected> { public <T> T call(Callable<T> callable) throws Exception { return call(callable, 1L); } CallService(GuardRail<TimeoutableResult, Rejected> guardRail); @Override GuardRail<TimeoutableResult, Rejected> guardRail(); T call(Callable<T> callable); T call(Callable<T> callable, long permitNumber);  }