Skip to content

Commit

Permalink
Revert "Unregister shutdown hook when tracer is closed (jaegertracing…
Browse files Browse the repository at this point in the history
…#679)"

This reverts commit 4bde959.

Signed-off-by: Tomas Hofman <thofman@redhat.com>
  • Loading branch information
TomasHofman committed Feb 12, 2020
1 parent 74adce4 commit eeeb4a0
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public class JaegerTracer implements Tracer, Closeable {
@ToString.Exclude private final BaggageSetter baggageSetter;
@ToString.Exclude private final JaegerObjectFactory objectFactory;
@ToString.Exclude private final int ipv4; // human readable representation is present within the tag map
@ToString.Exclude private Thread shutdownHook;

protected JaegerTracer(JaegerTracer.Builder builder) {
this.serviceName = builder.serviceName;
Expand Down Expand Up @@ -130,13 +129,12 @@ protected JaegerTracer(JaegerTracer.Builder builder) {
log.info("No shutdown hook registered: Please call close() manually on application shutdown.");
} else {
// register this tracer with a shutdown hook, to flush the spans before the VM shuts down
shutdownHook = new Thread() {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
JaegerTracer.this.close();
}
};
Runtime.getRuntime().addShutdownHook(shutdownHook);
});
}
}

Expand Down Expand Up @@ -226,9 +224,6 @@ public <T> JaegerSpanContext extract(Format<T> format, T carrier) {
public void close() {
reporter.close();
sampler.close();
if (shutdownHook != null) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
}
}

public class SpanBuilder implements Tracer.SpanBuilder {
Expand Down

0 comments on commit eeeb4a0

Please sign in to comment.