Github user Randgalt commented on a diff in the pull request:
https://github.com/apache/curator/pull/291#discussion_r240039803
--- Diff:
curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
---
@@ -686,35 +693,66 @@ public void run()
}
else
{
- Assert.fail("unknown exception", e);
+ Assert.fail("unexpected exception", e);
}
}
finally
{
- countDownLatch.countDown();
+ log.info("client has deleted children, it costs:
{}ms", System.currentTimeMillis() - start);
+ latch.countDown();
}
}
}).start();
- Thread.sleep(20L);
- try
- {
- client2.delete().forPath("/parent/child" + (childCount /
2));
- }
- catch ( Exception e )
+ boolean threadDeleted = false;
+ boolean client2Deleted = false;
+ Random random = new Random();
+ for ( int i = 0; i < childCount; i++ )
{
- if ( e instanceof KeeperException.NoNodeException )
+ String child = "/parent/child" +
random.nextInt(childCount);
+ try
{
- Assert.fail("client2 delete failed, shouldn't throw
NoNodeException", e);
+ if ( !threadDeleted )
+ {
+ Stat stat = client2.checkExists().forPath(child);
+ if ( stat == null )
+ {
+ // the thread client has begin deleted the
children
+ threadDeleted = true;
--- End diff --
What's the point of this? Once it is set, checkExists() is never called
again. That seems incorrect. I removed this and the test still passes. Can you
explain?
---