Java 20 – What’s included, and is it worth adopting?

Java 20 was announced as production-ready (GA) this week. 

Coming after Java 19 in Sept last year, Java 20 is the next release of Java produced in accordance with the six-monthly time-based release schedule that Oracle have been reliably producing since Sept 2017.

Java 20 contains a total of 7 JDK Enhancement Proposals (JEPs) (enhancements to the language, Java APIs or platform). None of these JEPs are final – i.e. there are no stable new features in the release you can rely upon. 4 of the 7 JEPs are in secondary phases of preview – they’re complete and production ready, but the API has not yet been finalised, subject to receiving further feedback. The remaining 3 JEPs are in an earlier incubation state – they may not yet be fully complete. One of which is brand new.

All of the JEPs are associated with features being developed under the following three ongoing long-term, umbrella OpenJDK development projects

  • Project Amber
  • Project Loom
  • Project Panama

Project Amber Related JEPs

Project Amber aims to provide (relatively) small Java language features to boost developer productivity. The Amber associated JEPs in Java 20 include –

Project Loom Related JEPs

Project Loom aims to provide features to make it easier to write, maintain and debug non-blocking multi-threaded Java apps to maximise throughput and scalability. The Loom associated JEPs in Java 20 include –

  • 429: Scoped Values (Incubator) – A newly proposed feature being produced by the Loom team, which aims to address the drawbacks of thread-local variables, particularly those which are more acute when using a much larger number of virtual threads. 
  • 436: Virtual Threads (Second Preview) – This main feature produced by the OpenJDK Loom project has moved a step further towards being made final. For an overview of Virtual Threads, their goal, and how it might impact how you write Java applications in the future see my blog post Preparing for Virtual Threads.
  • 437: Structured Concurrency (Second Incubator) – A further feature being produced by the Loom team, which aims to simplify multithreaded programming by providing a new API which supports treating multiple (asynchronously executed) tasks running in different threads as a single unit of work, with the goals of streamlining error handling and cancellation, improving reliability, and enhancing observability.

Project Panama Related JEPs

Project Panama aims to improve the support the JDK provides for writing Java apps that need to interoperate with “foreign” (i.e., non-Java) code/APIs – commonly invoking functions in C libraries. The Panama associated JEPs in Java 20 include –

Closing Thoughts

Given there are no finalised features in Java 20, and the next release (Java 21) is planned to be an LTS release, it’s reasonable to question why you would commit to upgrading your production apps to this new release, rather than waiting for 6 months. However, like other major releases, Java 20 does include some other minor enhancements (which I’ve still yet to explore), bug fixes and performance improvements, which might be reason enough.

Alternatively, you and your team may just want to take Java 20 for a test drive to try out (and possibly provide feedback on) one of the above JEPs. Or perhaps more importantly as a means of preparing and expediting your adoption of Java 21.

Neil.

Preparing for Java Virtual Threads

It was recently announced that virtual threads, a new JDK feature developed by the OpenJDK project Loom, will be available as a preview feature in the forthcoming Java 19 release.

One of the design goals of this new feature is to enable existing multi-threaded Java apps to adopt virtual threads with little or no change. This has to all intents and purposes been achieved in a couple of  ways. Firstly, virtual threads are able to run any existing Java code or native code – there are no restrictions in that respect. Secondly, there are no breaking changes to the existing Thread API, or associated language constructs such as synchronized blocks, should your code use these lower level thread management APIs. However, attaining the full benefits of virtual threads requires Java developers to make a few changes to the way they have solved certain problems in the past. This is euphemistically described by the Loom team as needing to ‘unlearn’ certain coding practices and ways of doing things. This article outlines these cases, highlighting how you can prepare your existing applications to maximise the benefits of virtual threads when they are finalised in a future release of Java; and more generally considers how the introduction of virtual threads may change the way we develop multithreaded Java apps in the future.

Continue reading

Java 17 is here and set for mass adoption

Java 17 was recently publicly released by Oracle on schedule (Sept 2021). This is a significant and highly anticipated new release for Java engineering teams around the world, for several reasons. I predict it will see mass adoption and become the dominant version of Java used by enterprises over the next couple of years. Read on to find out more, including learning about the major new language features in Java 17 that engineering teams can benefit from, including code examples.

Continue reading

