Who needs chocolate when they can have Java features in their advent calendar? (Yes, I'm late, but fashionably so. 😋) From language features to API additions, from tooling to performance, here are 24 Java features you missed in 2022! As 📺: youtube.com/watch?v=ghGvFc… As 🧵: 👇🏾
#1: Structured Concurrency Debugging When you do structured concurrency, you create parent-child relationships between your threads that are visible in thread dumps and to debuggers. See @intellijidea screenshot what that can look like. This is a game changer for debugging!
#2: `Future` The interface got 3 new methods: * `exceptionNow()` to immediately return the task's exception * `resultNow()` to immediately return the task's result * `state()`: CANCELLED, FAILED, RUNNING, or SUCCESS First two throw `IllegalStateException` if in wrong state.
#3: `ForkJoinTask` 2 new methods: * `quietlyJoin(long timeout, TimeUnit unit)` tries to join the task before the given timeout * `quietlyJoinUninterruptibly(long timeout, TimeUnit unit)` same but can't be interrupted (Tbh, the 2nd one seems shady, but that's just gut feeling.)