Martin Ahrer

Thinking outside the box

0001-01-01 1 min read
Indent
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twelve/api/StringApi.java[tag=indent]

With String::indent we can easily indent any string. With earlier Java versions we would have to use 3rd-party libraries such as Apache commons-lang or implement yourself..

Transform
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twelve/api/StringApi.java[tag=transform]

With String::transform we can easily transform any string.

Continue reading

0001-01-01 1 min read

The following describes selected improvements of the Java JVM. See the Java 12 release notes.

With JEP-341, now CDS archives are built during the JDK build. CDS is already on by default as of {java11}.

0001-01-01 1 min read

The following describes selected improvements of the Java API. See the Java 20 release notes.

Java 20 is introducing the following API enhancements as developer preview or Incubator.

  • JEP 429 is introducing scoped values, which enable the sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads

  • JEP 436 is introducing virtual threads to the Java Platform. Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications.

  • JEP 437 is simplifying multithreaded programming by introducing an API for structured concurrency. Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability..

Continue reading

0001-01-01 2 min read

The following describes selected improvements of the Java API. See the Java 25 release notes.

Java 25 is introducing the following finalized API enhancements.

  • JEP 506 is finalizing Scoped Values. Enable the sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads.

  • JEP 510 is introducing Key Derivation Function API. Provide an API for Key Derivation Functions (KDFs), which are cryptographic algorithms for deriving additional keys from a secret key or other high-entropy key material.

Continue reading

0001-01-01 1 min read

Before Java 25, ThreadLocal variables were used to share request context across method calls. ThreadLocal requires manual cleanup and has memory overhead with virtual threads.

Request Context With Thread Local
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/api/ScopedValues.java[tag=requestContextWithThreadLocal]
Request Context With Scoped Value
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/api/ScopedValues.java[tag=requestContextWithScopedValue]
Continue reading

0001-01-01 1 min read

The following describes selected improvements of the Java Virtual Machine. See the Java 25 release notes.

Java 25 is introducing the following finalized JVM enhancements.

  • JEP 518 is introducing JFR Cooperative Sampling. Enhance Java Flight Recorder (JFR) with cooperative sampling capabilities, allowing applications to participate in profiling decisions and reduce overhead.

  • JEP 519 is introducing Compact Object Headers. Reduce the memory footprint of Java objects by implementing compact object headers, improving memory efficiency and performance.

  • JEP 520 is introducing JFR Method Timing & Tracing. Enhance Java Flight Recorder with improved method-level timing and tracing capabilities for better application performance analysis.

  • JEP 521 is introducing Generational Shenandoah. Improve application performance by extending Shenandoah to maintain separate generations for young and old objects, allowing more frequent collection of short-lived objects.

Continue reading
Older posts Newer posts