Search in sources :

Example 1 with ConnectionPoolTooBusyException

use of io.vertx.core.http.ConnectionPoolTooBusyException in project vert.x by eclipse.

the class ConnectionPoolTest method testMaxWaiters.

@Test
public void testMaxWaiters() {
    ConnectionManager mgr = new ConnectionManager();
    ConnectionPool<Connection> pool = ConnectionPool.pool(mgr, new int[] { 1 }, 5);
    EventLoopContext ctx = vertx.createEventLoopContext();
    for (int i = 0; i < (5); i++) {
        pool.acquire(ctx, 0, ar -> fail());
    }
    pool.acquire(ctx, 0, onFailure(err -> {
        assertTrue(err instanceof ConnectionPoolTooBusyException);
        testComplete();
    }));
    await();
}
Also used : Arrays(java.util.Arrays) VertxInternal(io.vertx.core.impl.VertxInternal) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) ConnectionPoolTooBusyException(io.vertx.core.http.ConnectionPoolTooBusyException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) CompletableFuture(java.util.concurrent.CompletableFuture) Future(io.vertx.core.Future) VertxTestBase(io.vertx.test.core.VertxTestBase) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) TimeUnit(java.util.concurrent.TimeUnit) EventLoopContext(io.vertx.core.impl.EventLoopContext) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Ignore(org.junit.Ignore) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) WorkerContext(io.vertx.core.impl.WorkerContext) AsyncResult(io.vertx.core.AsyncResult) Queue(java.util.Queue) Handler(io.vertx.core.Handler) ConnectionPoolTooBusyException(io.vertx.core.http.ConnectionPoolTooBusyException) EventLoopContext(io.vertx.core.impl.EventLoopContext) Test(org.junit.Test)

Aggregations

AsyncResult (io.vertx.core.AsyncResult)1 Future (io.vertx.core.Future)1 Handler (io.vertx.core.Handler)1 Promise (io.vertx.core.Promise)1 Vertx (io.vertx.core.Vertx)1 ConnectionPoolTooBusyException (io.vertx.core.http.ConnectionPoolTooBusyException)1 EventLoopContext (io.vertx.core.impl.EventLoopContext)1 VertxInternal (io.vertx.core.impl.VertxInternal)1 WorkerContext (io.vertx.core.impl.WorkerContext)1 VertxTestBase (io.vertx.test.core.VertxTestBase)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Queue (java.util.Queue)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1