[2022 javaone] foundations of modern java server apps

Speaker: Kito Mann

For more see the table of contents

Notes

  • In cloud, have both microservices and traditional web apps

Microservice

  • Container (ex: docker) including UNIX kernel
  • Executable Jar or Native Image (ex: Graal)
  • Example microservice framework – Http Server, Http Java Integration, REST processing, JSON serialization, JSON parsing, validation, security, database integration, dependency injection, messaging, mail, health checks, tracing, fault tolerance, metrics, config, OpenAPI docs, GraphQL
  • Microservice frameworks – Spring boot, quarkus, micronaut, open liberty

Spring Boot

  • Http Server – Jetty, Tomcat or Underflow
  • Http Java Integration – Jakarta Servlet
  • REST processing – Jakarta RESTful Web Services or Spring MVC
  • JSON serialization – Gson, Jackson or JSON Binding
  • JSON parsing – Gson, Jackson or JSON Parsing
  • validation – Jakarta Bean validation
  • security – Spring security
  • database integration – JPA and others
  • dependency injection – Spring framework
  • messaging – Jakarta messaging, kafka and others
  • mail – spring java mail sender or jarkarta mail
  • health checks – spring boot actuator
  • tracing – spring cloud sleuth
  • fault tolerance – spring cloud circuit breaker and spring cloud netflix
  • metrics – micrometer
  • config – spring boot config
  • OpenAPI docs – Spring REST data
  • GraphQL – Spring for GraphQL

Others

Did same for Quarkus, Payara Micro, Jarkarta EE. Didn’t transcribe deck

A lot of delegating to Jakarta and MicroProfile projects

MicroProfile

  • Started in 2016

Jakarta projects

  • Jakarta Interceptors – standard way of writing interceptors
  • Platform – Jakarta enterprise beans, authorization, batch, connectors, mail, activation, messaging, web profile, core profile
  • Optional (not fully supported) – Jakarta enterprise web services, xml binding, SOAP with attachments, XML web services
  • Web profile – servlet, bean validator, persistence, authentication, web socket, CDI, mail, security, transactions, expression language, managed beans, concurrency, faces, standard tag libraries, server pages, enterprise beans light
  • Core profile – interceptor, dependency injection, annotations
  • Required for MicroProfile – Jakarta RESTful web services, JSON processing, JSON binding, CDI light
  • CDI surpassing EJB
  • New: Jakarta RPC, NoSQL, data
  • Removed: Jakarta Management

Java EE Server

  • War
  • Jakarta Servlet, RESTful web services, JSON binding/parsing, bean validation, security, persistence, CDI, messaging, mail

My take

Wow. A lot has changed since I last worked on a web app. Learned a lot here although the talk was longer than my attention span; especially later in the day. It was a bit of an info dump but good for getting the lay of the land. And I need to do a lot of reading!

[2022 javaone] new java features simplified design patterns

Speakers: Miroslav Wegner and Benedikt Neumayr

For more see the table of contents

Byte code optimization

  • Inlining
  • Elimination
  • Scalarization

Design patterns

  • SOLID
  • DRY don’t repeat yourself
  • Separation of concerns
  • CAP – two of three (consistency, availability, partition tolderance)

Creating objects

  • Factory vs Builder
  • Example of using a builder with a sealed class
  • Factory: List.of(…)
  • Switch expression to determine what to create in factory

Organizing code

  • Organize code around instantiated objects: Adapter, Flyweight
  • Spiterator is an adapter
  • IntegerCache is Flyweight

Enforcin behavior at runtime

  • Chain of responsibility, command, caching
  • Logger is chain of responsibility
  • Runnable and Callable are command

Concurrency

  • Thread pool pattern
  • Executors

My take

I liked the one line ”safe harbor” statement that anything could change. Nice link between patterns we’ve known forever and new (and old) classes. There was a good crowd. I wish they had a room vs being on the floor of the exhibit hall. I also wish it was longer (vs a 20 min session)

[2022 javaone] inside java

For more see the table of contents

Julia Liuson – Microsoft

  • 2 million JVMs in prod across MS
  • LinkedIn uses Kafka
  • MS Bing uses JVMs for indexing
  • FedEx uses Java for tracking dashboard includng global deliver prediction platform. lots of events. Queues, predictions, etc
  • Contribute patches to Open JDK

Mark Heckler – Microsoft

  • GitHub Codespaces – opens in VS Code in cloud based container. Open from where you would get the URL to clone. Can customize with plugins
  • Also copilot, advanced Security – application insights load tesing
  • Co pilot can write comments from code, not just code from comments
  • Push protections – tells you if commit credentials

Chad Arimura

  • In last 5 years: JDK 10-19, lots of new features
  • Helpful null pointers were winner of feature face off on twitter
  • Predictable rock solid releases
  • OpenJDK brains, release cycle heartbeat

Project Amber – Gavin Bierman

  • Improve developer produuctivity
  • var, switch expressions, text blocks, reocrds, pattern matching, sealed classes
  • Records aren’t just about less typing. Expresses intent
  • Record pattern is a structural pattern. if (o instanceof Pair(Object a, Object b) – tests structure of data
  • Record patterns are a good place for var
  • Nested record patters Outer(Inner(var x), var y)
  • Compiler deals with nulls for you

ZGC – Michael Vidstedt

  • Scalable up to terrabytes
  • Low latency – less than one millisecond pauses
  • Auto-tuning; sipler config
  • Prod ready since Java 15
  • Does more work concurrently with running app
  • Tiny pause for internal state change in benchmark
  • For real app on Oracle cloud, very significant decrease
  • Weak generational hypothesis – most objects are short lived. Better performance optiimizing for this

Platform Security – Sean Mullan

  • Includes APIs an implementations for secure apps
  • Stronger security algorithms
  • Java flight recorder and Java mission control
  • Can see X509 certs in cacerts
  • X509 validation – can drill down and see details
  • Events added to Java 12 and backported. Adding more events in Java 20

Project Loom – Ron Pressler and Tomas Langer

  • Virtual threads
  • JEP 425 preview in Java 19 – virtual threads –
  • JEP 428 incubator in Java 19 – structured concurrency
  • Blocking is now cheap and encourage
  • Every sequential task gets own thread. Never pool virtual threads

Loom and ZGC – Denys Makogon

  • Remote video from Ukraine
  • Did experiment with Formula 1 racing

My take

The Microsoft keynote was a lot more about MS than yesterday’s SonarQube keynote was about Sonar. Not inherently good or bad, but an interesting different. Julia introduced Mark as ”Mike Heckler” caling him ”Mike” twice. There was a little snickering in the JUG Leader/Java Champions section up front. It was an innocent mistake but humorous. And I assume folks will be calling him MIke to tease him later. I didn’t know copilot could write commnets, that’s cool!

There was a tiny bit of repetition from yesterday’s keyote. Not a ton, but I didn’t blog on the duplicate slides. I love that Duke is driving a recycling truck rather than a garbage truck. The demos were great to see as well.