From: David Goulet Date: Tue, 6 May 2014 15:56:25 +0000 (-0400) Subject: Fix: cleanup JUL agent state on sessiond disconnect X-Git-Tag: v2.5.0-rc1~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=87d64abb45c7e1a47606b60570a8768489b51d96;p=lttng-ust.git Fix: cleanup JUL agent state on sessiond disconnect Signed-off-by: David Goulet Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-jul/org/lttng/ust/jul/LTTngLogHandler.java b/liblttng-ust-jul/org/lttng/ust/jul/LTTngLogHandler.java index b4e1c088..ddeb5eb3 100644 --- a/liblttng-ust-jul/org/lttng/ust/jul/LTTngLogHandler.java +++ b/liblttng-ust-jul/org/lttng/ust/jul/LTTngLogHandler.java @@ -83,6 +83,14 @@ public class LTTngLogHandler extends Handler { } } + /* + * Cleanup this handler state meaning put it back to a vanilla state. + */ + public void clear() { + this.eventMap.clear(); + this.logLevelsAll.clear(); + } + @Override public void close() throws SecurityException {} diff --git a/liblttng-ust-jul/org/lttng/ust/jul/LTTngTCPSessiondClient.java b/liblttng-ust-jul/org/lttng/ust/jul/LTTngTCPSessiondClient.java index f3ac80dc..5fdb0498 100644 --- a/liblttng-ust-jul/org/lttng/ust/jul/LTTngTCPSessiondClient.java +++ b/liblttng-ust-jul/org/lttng/ust/jul/LTTngTCPSessiondClient.java @@ -186,6 +186,17 @@ public class LTTngTCPSessiondClient { } } + /* + * Cleanup Agent state. + */ + private void cleanupState() { + enabledEventSet.clear(); + enabledLoggers.clear(); + if (this.handler != null) { + this.handler.clear(); + } + } + public void init(LTTngLogHandler handler) throws InterruptedException { this.handler = handler; @@ -194,6 +205,9 @@ public class LTTngTCPSessiondClient { break; } + /* Cleanup Agent state before trying to connect or reconnect. */ + cleanupState(); + try { /*