Repository: incubator-distributedlog
Updated Branches:
  refs/heads/master a31782093 -> 859b342b2


DL-171: adding a short sleep to let the WriteCompleteListener have time to run 
before the final position be requested

once the "writer.write" is done, if "writer.position()" be invoked easier than 
the WriteCompleteListener onSuccess callback, due to the "synchronized", the 
position result will be 0, not the expected 33. we can just add a short sleep 
to avoid this test issue.

Author: xieliang <xieliang...@gmail.com>

Reviewers: Sijie Guo <si...@apache.org>

Closes #98 from xieliang/DL-171-Fix-TestAppendOnlyStreamWriter


Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/859b342b
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/859b342b
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/859b342b

Branch: refs/heads/master
Commit: 859b342b25dcac3cf4c2353c2d2ff4994d4bcaba
Parents: a317820
Author: xieliang <xieliang...@gmail.com>
Authored: Fri Jan 6 16:30:32 2017 -0800
Committer: Sijie Guo <sij...@twitter.com>
Committed: Fri Jan 6 16:30:32 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/859b342b/distributedlog-core/src/test/java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-core/src/test/java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java
 
b/distributedlog-core/src/test/java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java
index d095af1..b5498ba 100644
--- 
a/distributedlog-core/src/test/java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java
+++ 
b/distributedlog-core/src/test/java/org/apache/distributedlog/TestAppendOnlyStreamWriter.java
@@ -189,6 +189,7 @@ public class TestAppendOnlyStreamWriter extends 
TestDistributedLogBase {
         assertEquals(0, writer.position());
 
         Await.result(writer.write(byteStream));
+        Thread.sleep(100); // let WriteCompleteListener have time to run
         assertEquals(33, writer.position());
 
         writer.close();

Reply via email to