} else if (!outstandingMessageCount.tryAcquire(messages)) {
throw new MaxOutstandingMessagesReachedException(maxOutstandingMessages.get());
}
}
if (outstandingByteCount != null) {
<BUG>int permitsToDraw = maxOutstandingBytes.get() > bytes ? bytes : maxOutstandingBytes.get();
if (!failOnLimits) {</BUG>
outstandingByteCount.acquireUninterruptibly(permitsToDraw);
} else if (!outstandingByteCount.tryAcquire(permitsToDraw)) {
throw new MaxOutstandingBytesReachedException(maxOutstandingBytes.get());

} else if (!outstandingMessageCount.tryAcquire(messages)) {
throw new MaxOutstandingMessagesReachedException(maxOutstandingMessages.get());
}
}
if (outstandingByteCount != null) {
int permitsToDraw = Math.min(bytes, maxOutstandingBytes.get());
if (!failOnLimits) {
outstandingByteCount.acquireUninterruptibly(permitsToDraw);
} else if (!outstandingByteCount.tryAcquire(permitsToDraw)) {
throw new MaxOutstandingBytesReachedException(maxOutstandingBytes.get());
