[jboss-remoting-commits] JBoss Remoting SVN: r5137 - remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed May 6 00:24:25 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-05-06 00:24:25 -0400 (Wed, 06 May 2009)
New Revision: 5137

Modified:
   remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1112 (and others to be named): notifyAndDisconnect() synchronized on the connectionValidator.

Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java	2009-05-06 00:20:15 UTC (rev 5136)
+++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java	2009-05-06 04:24:25 UTC (rev 5137)
@@ -1646,26 +1646,30 @@
 //      synchronized (connectionValidatorLock)
       {
 //         disconnect();
+         log.debug(this + " entering notifyAndDisconnect()");
          if (connectionValidator != null)
          {
-             log.debug(this + " calling connectionValidator.notifyListeners()");
-            connectionValidator.notifyListeners(new Exception("Could not connect to server!"));
-            Iterator it = connectionListeners.iterator();
-            while (it.hasNext())
+            synchronized (connectionValidator)
             {
-               ConnectionListener listener = (ConnectionListener) it.next();
-               connectionValidator.removeConnectionListener(this, listener);
+               if (connectionValidator.isStopped())
+               {
+                  log.debug(this + ": " + connectionValidator + " is stopped");
+               }
+               else
+               {
+                  log.debug(this + ": " + connectionValidator + " is not stopped");
+                  log.debug(this + " calling connectionValidator.notifyListeners()");
+                  connectionValidator.notifyListeners(new Exception("Could not connect to server!"));
+                  Iterator it = connectionListeners.iterator();
+                  while (it.hasNext())
+                  {
+                     ConnectionListener listener = (ConnectionListener) it.next();
+                     connectionValidator.removeConnectionListener(this, listener);
+                  }
+                  connectionValidators.remove(connectionValidatorKey);
+                  log.debug(this + " removed from static map: " + connectionValidator);
+               }
             }
-            if (connectionValidator.isStopped())
-            {
-               connectionValidators.remove(connectionValidatorKey);
-               log.debug(this + " removed from static map: " + connectionValidator);
-            }
-            else
-            {
-                log.debug(this + ": " + connectionValidator + " is not stopped");
-            }
-            
             connectionValidator = null;
             connectionValidatorKey = null;
          }
@@ -1680,6 +1684,7 @@
          }
 
          connected = false;
+         log.debug(this + " leaving notifyAndDisconnect()");
       }
    }
    
@@ -1793,6 +1798,7 @@
          }
       }
 
+      log.debug(this + " enableLease: " + enableLease);
       if (enableLease)
       {
          Map temp = new HashMap(configuration);




More information about the jboss-remoting-commits mailing list