zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f..@apache.org
Subject svn commit: r1550923 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/java/test/org/apache/zookeeper/test/ClientBase.java src/java/test/org/apache/zookeeper/test/JMXEnv.java
Date Sat, 14 Dec 2013 11:23:24 GMT
Author: fpj
Date: Sat Dec 14 11:23:24 2013
New Revision: 1550923

URL: http://svn.apache.org/r1550923
Log:
ZOOKEEPER-1837. Fix JMXEnv checks (potential race conditions) (Germán Blanco via fpj)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientBase.java
    zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/JMXEnv.java

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1550923&r1=1550922&r2=1550923&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Sat Dec 14 11:23:24 2013
@@ -183,6 +183,9 @@ BUGFIXES:
   ZOOKEEPER-1382. Zookeeper server holds onto dead/expired session ids in the watch data
structures
   (Germán Blanco and Michael Morello via camille)
 
+  ZOOKEEPER-1837. Fix JMXEnv checks (potential race conditions)
+  (Germán Blanco via fpj)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientBase.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientBase.java?rev=1550923&r1=1550922&r2=1550923&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientBase.java
(original)
+++ zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientBase.java
Sat Dec 14 11:23:24 2013
@@ -188,14 +188,13 @@ public abstract class ClientBase extends
             }
             if (allClients != null) {
                 allClients.add(zk);
+                JMXEnv.ensureAll("0x" + Long.toHexString(zk.getSessionId()));
             } else {
                 // test done - close the zk, not needed
                 zk.close();
             }
         }
 
-        JMXEnv.ensureAll("0x" + Long.toHexString(zk.getSessionId()));
-
         return zk;
     }
 

Modified: zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/JMXEnv.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/JMXEnv.java?rev=1550923&r1=1550922&r2=1550923&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/JMXEnv.java (original)
+++ zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/JMXEnv.java Sat
Dec 14 11:23:24 2013
@@ -122,16 +122,22 @@ public class JMXEnv {
      * Note that these are components of the name, and in particular
      * order matters - you want the more specific name (leafs) specified
      * before their parent(s) (since names are hierarchical)
+     * It waits in a loop up to 5 seconds before failing if there is a
+     * mismatch.
      * @param expectedNames
      * @return
      * @throws IOException
      * @throws MalformedObjectNameException
      */
     public static Set<ObjectName> ensureOnly(String... expectedNames)
-        throws IOException
+        throws IOException, InterruptedException
     {
         LOG.info("ensureOnly:" + Arrays.toString(expectedNames));
         Set<ObjectName> beans = ensureAll(expectedNames);
+        for (int i = 0; (i < 50) && (beans.size() != 0); i++) {
+            Thread.sleep(100);
+            beans = ensureAll(expectedNames);
+        }
         for (ObjectName bean : beans) {
             LOG.info("unexpected:" + bean.toString());
         }



Mime
View raw message