You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "runzhiwang (Jira)" <ji...@apache.org> on 2020/11/13 02:29:00 UTC

[jira] [Updated] (RATIS-1150) Return DataStreamException to client.

     [ https://issues.apache.org/jira/browse/RATIS-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

runzhiwang updated RATIS-1150:
------------------------------
    Summary: Return DataStreamException to client.  (was: Return exception of WritableByteChannel#write to client.)

> Return DataStreamException 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)