[jboss-remoting-commits] JBoss Remoting SVN: r6469 - in remoting2/branches/2.2.4_JBREM-1297: src/etc and 8 other directories.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Mon Aug 13 04:15:04 EDT 2012


Author: raggz
Date: 2012-08-13 04:15:03 -0400 (Mon, 13 Aug 2012)
New Revision: 6469

Added:
   remoting2/branches/2.2.4_JBREM-1297/src/etc/jenkins.touch
Modified:
   remoting2/branches/2.2.4_JBREM-1297/
   remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/Client.java
   remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/ConnectionValidator.java
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
   remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
Log:
Backport of JBREM-1297 into Remoting 2.24


Property changes on: remoting2/branches/2.2.4_JBREM-1297
___________________________________________________________________
Added: svn:mergeinfo
   + /remoting2/branches/2.2:6403-6404,6417

Copied: remoting2/branches/2.2.4_JBREM-1297/src/etc/jenkins.touch (from rev 6417, remoting2/branches/2.2/src/etc/jenkins.touch)
===================================================================
Modified: remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/Client.java	2012-07-25 05:05:48 UTC (rev 6468)
+++ remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/Client.java	2012-08-13 08:15:03 UTC (rev 6469)
@@ -1812,6 +1812,11 @@
       }
    }
    
+   static Object getConnectionValidatorLock()
+   {
+      return connectionValidatorLock;
+   }
+   
    // Protected ------------------------------------------------------------------------------------
 
    // Private --------------------------------------------------------------------------------------
@@ -1948,17 +1953,25 @@
          //
          // 1. a. This method calls MicroRemoteClientInvoker.establishLease()
          //    b. MicroRemoteClientInvoker.establishLease() synchronizes on MicroRemoteClientInvoker.clientLeaseLock
-         //       and calls Client.addConnectionListener()
-         //    c. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock
+         //    c. MicroRemoteClientInvoker.establishLease() calls Client.addConnectionListener()
+         //    d. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock
          //
-         // 2. a. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock and calls
-         //       new ConnectionValidator()
-         //    b. new ConnectionValidator() calls MicroRemoteClientInvoker.getLeasePinger(), which
-         //       synchronizes on MicroRemoteClientInvoker.clientLeaseLock
+         // 2. a. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock
+         //    b. Client.addConnectionListener() calls new ConnectionValidator()
+         //    c. new ConnectionValidator() calls MicroRemoteClientInvoker.getLeasePinger()
+         //    d. MicroRemoteClientInvoker.getLeasePinger() synchronizes on MicroRemoteClientInvoker.clientLeaseLock
          //
-         // By synchronizing on connectionValidatorLock here, we assure that both sequences acquire
+         // 3. a. ConnectionValidator$WaitOnConnectionCheckTimerTask.run() synchronizes on Client.connectionValidatorLock
+         //    b. ConnectionValidator$WaitOnConnectionCheckTimerTask.run() calls MicroRemoteClientInvoker.terminateLease()
+         //    c. MicroRemoteClientInvoker.terminateLease() synchronizes on MicroRemoteClientInvoker.clientLeaseLock 
+         //    d. MicroRemoteClientInvoker.terminateLease() calls LeasePinger.stopPing()
+         //    e. LeasePinger.stopPing() calls Client.notifyListeners()
+         //    f. Client.notifyListeners() synchronizes on Client.connectionValidatorLock
+         //
+         // By synchronizing on connectionValidatorLock here, we assure that all sequences acquire
          // Client.connectionValidatorLock first and then acquire MicroRemoteClientInvoker.clientLeaseLock.
          //
+         // See JBREM-1242 and JBREM-1297.
          synchronized(connectionValidatorLock)
          {
             invoker.establishLease(sessionId, temp, leasePeriod);

Modified: remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/ConnectionValidator.java
===================================================================
--- remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/ConnectionValidator.java	2012-07-25 05:05:48 UTC (rev 6468)
+++ remoting2/branches/2.2.4_JBREM-1297/src/main/org/jboss/remoting/ConnectionValidator.java	2012-08-13 08:15:03 UTC (rev 6469)
@@ -1049,7 +1049,35 @@
                   log.debug(ConnectionValidator.this + " shutting down lease pinger: " + leasePinger);
                   int disconnectTimeout = (failureDisconnectTimeout == -1) ? client.getDisconnectTimeout() : failureDisconnectTimeout;
                   if (trace) log.trace(ConnectionValidator.this + " disconnectTimeout: " + disconnectTimeout);
-                  sharedInvoker.terminateLease(null, disconnectTimeout, leasePinger);
+                  
+                  // Synchronizing on Client.connectionValidatorLock to prevent a deadlock:
+                  //
+                  // 1. a. This method calls MicroRemoteClientInvoker.terminateLease()
+                  //    b. MicroRemoteClientInvoker.terminateLease() synchronizes on MicroRemoteClientInvoker.clientLeaseLock 
+                  //    c. MicroRemoteClientInvoker.terminateLease() calls LeasePinger.stopPing()
+                  //    d. LeasePinger.stopPing() calls Client.notifyListeners()
+                  //    e. Client.notifyListeners() synchronizes on Client.connectionValidatorLock
+                  //
+                  // 2. a. Client.connect() calls Client.setupClientLease()
+                  //    b. Client.setupClientLease() synchronizes on Client.connectionValidatorLock
+                  //    c. Client.setupClientLease() calls MicroRemoteClientInvoker.establishLease()
+                  //    d. MicroRemoteClientInvoker.establishLease() synchronizes on MicroRemoteClientInvoker.clientLeaseLock
+                  //    e. MicroRemoteClientInvoker.establishLease() calls Client.addConnectionListener()
+                  //    f. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock
+                  //
+                  // 3. a. Client.addConnectionListener() synchronizes on Client.connectionValidatorLock
+                  //    b. Client.addConnectionListener() calls new ConnectionValidator()
+                  //    c. new ConnectionValidator() calls MicroRemoteClientInvoker.getLeasePinger()
+                  //    d. MicroRemoteClientInvoker.getLeasePinger() synchronizes on MicroRemoteClientInvoker.clientLeaseLock
+                  //
+                  // By synchronizing on connectionValidatorLock here, we assure that all sequences acquire
+                  // Client.connectionValidatorLock first and then acquire MicroRemoteClientInvoker.clientLeaseLock.
+                  //
+                  // See JBREM-1242 and JBREM-1297.
+                  synchronized (Client.getConnectionValidatorLock())
+                  {
+                     sharedInvoker.terminateLease(null, disconnectTimeout, leasePinger);
+                  }
                }
                else
                {


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.4_JBREM-1297/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
___________________________________________________________________
Deleted: svn:mergeinfo
   - 



More information about the jboss-remoting-commits mailing list