diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-12-04 16:38:10 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-12-04 16:38:10 +0100 |
commit | dd19b552b65c5480e6bb910e1744f53ca58cd687 (patch) | |
tree | 6bd89387a2e26b2757f0db649d2e4efffa165060 /config | |
parent | 466909c0a548b54cdc1b8f3f8ba708efad7855f6 (diff) |
Include stack trace when constructed in log warning
Diffstat (limited to 'config')
-rw-r--r-- | config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java index aed1b8bc156..04b6123d5c1 100644 --- a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java @@ -34,6 +34,7 @@ public class ConfigSubscriber { protected final List<ConfigHandle<? extends ConfigInstance>> subscriptionHandles = new CopyOnWriteArrayList<>(); private final ConfigSource source; private final Object monitor = new Object(); + private final Throwable stackTraceAtConstruction; // TODO Remove once finalizer is gone /** The last complete config generation received by this */ private long generation = -1; @@ -69,6 +70,7 @@ public class ConfigSubscriber { */ public ConfigSubscriber(ConfigSource source) { this.source = source; + this.stackTraceAtConstruction = new Throwable(); } /** @@ -474,7 +476,11 @@ public class ConfigSubscriber { protected void finalize() throws Throwable { try { if (!isClosed()) { - log.log(LogLevel.WARNING, () -> String.format("%s: Closing subscription from finalizer() - close() has not been called (keys=%s)", super.toString(), subscriptionHandles.stream().map(handle -> handle.subscription().getKey().toString()).collect(toList()))); + log.log(LogLevel.WARNING, + stackTraceAtConstruction, + () -> String.format("%s: Closing subscription from finalizer() - close() has not been called (keys=%s)", + super.toString(), + subscriptionHandles.stream().map(handle -> handle.subscription().getKey().toString()).collect(toList()))); close(); } } finally { |