Fix: cleanup JUL agent state on sessiond disconnect
authorDavid Goulet <dgoulet@efficios.com>
Tue, 6 May 2014 15:56:25 +0000 (11:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 May 2014 21:45:40 +0000 (17:45 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-jul/org/lttng/ust/jul/LTTngLogHandler.java
liblttng-ust-jul/org/lttng/ust/jul/LTTngTCPSessiondClient.java

index b4e1c088423a5a2e68f491b07ff9c24c528c97f7..ddeb5eb3b36e9e04cba608cbd0a17539a948c265 100644 (file)
@@ -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 {}
 
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.027886 seconds and 4 git commands to generate.