@Test public void releaseWithContextIncrementsMetricsAndCausesBackPressureReleasesToBeCalled() { guardRail = builder.build(); TestResult result = TestResult.SUCCESS; Eventual<TestResult, String> context = new Eventual<>(2L, 10L); guardRail.releasePermits(context, result, 100L); verify(resultCounts).write(result, 2L, 100L); verify(resultLatency).write(result, 2L, 90L, 100L); InOrder inOrder = inOrder(backPressure, backPressure2); inOrder.verify(backPressure).releasePermit(2L, result, 100L); inOrder.verify(backPressure2).releasePermit(2L, result, 100L); }
public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); }
GuardRail { public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); } }
GuardRail { public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); } private  GuardRail(GuardRailProperties<Result, Rejected> properties); }
GuardRail { public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); } private  GuardRail(GuardRailProperties<Result, Rejected> properties); Rejected acquirePermits(long number); Rejected acquirePermits(long number, long nanoTime); void releasePermitsWithoutResult(long number); void releasePermitsWithoutResult(long number, long nanoTime); void releasePermits(ExecutionContext context, Result result); void releasePermits(ExecutionContext context, Result result, long nanoTime); void releasePermits(long number, Result result, long startNanos); void releasePermits(long number, Result result, long startNanos, long nanoTime); PrecipiceFunction<Result, ExecutionContext> releaseFunction(); String getName(); WritableCounts<Result> getResultCounts(); WritableCounts<Rejected> getRejectedCounts(); WritableLatency<Result> getResultLatency(); Map<String, BackPressure<Rejected>> getBackPressure(); Clock getClock(); static GuardRail<Result, Rejected> create(GuardRailProperties<Result, Rejected> properties); }
GuardRail { public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); } private  GuardRail(GuardRailProperties<Result, Rejected> properties); Rejected acquirePermits(long number); Rejected acquirePermits(long number, long nanoTime); void releasePermitsWithoutResult(long number); void releasePermitsWithoutResult(long number, long nanoTime); void releasePermits(ExecutionContext context, Result result); void releasePermits(ExecutionContext context, Result result, long nanoTime); void releasePermits(long number, Result result, long startNanos); void releasePermits(long number, Result result, long startNanos, long nanoTime); PrecipiceFunction<Result, ExecutionContext> releaseFunction(); String getName(); WritableCounts<Result> getResultCounts(); WritableCounts<Rejected> getRejectedCounts(); WritableLatency<Result> getResultLatency(); Map<String, BackPressure<Rejected>> getBackPressure(); Clock getClock(); static GuardRail<Result, Rejected> create(GuardRailProperties<Result, Rejected> properties);  }