incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefane...@apache.org
Subject svn commit: r1499993 - /sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java
Date Fri, 05 Jul 2013 13:01:57 GMT
Author: stefanegli
Date: Fri Jul  5 13:01:57 2013
New Revision: 1499993

URL: http://svn.apache.org/r1499993
Log:
SLING-2945 related : ClusterLoadTest discovered another race condition where during a vote.matches
the vote is deleted. Handling this situation properly now

Modified:
    sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java

Modified: sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java?rev=1499993&r1=1499992&r2=1499993&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java
(original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/View.java
Fri Jul  5 13:01:57 2013
@@ -100,13 +100,20 @@ public class View {
         if (members == null) {
             return false;
         }
-        final Iterator<Resource> it = members.getChildren().iterator();
-        while (it.hasNext()) {
-            Resource aMemberRes = it.next();
-
-            if (!viewCopy.remove(aMemberRes.getName())) {
-                return false;
-            }
+        try{
+	        final Iterator<Resource> it = members.getChildren().iterator();
+	        while (it.hasNext()) {
+	            Resource aMemberRes = it.next();
+	
+	            if (!viewCopy.remove(aMemberRes.getName())) {
+	                return false;
+	            }
+	        }
+        } catch(RuntimeException re) {
+        	// SLING-2945 : the members resource could have been deleted
+        	//              by another party simultaneously
+        	//              so treat this situation nicely
+        	return false;
         }
         // now the ViewCopy set must be empty to represent a match
         return (viewCopy.size() == 0);



Mime
View raw message