Commit ea7a2c5e authored by Flavio Paiva Junqueira's avatar Flavio Paiva Junqueira
Browse files

ZOOKEEPER-1837. Fix JMXEnv checks (potential race conditions) (Germán Blanco via fpj)


git-svn-id: https://svn.apache.org/repos/asf/zookeeper/branches/branch-3.4@1550923 13f79535-47bb-0310-9956-ffa450edef68
parent 592643e1
......@@ -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
......
......@@ -188,14 +188,13 @@ public abstract class ClientBase extends ZKTestCase {
}
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;
}
......
......@@ -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());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment