cortlepp-intershop commented on PR #322: URL: https://github.com/apache/commons-dbcp/pull/322#issuecomment-1817524088
True, but do you have a suggestion on how to write such a test? Since the Issue is not that something doesn't work, it's rather a performance thing. The current implementation, because it uses `synchronized` and then does some I/O, doesn't work "gracefully" with the new VirtualThreads introduced in JDK 21 in the sense that the JVM cannot unmount the VirtualThread during this I/O operation. This doesn't break anything in a functional sense, it just impacts the scheduling (and therefore the throughput) of the application negatively. Using a `ReentrantLock` fixes this because, unlike `synchronized`, it does not prevent the JVM from unmounting the VirtualThread during this I/O operation. In the discussion on the [linked issue](https://issues.apache.org/jira/browse/DBCP-591) Phil Steitz also suggested that locking on this method might not be necessary at all, but since he wasn't sure I implemented the "safe" version using the alternative locking mechanism. In order to test that this works, my only idea would be to start the test runner with the JVM property `-Djdk.tracePinnedThreads=full`, and the assert that no pinning stacktrace is present in the log. But this seems to me to be very brittle, hard to implement and also somewhat overkill for the situation at hand. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
