[
https://issues.apache.org/jira/browse/RATIS-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17231107#comment-17231107
]
runzhiwang commented on RATIS-1150:
-----------------------------------
Sure, thanks a lot.
> Return exception of WritableByteChannel#write to client.
> --------------------------------------------------------
>
> Key: RATIS-1150
> URL: https://issues.apache.org/jira/browse/RATIS-1150
> Project: Ratis
> Issue Type: Sub-task
> Reporter: runzhiwang
> Assignee: runzhiwang
> Priority: Major
> Attachments: image-2020-11-13-09-15-38-822.png, screenshot-1.png
>
>
> When primary or peer WritableByteChannel#write throw exception, we should
> return it to client.
> {code:java}
> static long writeTo(ByteBuf buf, DataStream stream) {
> final WritableByteChannel channel = stream.getWritableByteChannel();
> long byteWritten = 0;
> for (ByteBuffer buffer : buf.nioBuffers()) {
> try {
> byteWritten += channel.write(buffer);
> } catch (Throwable t) {
> throw new CompletionException(t);
> }
> }
> return byteWritten;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)