use of io.vertx.pgclient.impl.PgSocketConnection in project vertx-sql-client by eclipse-vertx.
the class PgPoolTest method testEventLoopSize.
@Test
public void testEventLoopSize(TestContext ctx) {
int num = VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE;
int size = num * 2;
PgPool pool = PgPool.pool(options, new PoolOptions().setMaxSize(size).setEventLoopSize(2));
Set<EventLoop> eventLoops = Collections.synchronizedSet(new HashSet<>());
Async async = ctx.async(size);
for (int i = 0; i < size; i++) {
pool.getConnection(ctx.asyncAssertSuccess(conn -> {
PgSocketConnection c = (PgSocketConnection) ((SqlConnectionInternal) conn).unwrap().unwrap();
EventLoop eventLoop = ((ContextInternal) c.context()).nettyEventLoop();
eventLoops.add(eventLoop);
async.countDown();
}));
}
try {
async.await();
} finally {
pool.close();
}
ctx.assertEquals(2, eventLoops.size());
}
Aggregations