Question about using virtual thread

Attila Kelemen attila.kelemen85 at gmail.com
Thu Jun 15 15:22:35 UTC 2023


>
>
> It's possible this topic will come up many times. I wonder if anyone with
> experience in this area would have time to do an inventory of the JDBC
> drivers and the DB connection pools to see how they behave with virtual
> threads.  Oracle's JDBC driver, PostgreSQL JDBC driver, and a few others
> have JDBC drivers that work well with virtual threads but I have seen much
> on DB connection libraries. Do they provide API that wait for a connection
> to be available without pinning a virtual thread?
>
>
To be honest, I haven't actually tested with virtual threads, but dbcp2
relies on Apache Commons Pool2 which uses `GenericObjectPool` [1] for
pooling which uses `LinkedBlockingDeque` itself (no synchronized blocks or
native shenanigans), so I would expect it work well with Loom. Anyway, I
can write some tests on how well behaved these pools (with various
configurations) with Loom on the weekend.

[1]:
https://github.com/apache/commons-pool/blob/rel/commons-pool-2.11.1/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230615/eb8b12c8/attachment.htm>


More information about the loom-dev mailing list