Log exceptions from Tracer.finalize()

This commit is contained in:
Tyler Benson 2019-02-08 11:09:24 -08:00
parent 65add99a7b
commit 0e1dce868c
2 changed files with 12 additions and 4 deletions

View File

@ -261,8 +261,12 @@ public class DDTracer implements io.opentracing.Tracer, Closeable, datadog.trace
@Override
public void finalize() {
Runtime.getRuntime().removeShutdownHook(shutdownCallback);
shutdownCallback.run();
try {
Runtime.getRuntime().removeShutdownHook(shutdownCallback);
shutdownCallback.run();
} catch (final Exception e) {
log.error("Error while finalizing DDTracer.", e);
}
}
/**

View File

@ -138,8 +138,12 @@ public class Tracer implements Closeable {
@Override
public void finalize() {
Runtime.getRuntime().removeShutdownHook(shutdownCallback);
shutdownCallback.run();
try {
Runtime.getRuntime().removeShutdownHook(shutdownCallback);
shutdownCallback.run();
} catch (final Exception e) {
log.error("Error while finalizing Tracer.", e);
}
}
@Override