Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.
This commit is contained in:
commit
ac4ea4550e
|
@ -140,13 +140,13 @@ public class Pool<T> implements AutoCloseable, Dumpable
|
|||
* method called or be removed via {@link Pool.Entry#remove()} or
|
||||
* {@link Pool#remove(Pool.Entry)}.
|
||||
*
|
||||
* @param maxReservations the max desired number of reserved entries,
|
||||
* @param allotment the desired allotment, where each entry handles an allotment of maxMultiplex,
|
||||
* or a negative number to always trigger the reservation of a new entry.
|
||||
* @return a disabled entry that is contained in the pool,
|
||||
* or null if the pool is closed or if the pool already contains
|
||||
* {@link #getMaxEntries()} entries.
|
||||
* {@link #getMaxEntries()} entries, or the allotment has already been reserved
|
||||
*/
|
||||
public Entry reserve(int maxReservations)
|
||||
public Entry reserve(int allotment)
|
||||
{
|
||||
try (AutoLock l = lock.lock())
|
||||
{
|
||||
|
@ -159,9 +159,8 @@ public class Pool<T> implements AutoCloseable, Dumpable
|
|||
|
||||
// The pending count is an AtomicInteger that is only ever incremented here with
|
||||
// the lock held. Thus the pending count can be reduced immediately after the
|
||||
// test below, but never incremented. Thus the maxReservations limit can be
|
||||
// enforced.
|
||||
if (maxReservations >= 0 && pending.get() >= maxReservations)
|
||||
// test below, but never incremented. Thus the allotment limit can be enforced.
|
||||
if (allotment >= 0 && (pending.get() * getMaxMultiplex()) >= allotment)
|
||||
return null;
|
||||
pending.incrementAndGet();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.jetty.client.api.ContentResponse;
|
|||
import org.eclipse.jetty.client.util.FormRequestContent;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.util.Fields;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
@ -70,6 +71,7 @@ public class DemoBaseTests extends AbstractDistributionTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@Tag("external")
|
||||
public void testAsyncRest() throws Exception
|
||||
{
|
||||
String jettyVersion = System.getProperty("jettyVersion");
|
||||
|
|
Loading…
Reference in New Issue