Repository: quarkusio/quarkus
Issue: Two beans with @Scheduled causes jaeger metrics error

There seems to be an issue with the combination of two (or more) beans using @Scheduled with @Traced at the same time. 

Quarkus 0.14
Mvn 3.6.1
Java 11
GraalVM not relevant

Trigger using code sample in this repository:
https://github.com/mejlholm/quarkus-scheduled-error

Though it seems to be an issue with @Traced and @Scheduled in two @ApplicationScoped beans at the same time. 

Triggers this error on startup with: mvn clean compile quarkus:dev

2019-04-29 11:07:17,088 ERROR [org.qua.cor.ErrorLogger] (DefaultQuartzScheduler_Worker-1) Job (io.quarkus.scheduler.Scheduler.1_org.acme.quickstart.Scheduler1_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.RuntimeException: No reflection exceptions should be thrown unless there is a fundamental error in your code set up.]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.lang.RuntimeException: No reflection exceptions should be thrown unless there is a fundamental error in your code set up.
        at io.jaegertracing.internal.metrics.Metrics.createMetrics(Metrics.java:76)
        at io.jaegertracing.internal.metrics.Metrics.<init>(Metrics.java:32)
        at io.jaegertracing.internal.metrics.Metrics.<init>(Metrics.java:28)
        at io.jaegertracing.Configuration.getTracerBuilder(Configuration.java:221)
        at io.jaegertracing.Configuration.getTracer(Configuration.java:245)
        at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.lambda$tracer$0(QuarkusJaegerTracer.java:45)
        at java.base/java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:209)
        at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.tracer(QuarkusJaegerTracer.java:41)
        at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.buildSpan(QuarkusJaegerTracer.java:51)
        at io.opentracing.util.GlobalTracer.buildSpan(GlobalTracer.java:133)
        at io.opentracing.contrib.interceptors.OpenTracingInterceptor.wrap(OpenTracingInterceptor.java:44)
        at io.opentracing.contrib.interceptors.OpenTracingInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270)
        at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149)
        at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173)
        at io.quarkus.arc.ActivateRequestContextInterceptor.aroundInvoke(ActivateRequestContextInterceptor.java:38)
        at io.quarkus.arc.ActivateRequestContextInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270)
        at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149)
        at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173)
        at org.acme.quickstart.Scheduler1_Subclass.run(Unknown Source)
        at org.acme.quickstart.Scheduler1_ClientProxy.run(Unknown Source)
        at org.acme.quickstart.Scheduler1_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de.invoke(Unknown Source)
        at io.quarkus.scheduler.runtime.QuartzScheduler$InvokerJob.execute(QuartzScheduler.java:264)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        ... 1 more
Caused by: java.lang.IllegalArgumentException: A metric with name jaeger_tracer_reporter_queue_length already exists
        at io.smallrye.metrics.MetricsRegistryImphttps://github.com/quarkusio/quarkus/issues/new

l.register(MetricsRegistryImpl.java:113)
        at io.quarkus.jaeger.runtime.QuarkusJaegerMetricsFactory.createGauge(QuarkusJaegerMetricsFactory.java:64)
        at io.jaegertracing.internal.metrics.Metrics.createMetrics(Metrics.java:66)
        ... 25 more 

Changed files:
extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java

diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
index 594270e8819..a4842a554a5 100644
--- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
+++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
@@ -16,8 +16,6 @@
 
 package io.quarkus.jaeger.runtime;
 
-import java.util.concurrent.atomic.AtomicReference;
-
 import io.jaegertracing.Configuration;
 import io.opentracing.ScopeManager;
 import io.opentracing.Span;
@@ -27,23 +25,23 @@
 
 public class QuarkusJaegerTracer implements Tracer {
 
-    static AtomicReference<Tracer> REF = new AtomicReference<>();
-
-    public QuarkusJaegerTracer() {
-    }
+    private static volatile Tracer tracer;
 
     @Override
     public String toString() {
         return tracer().toString();
     }
 
-    Tracer tracer() {
-        return REF.updateAndGet((orig) -> {
-            if (orig != null) {
-                return orig;
+    private static Tracer tracer() {
+        if (tracer == null) {
+            synchronized (QuarkusJaegerTracer.class) {
+                if (tracer == null) {
+                    tracer = Configuration.fromEnv()
+                            .withMetricsFactory(new QuarkusJaegerMetricsFactory()).getTracer();
+                }
             }
-            return Configuration.fromEnv().withMetricsFactory(new QuarkusJaegerMetricsFactory()).getTracer();
-        });
+        }
+        return tracer;
     }
 
     @Override