Repository: incubator-distributedlog
Updated Branches:
  refs/heads/master 74a33029c -> a4999a890


DL-145: the write requests should be error out immediately even if the rolling 
writer still be creating

Passed all test cases locally, now TestDistributedLogService#testServiceTimeout 
case is stable on my box

Author: xieliang <[email protected]>

Reviewers: Sijie Guo <[email protected]>

Closes #78 from xieliang/DL-145


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

Branch: refs/heads/master
Commit: a4999a890173562593313c7ec2d8989113694415
Parents: 74a3302
Author: xieliang <[email protected]>
Authored: Tue Dec 27 08:57:27 2016 -0800
Committer: Sijie Guo <[email protected]>
Committed: Tue Dec 27 08:57:27 2016 -0800

----------------------------------------------------------------------
 .../com/twitter/distributedlog/BKAsyncLogWriter.java  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/a4999a89/distributedlog-core/src/main/java/com/twitter/distributedlog/BKAsyncLogWriter.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-core/src/main/java/com/twitter/distributedlog/BKAsyncLogWriter.java
 
b/distributedlog-core/src/main/java/com/twitter/distributedlog/BKAsyncLogWriter.java
index 79f5f5e..e96b5af 100644
--- 
a/distributedlog-core/src/main/java/com/twitter/distributedlog/BKAsyncLogWriter.java
+++ 
b/distributedlog-core/src/main/java/com/twitter/distributedlog/BKAsyncLogWriter.java
@@ -529,6 +529,20 @@ public class BKAsyncLogWriter extends BKAbstractLogWriter 
implements AsyncLogWri
     }
 
     @Override
+    public Future<Void> asyncAbort() {
+        Future<Void> result = super.asyncAbort();
+        synchronized (this) {
+            if (pendingRequests != null) {
+                for (PendingLogRecord pendingLogRecord : pendingRequests) {
+                    pendingLogRecord.promise.setException(new 
WriteException(bkDistributedLogManager.getStreamName(),
+                            "abort wring: writer has been closed due to 
error."));
+                }
+            }
+        }
+        return result;
+    }
+
+    @Override
     public String toString() {
         return String.format("AsyncLogWriter:%s", getStreamName());
     }

Reply via email to