improved NXCSession cleanup
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 8 Sep 2016 18:34:37 +0000 (21:34 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 8 Sep 2016 18:34:37 +0000 (21:34 +0300)
src/java/client/netxms-client/src/main/java/org/netxms/client/NXCSession.java

index 24e9a5d..f936412 100644 (file)
@@ -1985,6 +1985,12 @@ public class NXCSession
 
       isConnected = false;
       isDisconnected = true;
+      
+      listeners.clear();
+      consoleListeners.clear();
+      messageSubscriptions.clear();
+      receivedFiles.clear();
+      recievedUpdates.clear();
    }
 
    /**
@@ -6874,6 +6880,9 @@ public class NXCSession
     */
    public boolean checkConnection()
    {
+      if (!isConnected)
+         return false;
+      
       final NXCPMessage msg = newMessage(NXCPCodes.CMD_KEEPALIVE);
       try
       {