Oracle has released the not-so-long awaited Java SE 13 (JDK 13) Monday at the Oracle Code One conference in San Francisco with three new features meant to increase the language’s agility and performance in modern computing environments, as well as two new preview features that provide increased code readability and “simplify everyday coding.” The release comes just six months after JDK 12 and six months before JDK 14 (which already has access builds available), as part of Oracle’s six-month Feature Release cadence, which it started in 2017.
In the past, Java was released on a 3+ year release schedule, often bundling dozens of features and bug fixes at once, if not more. In an interview with The New Stack, Georges Saab, vice president of software development at Oracle, explains that the company’s new, more agile methods bring new features more often and allow for more frequent bug fixes.
“What we saw with the every other year aspirational cadence was that we often were put in a position of needing to decide to either release something that was not quite ready and have the entire industry have to live with it for 20 years into the future or hold it back, make sure that it was really ready to go, and maybe take another six months, a year, or sometimes more to deliver it,” said Saab. “This shift to a six month cadence is really intended to try to turn that problem on its head in a way that is now much better understood than 25 years ago.”
The two new preview features included in JDK 13 had been available in early builds and offer some straightforward new functionality. First, text blocks allow code to span more than a single line, increasing readability and avoiding escape sequencing. Next, switch expressions makes it so switch can be used as either a statement or an expression, paving the way for pattern matching.
The three other features included in JDK 13 include dynamic class data sharing (CDS) archives, uncommit unused memory, and a reimplementation of the legacy Socket API. Saab explains that the dynamic CDS archive feature helps provide smaller, more optimized builds for microservices.
“Java typically will start up and load all of your application, all of the classes, and over time identify hotspots and optimize that code. Class data sharing will look at everything that’s being done there and store all of that in a shared image so that the next time you start it can just map that in quickly and start up very fast with fully optimized code,” said Saab. “That’s exactly the kind of thing that you want with microservices. The overhead of a classical Java runtime stack approach, which works well for something that is gonna use lots of memory and run for days or weeks or months, you don’t want to pay that overhead. You want to be able to just come up quickly, run, do something at full speed, and then disappear afterwards.”
Similarly, uncommitting unused memory is helpful for running containerized applications in shared cloud environments, while the reimplementation of the legacy Socket API is part of Project Loom, which Saab explains as an effort to improve scalability.
“The scalability of the Java runtime has been essentially bounded by the scalability of the native threading model. Loom introduces ‘fibers’ to JDK. You can think of a fiber as an extremely lightweight thread where the thread is controlled in Java and can be mapped at the order of thousands of fibers to a native operating system thread,” said Saab. “People have been trying to scale up workloads in Java by moving from a synchronous model to an asynchronous model. Asynchronous programming is complicated, hard to understand, hard to debug, hard to profile, but it gives scalability. The problem is, it often gives you that at the cost of an extreme amount of complexity. By having the runtime itself handle this mapping and handle the scaling of fibers to threads, it allows you to continue with the synchronous model of programming that’s simple and easy to understand.”
According to a blog post on the release, Oracle was responsible for around 70% of the 2,126 JIRA issues marked as fixed in JDK 13, with the rest handled by companies including Google, Red Hat, SAP, Ampere Computing, ARM, Huawei, Linaro and Loongson. Saab points to these contributions as evidence of Java’s continued relevance and importance.
“We’ve gotten a lot more people contributing and taking part in collaborating in JDK. We’re quite happy about that,” said Saab. “A lot of the folks who we’re collaborating with here on Java are people who normally one would consider some of Oracle’s largest competitors. I think this is a testament to how important everyone considers Java all across the industry.”
Oracle and Red Hat are sponsors of The New Stack.
Feature image: “An Early Lesson of Marching, December 24, 1794,” by British illustrator Thomas Rowlandson, New York Metropolitan Museum of Art.