Java 15 is Generally Available (GA) – What’s New?

Java 15 became GA earlier this month (Sept 2020) (as announced by Oracle). As per Oracle’s now regular time-based schedule for major new releases of Java, this release was expected and comes 6 months after the previous one (Java 14 in March 2020). In this post I outline what I personally consider to be the most significant new features in Java 15 from a developer’s perspective, focusing primarily on the new Java language. I’ve also included some of the changes to the JDK core libraries / APIs and the JVM which will be of interest to developers.

Continue reading

Evaluating Solutions for Serverless Spring Microservices – Part 1

Deploying and running services on Function-as-a-Service (FaaS) compute platforms like AWS Lambda has some compelling benefits for appropriate use-cases (short running workloads), including true (low-latency) elastic scalability, at finer granularity, with significant cost-savings based on scaling to zero.

At  the same time,  the Spring application framework (and more recently Spring Boot) has long  encouraged and helped accelerate building modern, flexible enterprise apps that run on the  JVM, that are easy to test, by abstracting away generic code (‘plumbing’) for integrating an app with its libraries and APIs; using familiar design/programming patterns (IoC/DI, proxies, Template methods etc); and providing valuable features (declarative transaction management, environment specific config, etc).

In an ideal world we’d use all these technologies – building Java/JVM functions with the help of Spring that are deployed and run on AWS Lambda – to realise their combined benefits.

But can these technologies be made to work together effectively? Or do we need to accept that when it  comes to designing and building services to  run on FaaS platforms like AWS Lambda, tech stacks (programming languages and application framework) offer than Java and Spring may offer a better solution?

Continue reading

Java 12 – New Features and Adoption Considerations

Java 12,  or more accurately the Java Development Kit (JDK) 12) was officially released by Oracle on the 19th March 2019. This blog post highlights the subset of new features in this next major release of Java that will be of most interest to enterprise Java developers, in terms of the Java language, the core library APIs and other JDK features. It also outlines the support & maintenance available for this new release, and how this might influence your decision on whether to adopt it in production.

Continue reading

Java 11 – New Features, Code Examples & Support

Java 11Java 11 was officially released by Oracle on 25th Sept 2018. This blog post highlights the subset of features in this next major release of Java that will be of most interest to enterprise Java developers. These include  a small number of new language features, for which I have also provided some code examples showcasing how they can be used. This post also outlines the significance of this new Java release from a support & maintenance perspective; upgrade considerations; and includes a reminder about the recent change in the licensing terms for the Oracle JDK.

Continue reading

Oracle’s Recent Changes to Java (JDK) – Overview, Impact & Advice

Oracle have recently made several changes concerning how they maintain, support  & license  use of Java (more accurately the JDK).  This has commercial & technical implications for all enterprises running apps on the JVM (users of the JDK)  in production – regardless of the app programming language (Java, Groovy, Kotlin, etc).

Don’t panic! Java is still free. But anyone responsible for developing or provisioning JVM apps for production usage needs to be aware  of these changes and consider how it impacts their teams and business.

Continue reading

Java 10 – New Features, Code Examples & Support

Java 10 logo

Java (or more accurately JDK) 10 was officially released on 20th March 2018. It includes a total of 12 new features, a full list of which can be found on the OpenJDK project page for JDK 10 , including links to their relevant JDK Enhancement Proposal (JEP) describing each in more detail. This blog post highlights the subset of features that will be of most interest to enterprise Java developers. These include a small number of new Java language features, for which I have also provided some code examples showing how they can be used.

Continue reading

Soak testing new services on the JVM – the why and the how

As a software engineer responsible for building new backend (micro) services, it’s not sufficient to only test that they meet functional requirements. There are additional technical tests, focusing on the quality of the software, that must also be completed to ensure that your new service/application is production-ready. Whilst such tests require additional effort and can push out the date for getting your new service into production, they’re essential if you want to be confident of how your service will operate in production, and avoid any surprises that could negatively impact your business. The main types of tests I’m referring to are load testing (itself a type of performance testing) and soak testing. I’ve covered the subject of load testing (specifically measuring throughput under load) in a previous blog post. In this blog post I cover soak testing, including the aims of this type of test; how to soak test any service (regardless of the language it’s written in) that runs on the Java Virtual Machine (JVM), including those that run in a (e.g. Docker) container.

Continue reading