Java 19 is coming out soon, and that includes a preview version of virtual threads and structured concurrency APIs. While I’m not that familiar with the Java implementation, I’d imagine it’ll have some similarities with Kotlin coroutines and other similar structured concurrency libraries.
I’ve played around with the general concept myself, particularly an interesting Python library for the same. I think some sort of structured concurrency architecture would be useful for making some async aspects of Log4j easier to understand (mostly the areas where we spawn threads for things, not for async logging). While the API isn’t stable, we can abstract it well enough with multi version jars. What I’m more curious about is how we’d interact (if at all) with virtual threads, coroutines, or structured concurrency APIs in general. If an app uses structured concurrency throughout, it might want the logging system to participate in the same flow for clean shutdowns. Does anyone have any more concrete use cases that might be relevant for us? Or does this seem more relevant for networking libraries and frameworks? — Matt Sicker