@Test public void reserveFailsWhenPendingRequest() { ReservableRequestConcurrencyController controller = newController(from(10), never()); assertThat(controller.tryRequest(), is(Accepted)); assertFalse(controller.tryReserve()); }
@Override public Result tryRequest() { if (lastSeenMaxValue(1) > 0) { if (casPendingRequests(0, 1)) { return Accepted; } return RejectedTemporary; } return RejectedPermanently; }
ReservableRequestConcurrencyControllerOnlySingle extends AbstractReservableRequestConcurrencyController { @Override public Result tryRequest() { if (lastSeenMaxValue(1) > 0) { if (casPendingRequests(0, 1)) { return Accepted; } return RejectedTemporary; } return RejectedPermanently; } }
ReservableRequestConcurrencyControllerOnlySingle extends AbstractReservableRequestConcurrencyController { @Override public Result tryRequest() { if (lastSeenMaxValue(1) > 0) { if (casPendingRequests(0, 1)) { return Accepted; } return RejectedTemporary; } return RejectedPermanently; } ReservableRequestConcurrencyControllerOnlySingle(final Publisher<? extends ConsumableEvent<Integer>> maxConcurrency,
                                                     final Completable onClosing); }
ReservableRequestConcurrencyControllerOnlySingle extends AbstractReservableRequestConcurrencyController { @Override public Result tryRequest() { if (lastSeenMaxValue(1) > 0) { if (casPendingRequests(0, 1)) { return Accepted; } return RejectedTemporary; } return RejectedPermanently; } ReservableRequestConcurrencyControllerOnlySingle(final Publisher<? extends ConsumableEvent<Integer>> maxConcurrency,
                                                     final Completable onClosing); @Override Result tryRequest(); }
ReservableRequestConcurrencyControllerOnlySingle extends AbstractReservableRequestConcurrencyController { @Override public Result tryRequest() { if (lastSeenMaxValue(1) > 0) { if (casPendingRequests(0, 1)) { return Accepted; } return RejectedTemporary; } return RejectedPermanently; } ReservableRequestConcurrencyControllerOnlySingle(final Publisher<? extends ConsumableEvent<Integer>> maxConcurrency,
                                                     final Completable onClosing); @Override Result tryRequest();  }