support catch actual exception (#12446)
This commit is contained in:
parent
c8ef10e8a5
commit
00d8a46cd5
|
|
@ -120,7 +120,6 @@ public class TripleClientStream extends AbstractStream implements ClientStream {
|
|||
Channel channel = ctx.channel();
|
||||
channel.pipeline().addLast(new TripleCommandOutBoundHandler());
|
||||
channel.pipeline().addLast(new TripleHttp2ClientResponseHandler(createTransportListener()));
|
||||
channel.closeFuture().addListener(f -> transportException(f.cause()));
|
||||
}
|
||||
});
|
||||
CreateStreamQueueCommand cmd = CreateStreamQueueCommand.create(bootstrap, streamChannelFuture);
|
||||
|
|
@ -149,7 +148,7 @@ public class TripleClientStream extends AbstractStream implements ClientStream {
|
|||
private void transportException(Throwable cause) {
|
||||
final TriRpcStatus status = TriRpcStatus.INTERNAL.withDescription("Http2 exception")
|
||||
.withCause(cause);
|
||||
listener.onComplete(status, null);
|
||||
listener.onComplete(status, null, null, false);
|
||||
}
|
||||
|
||||
public ChannelFuture cancelByLocal(TriRpcStatus status) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import io.netty.channel.ChannelPromise;
|
|||
import org.apache.dubbo.common.BatchExecutorQueue;
|
||||
import org.apache.dubbo.rpc.protocol.tri.command.QueuedCommand;
|
||||
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class TripleWriteQueue extends BatchExecutorQueue<QueuedCommand> {
|
||||
|
|
@ -55,13 +56,22 @@ public class TripleWriteQueue extends BatchExecutorQueue<QueuedCommand> {
|
|||
|
||||
@Override
|
||||
protected void prepare(QueuedCommand item) {
|
||||
item.run(item.channel());
|
||||
try {
|
||||
Channel channel = item.channel();
|
||||
item.run(channel);
|
||||
} catch (CompletionException e) {
|
||||
item.promise().tryFailure(e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void flush(QueuedCommand item) {
|
||||
Channel channel = item.channel();
|
||||
item.run(channel);
|
||||
channel.flush();
|
||||
try {
|
||||
Channel channel = item.channel();
|
||||
item.run(channel);
|
||||
channel.flush();
|
||||
} catch (CompletionException e) {
|
||||
item.promise().tryFailure(e.getCause());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue