【发布时间】:2018-06-21 14:18:16
【问题描述】:
我很有趣——我能收到一些关于 GRPC 客户端/服务器的连接/断开事件的通知吗? 现在,当客户端终止与服务器的连接时,我在服务器上遇到异常:
июн 22, 2018 9:34:47 AM io.grpc.netty.NettyServerTransport notifyTerminated
INFO: Transport failed
java.io.IOException: Удаленный хост принудительно разорвал существующее подключение
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1108)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:345)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
异常翻译:“远程主机强行断开现有连接”
我很有趣,如何管理客户端和服务器的连接/断开连接事件?
也许有一些方法可以将我自己的侦听器附加到客户端或服务器?从来源我不知道如何制作它
【问题讨论】:
-
我没有看到任何 exception 列出。我只看到一个日志语句。还有其他记录吗?
-
是的,我在第一篇文章中添加了完整的日志信息。