The I Programmer Java 2023 Recap
Written by Nikos Vaggalis   
Thursday, 28 December 2023
Article Index
The I Programmer Java 2023 Recap
Towards JDK 21
Support for Virtual Threads

The other JEP of utmost importance had to be 444: Virtual Threads. As we examined in "Java 21 Now Feature Complete", one highlight of the new version was Jep 444 which brings full support for virtual threads. They are lightweight threads that significantly reduce the effort of writing, maintaining, and observing high-throughput concurrent applications.
The aim of adding virtual thread support was to enable server applications written in the simple thread-per-request style to scale with near-optimal hardware utilization.

Helidon

Frameworks have been starting to adopt JDK 21 for its Virtual Threads infrastructure. One of the first was Helidon. Helidon, the open source microservices framework by Oracle, got updated to version 4 just a month after the release of Java 21, becoming the world’s first virtual threads-based microservices framework:

the ground breaking feature that was added to Helidon's 4.0.0-ALPHA1 release, was the technology preview of a new side project, Helidon Nima, which was introducing virtual thread support to the framework. The reason of introducing virtual thread support stems from the fact that prior to Helidon Nima, developers would have a choice to use Helidon MP and write JAX-RS applications, or if they needed a higher level of performance and throughput they could use Helidon SE and write reactive based services. However, the reactive based services are more complex to write, maintain, and debug.

In contrast, development with Helidon Níma is much easier as it follows a simplified programming model with (almost) unlimited virtual threading resources available. The JVM takes care of the optimizations.

Now v4 makes virtual thread support official and available for production workloads, as such switching completely from the Netty server implementation which was supported in version 3x, to Nima. With this move , Helidon can now fully harness the capabilities of Java 21’s virtual threads.

Of course, Spring Boot would not take long to catch up as well. This happened with the release of Spring Boot 3.2 which came With Virtual Threads and CRaC support.

Reactivity and Virtual Threads

But does support for Virtual threads mean that it will render the reactivity of WebFlux a thing of the past? It's a topic I examined in Hibernate goes Reactive - What Does That Mean? when I was told by the author of R2DBC Revealed, Rob Hedgpeth:

the R2DBC spec provides a rough outline to communicate with a relational DB in a way that doesn’t block disk I/O. The spec itself is really just a guideline, and the actual implementation is left up to you but it can also be used in combination with CompletableFutures.

The gist being the DB wire protocol implementation can be used in a more efficient way, eliminating threads, thereby decreasing memory usage and possibly Increasing throughout. Of course, it all really depends on the use case.

So virtual threads, as far as the non blocking IO aspect of reactivity goes, surely will replace it and make a difference too as the code to write will be much simpler. Saying that, reactivity however means much more than that. It means also the caller/subscriber controlling the volume of the data returned by the publisher/database, aka backpressure, streaming results, and of course the advantage of Reactive programming versus the imperative model. Therefore Reactive frameworks still hold value.

Unlike Helidon's reliance on the Nima server, Spring Boot's adoption of Virtual Threads relies on Jetty and Tomcat. To enable it on Tomcat you must use the new VirtualThreadExecutor in order to configure Tomcat to use virtual threads which come bundled with Tomcat 10.1.10+, while the application needs utilizing JDK 21 and enabling the spring. threads. virtual. enabled property.

Of course, OpenJDK vendors quickly jumped on the jdk21 adoption bandwagon, for instance AWS with its Correto build as well as Bellsoft with Liberica. And because Liberica's build is the default runtime for Spring, it means that Spring Boot projects can take advantage of all the new bells and whistles of JDK21, as well as the massive performance gains.

Taking Stock

The epitome of Java's 2023 advancements was officially sealed by Devoxx Belgium and Morocco, the last Devoxx conferences for 2023. The events summed up all of Java's achievements thus far and provided a glimpse into what's coming next year.

Topic-wise the JDK 21 release dominated, Spring Boot's and Jakarta's versions had a great piece of the action, while Microservices and cloud native were represented by Micronaut, GraalVM and Quarkus. The rest of the topics ranged from Security to Quantum Computers, and of course AI and LLMs .

Yes, 2023 was also the year of Large language models, and the Java ecosystem would not pass on without noticing. As such, we witnessed Microsoft's take on given access from Java to LLMs with its Semantic Kernel platform under which you could now integrate the OpenAI and Azure OpenAI services with your Java code to unleash the power of AI in your apps. And of course Spring AI sprung up to allow accessing LLMs from within your Spring code.

What a year this has been. The developments during it were a testament to Java's timelessness, being out of fashion, but never out of work. That retro aspect is currently under siege too, due to the release of the long-awaited version 21 which was a game changer on all fronts. Therefore, if you are a Java developer, you will just continue going to be for years to come - programming under any environment, Cloud native or not.

At last the old heavy horse of Java is being fully rejuvenated.

corretto

 

More Information

Devoxx Belgium Sessions Now Online

Introducing Spring AI

Access LLMs From Java code With Semantic Kernel

Liberica Joins The Java CRaC Train

AWS Lambda Adopts Java 21

Jakarta EE Gets Its Own Project Initializer

What's New Java 21?

An Attempt To Make Java Easier To Learn

Helidon Microservices Framework Version 4 Reaches General Availability

Java 21 Now Feature Complete

Hibernate goes Reactive - What Does That Mean?

Spring Boot 3.2.0 Comes With Virtual Threads and CRaC

Jakarta vs Spring - The War Goes On

AWS Lambda Adopts Java 17

Azul Zulu OpenJDK 17 Build Now Comes With CRaC

Java Development Kit 20 Is GA

Sigstore Java - Sign And Verify Your Java Builds

Microsoft Goes All Out On Java

The Visual Studio Code Oracle Java Platform Extension

jbom - Dependency Analysis For Java Apps

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


GitLab Releases Duo Chat
22/04/2024

GitLab has announced that Duo Chat is now generally available in GitLab 16.11, offering a range of AI features in a single natural language chat experience.



JetBrains Releases Aqua Test Automation IDE
16/05/2024

JetBrains has announced the public release of Aqua, its IDE designed for test automation. The full release follows a preview in 2022.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info



Last Updated ( Thursday, 28 December 2023 )