@Test(expected = IllegalArgumentException.class) public void testNegative() { Semaphore64 semaphore = new BlockingSemaphore(1); semaphore.acquire(-1); }
outstandingElementCount = null; } else if (settings.getLimitExceededBehavior() == FlowController.LimitExceededBehavior.Block) { outstandingElementCount = new BlockingSemaphore(maxOutstandingElementCount); } else { outstandingElementCount = new NonBlockingSemaphore(maxOutstandingElementCount); outstandingByteCount = null; } else if (settings.getLimitExceededBehavior() == FlowController.LimitExceededBehavior.Block) { outstandingByteCount = new BlockingSemaphore(maxOutstandingRequestBytes); } else { outstandingByteCount = new NonBlockingSemaphore(maxOutstandingRequestBytes);
outstandingElementCount = null; } else if (settings.getLimitExceededBehavior() == FlowController.LimitExceededBehavior.Block) { outstandingElementCount = new BlockingSemaphore(maxOutstandingElementCount); } else { outstandingElementCount = new NonBlockingSemaphore(maxOutstandingElementCount); outstandingByteCount = null; } else if (settings.getLimitExceededBehavior() == FlowController.LimitExceededBehavior.Block) { outstandingByteCount = new BlockingSemaphore(maxOutstandingRequestBytes); } else { outstandingByteCount = new NonBlockingSemaphore(maxOutstandingRequestBytes);
@Test public void testBlocking() throws InterruptedException { final Semaphore64 semaphore = new BlockingSemaphore(1); semaphore.acquire(1);