You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@distributedlog.apache.org by si...@apache.org on 2017/01/07 00:30:35 UTC

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

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 <xi...@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 <xi...@gmail.com>
Authored: Fri Jan 6 16:30:32 2017 -0800
Committer: Sijie Guo <si...@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();