Fix: cleanup JUL agent state on sessiond disconnect
[lttng-ust.git] / liblttng-ust-jul / org / lttng / ust / jul / LTTngTCPSessiondClient.java
index f3ac80dc6e78860ae8ae4fb72cfb182da65a445d..5fdb04986c6c6f8ab2b6147ad83c43f1adddd12d 100644 (file)
@@ -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 {
 
                                /*
This page took 0.024701 seconds and 4 git commands to generate.