With the June Payara Platform releases, Payara Platform will support version 3.3 of the MicroProfile (MP) standard. This blog summarises what changed since 3.2 and how this affects the Payara Platform.
Since MicroProfile 3.2 the standard received updates for 5 projects:
- MicroProfile Config 1.4
- MicroProfile FaultTolerance 2.1
- MicroProfile Health 2.2
- MicroProfile Metrics 2.3
- MicroProfile RestClient 1.4
New and Noteworthy in MP Config 1.4
In version 1.4, details of configuration value conversion were updated. The build-in conversion now supports the primitives byte, short and char and their wrapper classes Byte, Short and Character.
The so called automatic converter created from potentially existing static factory methods of(String), valueOf(String) or parse(CharSequence) or the constructor T(String) of a target class changed in priority to of (highest), valueOf, parse, constructor (lowest). The existing method or constructor with highest priority is used to create target class from a property value String.
Furthermore the Converter abstraction now extends Serializable.
In addition to the standard, Payara Platform introduced a short time caching of property values to improve lookup performance of frequently queried properties. The default Time To Live (TTL) for this cache is 1 minute. This can be changed by setting the system property MP_CONFIG_CACHE_DURATION to the number of seconds a value should be cached. Using zero or less disables the cache.
New and Noteworthy in MP FaultTolterance 2.1
The @Fallback annotation got the new attributes applyOn (white-list) and skipOn (blacklist) of exception classes that should or should not trigger the fallback method usage. The Blacklist has priority over the white-list. Whether or not a thrown exception is a member of a set is checked by class assignability. If a thrown exception is not a member of any of the two sets it is re-thrown, no fallback is called.
Similarly the @CircuitBreaker annotation got a skipOn (blacklist) in addition to its existing failOn (whitelist) attribute. These work in an identical way to determine which exceptions affect the circuit breaker state.
For @Asynchronous execution the CDI @RequestScope context is now activated for that worker thread responsible to run the asynchronous computation.
Methods that were annotated with both @Bulkhead and @Asynchronous now semantically exit the bulkhead when control transfers back to the caller as opposed to when the underlying annotated method returns a value. This means queuing computations can first enter the bulkhead after all fault tolerance semantics have been applied fully.
Furthermore issues discovered in Payara Platform since FT 2.0 have been addressed. The exception handling now correctly handles Error subtypes. A race condition during deployment that could lead to miscounting the number of threads entering and exiting a bulkhead was addressed and FT configurations referencing application specific classes no longer fail to load these from their string name.
New and Noteworthy in MP Health 2.2
The MP Health 2.2 release is updates to CDI version 2.0.
New and Noteworthy in MP Metrics 2.3
In Metrics 2.3, a new metric type SimpleTimer was introduced. It is similar to Timer but does not provide the Metered statistics which saves the overhead in cases the statistics are of no interest. As usual it can be used programmatically or by using the new corresponding @SimplyTimed annotation.
We also addressed an issue in the OpenMetrics export format that would wrongly duplicate TYPE lines for metrics of the same name but different tags.
As global tags feature of metrics uses MP Config lookups frequently the implementation will also benefit substantially from the caching introduced.
New and Noteworthy in MP RestClient 1.4
Version 1.4 clarified that the support for injection of JAX-RS @Context fields or methods into ClientHeadersFactory implementations is optional. Payara Platform current only supports CDI injection using @Inject.
Furthermore the @RestClient annotation got annotated with @Target allowing the typical set for CDI qualifiers: ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER and ElementType.TYPE (version 1.4.1).
MicroProfile 3.3 further completes the picture with some new details and smaller feature additions. Nonetheless this is an important step for Payara with key improvements being done under the hood.