[
https://issues.apache.org/jira/browse/RATIS-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17230496#comment-17230496
]
Tsz-wo Sze commented on RATIS-1150:
-----------------------------------
We should have a general approach to handle all the uncaught exceptions. Netty
ChannelInboundHandler has
https://netty.io/4.1/api/io/netty/channel/ChannelInboundHandler.html#exceptionCaught-io.netty.channel.ChannelHandlerContext-java.lang.Throwable-
{code}
void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws
Exception
{code}
We should should use it.
> 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
>
> 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)