[JAVA-4930] Create virtual threads when available Created: 11/Apr/23  Updated: 27/Sep/23

Status: Backlog
Project: Java Driver
Component/s: Internal, Performance
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Quarter: FY24Q4
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Virtual threads will be added to the JDK in Java 21. The driver can take advantage of them, even though its minimum Java version is still 8, with a little indirection that detects whether virtual threads are supported (using reflection, most likely), and creating virtual threads instead of platform threads when they are available.

Virtual threads seem ideal for all threads currently created by the driver itself, including those in:

  • DefaultServerMonitor
  • DefaultConnectionPool
  • DefaultDnsSrvRecordMonitor


 Comments   
Comment by Jeffrey Yemin [ 12/Apr/23 ]

Some ideas here: https://github.com/jyemin/mongo-java-driver/tree/j4930

Generated at Thu Feb 08 09:03:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.