Mohamed Taman is excited about Java 20 and, in particular, its new scoped values (JEP 429). This incubator-level feature addresses an issue with virtual threads: the fact that issues with thread-local variables have worsened. Thread-local variables require more complexity than is typically required for data sharing and come at a high cost that cannot be avoided.
To move toward lightweight sharing for thousands or millions of virtual threads, Mohamed explains, Java 20 offers scoped values. Scoped values maintain immutable and inheritable per-thread data. Because per-thread variables are immutable, they enable effective data sharing between child threads.
Unlike a thread-local variable, a scoped value is written once and is then immutable. It is available only for a fixed period during the execution of the thread. Mohamed demonstrates that like a thread-local variable, a scoped value has multiple incarnations, one per thread. The incarnation that is used depends on which thread calls its methods.
P.S. Excited about Java 20? Join the Java Platform Group in person (in Redwood Shores, California) or virtually at Java Developer Day on March 21. It’s all part of the free Oracle DevLive Level Up event running from March 20 through March 23.
The newest Java Magazine articles
Java 20 sneak peek Java 20, the next planned version of standard Java, will become generally available on March 21, 2023. It’s been in Rampdown Phase Two since January 19, 2023, and it’s now feature-complete, which means no more JEPs will target this release. Mohamed Taman takes you on a tour of Java 20’s six JEPs and the reason why they’re so important.
Curly Braces #9: Was Fred Brooks wrong about late software projects? Fred Brooks’ famous law clearly states, “Adding manpower to a late software project makes it later.” And now Eric Bruno clearly states, “It may have been inaccurate for Brooks to talk about this human-resource paradox as a generalization.” Let’s find out what he is thinking.
Embedded Java: Then and now The days of J2ME are long gone, but thanks to evolving technologies such as GraalVM Native Image, embedded Java is better than ever. Two experts in embedded Java, Christian Kuka and Bruno Caballero from MicroDoc, talk about today’s options.
Catch up on Eric Bruno’s “Curly Braces” articles
Java expert Eric Bruno regularly shares his thoughts about every aspect of enterprise software development. This month, he talks about Brooks’ Law. Here are some of his other recent musings.
Java Magazine is a deep dive into Java and the JVM. Find detailed explanations about the language and the platform written by experts and members of the Java development team.
Join a quarter of a million subscribers in getting useful, authoritative programming information delivered directly to your inbox.