How to Build Java Applications Today: June 7, 2021
Tags: java, bpf
Published: 2021-06-07 22:34:08

## TL;DR
What’s new in Java 17, why do we need Project Loom, Alibaba forks PostgreSQL, Prosus buys Stack Overflow, Hibernate 5.5.0, Spring Cloud 2020.0.3, Spring Integration AWS 2.5.1, Helidon 2.3.0, and Eclipse Vert.x 4.1.0.

***

## README
This is **issue 39** of my weekly newsletter, “How To Build Java Applications Today”. I read all the Java newsletters, so **you** don’t have to. And it’s “Java news with a smile”!

If you like my newsletter, then [subscribe to it on Substack](https://bpfnl.substack.com), read it on [dev.to](https://dev.to/ksilz/series/11995) or the [Java Cafe](https://thejavacafe.com/ksilz/series/1)! Even better: Share it with people who may be interested.

***

## Quote of the Week
*‌If you need a machine and don't buy it, then you will ultimately find that you have paid for it and don't have it.*
Replace “machine” with “script” and “buy” with “write” in this quote by [Henry Ford](https://www.goodreads.com/quotes/9195952-if-you-need-a-machine-and-don-t-buy-it-then), US automobile tycoon [(1863-1947)](https://en.wikipedia.org/wiki/Henry_Ford), to describe a typical developer’s dilemma.

***

## Stand-Up
This was torture: While I was writing this, [Apple’s WWDC keynote](https://www.theverge.com/2021/6/7/22461782/apple-wwdc-2021-recap-biggest-announcements-ios-15-macos-monterey-ipados) happened. And I’m an avid Apple user: Mac, iPhone, iPad, Watch, Apple TV, even two big HomePods - the whole shebang. To add insult to injury, my Mac’s leasing ends this August, so I did hope for a new MacBook Pro 16”. Alas, no such luck. 😒 First world problems!

In other news, I booked another conference appearance. This time, I’m not talking about front-ends but about [picking technologies faster with JHipster](https://betterprojectsfaster.com/learn/talks-it-tage-2021-jhipster-faster-tools-and-technologies/). It’s on June 16 - but in German. If this is your cup of tea (or glass of beer), you can [buy a ticket here](https://www.ittage.informatik-aktuell.de/tickets.html).

***

## Bookmarks
### Java
#### What’s New in Java 17?
Due on September 14, Java 17 will be the next Long-Term Support (LTS) release. We’re just a few days away from the planned feature freeze on June 10. So what made the cut for Java 17?
  
It’s just bits ’n pieces unless you’ve got a [Mac with Apple’s M1 chip](https://www.theverge.com/21569603/apple-macbook-air-m1-review-price-specs-features-arm-silicon) - Java 17 will run natively there. [Project Loom](https://wiki.openjdk.java.net/display/loom/Main) will be completely missing, and [Project Valhalla](https://wiki.openjdk.java.net/display/valhalla/Main) won’t be complete in Java 17, either.

But what **do** we get?

The (few?) among us who still use Java serialization get [filters to make it more secure](https://openjdk.java.net/jeps/415). The (even fewer) authors of “numerically sensitive libraries” can breathe easier with the [restoration of always-strict floating point semantics](https://openjdk.java.net/jeps/306). Random number generators [get better](https://openjdk.java.net/jeps/356), and [sealed classes](https://openjdk.java.net/jeps/409) leave the incubator status behind (they were [introduced in Java 15](https://betterprojectsfaster.com/blog/weekly-links-2020-10-22/#jdk-15-sealed-classeshttpsfoojayioblogjdk-15-sealed-classes)). And the small [Venn diagram](https://en.wikipedia.org/wiki/Venn_diagram) of “Java desktop program users” and “macOS users” gets a [new rendering pipeline](https://openjdk.java.net/jeps/382) that uses Apple’s Metal framework.

Some incubating features see updates but aren’t final yet. That includes the [pattern matching for `switch`](https://openjdk.java.net/jeps/406), the [foreign function and memory API](https://openjdk.java.net/jeps/412) for interaction with the world outside Java, and the [vector API](https://openjdk.java.net/jeps/414) that supports very fast “compute engines” in modern CPUs.

Oracle removes a lot in this release, too: The Security Manager, for instance, there since Java 1.0, [will be deprecated](https://openjdk.java.net/jeps/411). We [can’t get to some JDK internal classes](https://openjdk.java.net/jeps/403) through the `-illegal-access` JVM parameter anymore. Few among us will probably miss the “[experimental AOT and JIT compiler](https://openjdk.java.net/jeps/410)” or the [Applet API](https://openjdk.java.net/jeps/398) (see section “The End of Applets” in [issue 28](https://bpfnl.substack.com/p/how-to-build-java-applications-today-762)).

[InfoWorld article](https://www.infoworld.com/article/3606833/jdk-17-the-new-features-in-java-17.html)

***

#### Why Do We Need Project Loom?
Oracle’s Project Loom [reinvents threads in Java](https://wiki.openjdk.java.net/display/loom/Main). The last time that project lead Ron Pressler took to the mic, he claimed that most people who use the [reactive programming model](https://en.wikipedia.org/wiki/Reactive_programming) don’t actually like it. And nope, he provided no evidence for this “fact”. Then a Jetty author found that at least performance-wise, thread pools hold up just fine against Loom under realistic circumstances. See [here for the whole saga](https://betterprojectsfaster.com/blog/weekly-links-2021-01-04#do-looms-claims-stack-uphttpswebtidecomdo-looms-claims-stack-up-part-1).

Now Ron’s at the mic again. What news does he share with us?

He stays away from claiming to know the likes and dislikes of millions of developers this time around. Smart choice! So now he’s saying that Project Loom exists because debugging a reactive program is so much harder: “If you have an exception, the troubleshooting context you get is the thread stack. And once you use those reactive frameworks, the thread stack you get doesn't really have any valuable information, any useful information, in it because the same task really moves from one thread to another.”

So, how’s the debugging experience with Loom? 

Project Loom worked with “IDE vendors […] to make sure that we have the right user experience. […] So with Loom, you will at least be able to step through code”. In other words: Debugging with Loom **didn’t** work out of the box. 

Let me get this straight: Project Loom exists because debugging reactive programs is too hard. And then debugging with Loom didn’t work either! 

Hm… Is it just me, or could Oracle have skipped the whole “reinventing Java threads” part and instead worked with IDE vendors to make **reactive** debugging easier? After all, at least Spring Reactive [made debugging nicer already](https://www.baeldung.com/spring-debugging-reactive-streams). 

[InfoQ podcast](https://www.infoq.com/podcasts/java-project-loom/) (Audio & transcript)

***

### Frameworks & Libraries
#### Alibaba Forks PostgreSQL
PostgreSQL is the [self-proclaimed](https://www.postgresql.org) “most advanced open-source relational database”. Well, not advanced enough for [Alibaba](https://en.wikipedia.org/wiki/Alibaba_Group), the Chinese company that is the world’s biggest e-commerce platform [by some measure](https://unctad.org/news/global-e-commerce-jumps-267-trillion-covid-19-boosts-online-sales). Just think of a “combination of Amazon, eBay and PayPal”. They forked PostgreSQL and call it “PolarDB for PostgreSQL”. PolarDB is [available on GitHub](https://github.com/alibaba/PolarDB-for-PostgreSQL) under the Apache 2.0 license.

Why did they do that? PostgreSQL can already be enhanced quite nicely with [extensions](https://www.postgresql.org/docs/current/external-extensions.html).

First of all, PolarDB for PostgreSQL is a “share-nothing distributed database, which supports global data consistency and ACID across database nodes, distributed SQL processing, and data redundancy and high availability through Paxos based replication.” 

Next, Alibaba **did** use a PostgreSQL extension. In fact, that’s where the majority of their changes reside. The PostgreSQL patch only adds features that aren’t possible in an extension, such as “distributed MVCC for different isolation levels”. MVCC is “Multiversion Concurrency Control” and what PostgreSQL [already uses](https://www.postgresql.org/docs/13/mvcc-intro.html) - just not in a distributed way. Because the patch is relatively small, Alibaba expects that “PolarDB can be easily upgraded with newer PostgreSQL versions and maintained full compatibility with PostgreSQL”. 

So if you like PostgreSQL, but it’s not distributed or global enough for you, then PolarDB may be the right choice. Just be careful when you Google for it - there’s also “[PolarDB for MySQL](https://www.alibabacloud.com/help/doc-detail/58764.htm)” and “[PolarDB-O](https://www.alibabacloud.com/help/doc-detail/173252.htm?spm=a2c63.p38356.879954.4.52f61625VmFeiZ#concept-jpz-zb2-sdb)” (“compatible with the Oracle syntax”) by Alibaba.

[PolarDB for PostgreSQL GitHub repo](https://github.com/alibaba/PolarDB-for-PostgreSQL)

***

### Tools
#### Prosus Buys Stack Overflow
The one site on the Internet that’s responsible for roughly half of all “copy & paste” commands from developers just got sold. So yes, Stack Overflow now belongs to Prosus. And no, I didn’t know Prosus, either. Apparently, they own a stake in [Codeacademy](https://www.codecademy.com) and [Udemy](https://www.udemy.com), among other investments.

So what will change now with Stack Overflow?

According to the [Stack Overflow CEO](https://stackoverflow.blog/2021/06/02/prosus-acquires-stack-overflow/), not a lot: “Our site and our products will not change in the coming weeks or months, just as our company’s goals and strategic priorities remain the same”. But then again, that’s the guy who buried the bad news of “We laid off staff and may sunset some or all of our ‘Stack Overflow Talent’ business” in a [mountain of corporate jargon](https://stackoverflow.blog/2021/04/07/an-update-on-our-product-led-saas-transformation/).

That’s why I’m glad that Joel Spolsky [took to the keyboard](https://www.joelonsoftware.com/2021/06/02/kinda-a-big-announcement) and confirmed that “Stack Overflow will continue to operate independently, with the exact same team in place that has been operating it, according to the exact same plan and the exact same business practices”.

I was a big fan of Joel in the early 2000s. Some of his articles still hold up nicely, like “[Ben and Jerry’s vs Amazon](https://www.joelonsoftware.com/2000/05/12/strategy-letter-i-ben-and-jerrys-vs-amazon/)”. Geez, I’m really getting old, talking about the good old times. What’s next? Yelling at the kids on my lawn?!

Anyway, let’s hope that Stack Overflow will continue to serve us well, and that there really is [nothing to see here](https://youtu.be/NuAKnbIr6TE).

[Joel Spolsky’s announcement](https://www.joelonsoftware.com/2021/06/02/kinda-a-big-announcement)

***

### Releases
#### Hibernate 5.5.0
The main new feature is the support for Jakarta EE 9 with the new `jakarta.persistence` namespace (see section “Jakarta EE 9.1” in the [last issue](https://bpfnl.substack.com/p/how-to-build-java-applications-today-92f)). That’s in the JAR files with the `-jakarta` appendix in the file name (as in `hibernate-core-jakarta.jar`). 

Viewing the full release notes requires a [Hibernate JIRA account](https://hibernate.atlassian.net/secure/ReleaseNote.jspa?version=31946&styleName=Html&projectId=10031). It’s not worth it: There are dependency updates for JUNit and Log4j 2, three improvements, and one bug fix.

[Announcement](https://in.relation.to/2021/06/02/hibernate-orm-550-final-release/)

***

#### Spring Cloud 2020.0.3
Spring Cloud bundles a [whole lot of sub-projects](https://spring.io/projects/spring-cloud), such as [Spring Cloud Config](https://spring.io/projects/spring-cloud-config) or [Spring Cloud Kubernetes](https://spring.io/projects/spring-cloud-kubernetes). 16 of them got updated for this release; the details are in the announcement below.

[Announcement](https://spring.io/blog/2021/05/28/spring-cloud-2020-0-3-aka-ilford-is-available)

***

#### Spring Integration AWS 2.5.1
Spring Integration for Amazon Web Services has a new release. For some reason, it dragged “Spring Cloud Stream Binder for AWS Kinesis 2.2.0” along for the party. 

Spring Integration AWS 2.5.1 has some minor bug fixes ([not listed on GitHub](https://github.com/spring-projects/spring-integration-aws/releases/tag/v2.5.1)). Spring Cloud Stream Binder for AWS Kinesis 2.2.0 includes Spring Cloud 2020.0.3 (see previous section) and has [unknown](https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/releases/tag/v2.2.0) “bug fixes and improvements”.

[Announcement](https://spring.io/blog/2021/06/04/spring-integration-aws-2-5-1-and-spring-cloud-stream-kinesis-binder-2-2-0-available)

***

#### Helidon 2.3.0
[Helidon](https://helidon.io/) is Oracle’s take on Spring Boot, available as both an imperative and a reactive version. I reported on [Helidon 2.2.0](https://betterprojectsfaster.com/blog/weekly-links-2020-12-28#helidon-220httpsmediumcomhelidonhelidon-2-2-0-released-cdd3b7c43dd1) but did miss version 2.3.0 last month. So, what’s new in 2.3.0?

Firstly, it integrates with Oracle Cloud’s automatic discovery. Now, Oracle’s cloud isn’t in the same league as AWS, Microsoft Azure, or Google’s cloud. But if you use it, chances are you also use some free stuff from Oracle, like Helidon. So that makes perfect sense.

Helidon now also supports [HashiCorp Vault](https://www.vaultproject.io) for secrets & authentication and [Micrometer](https://github.com/micrometer-metrics/micrometer-docs) for monitoring. We can also configure the [graph database Neo4j](https://neo4j.com/) directly.

[Announcement](https://medium.com/helidon/helidon-2-3-0-ed6cbf930d7a)

***

#### Eclipse Vert.x 4.1.0
Did you know that Eclipse also has a reactive framework? I must say that for something that “most developers don’t like” (see section “Why Do We Need Project Loom?” above), there’s an awful lot of reactive frameworks out there… But what do I know?!

This version supports the [Reactive Microsoft SQL Server Client](https://vertx.io/docs/4.1.0/vertx-mssql-client/java/), [RxJava 3](https://github.com/ReactiveX/RxJava), [Open Telemetry](https://opentelemetry.io), and Kotlin 1.5 (see section “Kotlin 1.5” in [issue 35](https://bpfnl.substack.com/p/how-to-build-java-applications-today-faf)). It introduces [HTTP proxies](https://vertx.io/docs/4.1.0/vertx-http-proxy/java/) and adds other enhancements.

[Announcement](https://vertx.io/blog/eclipse-vert-x-4-1-0)

***

## About
Karsten Silz is the author of this newsletter. He is a full-stack web & mobile developer with 22 years of Java experience, author, speaker, and entrepreneur. Karsten got a Master's degree in Computer Science at the Dresden University of Technology (Germany) in 1996.

Karsten co-founded a software product start-up in the US in 2004. He led product development for 13 years and left after the company was sold successfully. He co-founded the UK SaaS start-up "[Your Home in Good Hands](https://yourhomeingoodhands.co.uk/)" as CTO in 2020.

Karsten has [this newsletter](https://bpfnl.substack.com/), a [developer website](https://betterprojectsfaster.com/), and a [contractor site](https://ksilz.com/). He's on [LinkedIn](https://www.linkedin.com/in/ksilz/), [Twitter](https://twitter.com/karsilz), and [GitHub](https://github.com/ksilz). Karsten is also an [author at InfoQ](https://www.infoq.com/profile/Karsten-Silz).