Synchronize SPI span decorator loading and have them loaded eagerly.
Motivation and Context
eagerly load decorators obtained via SPI to avoid exceptions in high-concurrency setups
instances of ServiceLoader are not thread-safe, iterating on the Iterable may yield exceptions if done concurrently
eager loading prevents any reloading functionality of ServiceLoader to work
Example exception (sadly ServiceLoaderSpanDecorator not rendered):
java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
at java.lang.CompoundEnumeration.next(ClassLoader.java:2725)
at java.lang.CompoundEnumeration.hasMoreElements(ClassLoader.java:2734)
... 30 frames excluded
at org.zalando.fauxpas.ThrowingSupplier.get(ThrowingSupplier.java:19)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at io.opentracing.contrib.concurrent.TracedRunnable.run(TracedRunnable.java:30)
... 6 frames excluded
at org.zalando.fauxpas.ThrowingFunction.apply(ThrowingFunction.java:19)
... 5 frames excluded
Synchronize SPI span decorator loading and have them loaded eagerly.
Motivation and Context
ServiceLoader
are not thread-safe, iterating on theIterable
may yield exceptions if done concurrentlyServiceLoader
to workExample exception (sadly
ServiceLoaderSpanDecorator
not rendered):See also https://github.com/zalando/riptide/pull/1462 for the same fix
Types of changes
Checklist: