@@ -0,0 +1,1011 @@
+/**%0A * %0A */%0Apackage cn.strong.fastdfs.client.handler;%0A%0Aimport io.netty.channel.ChannelHandlerContext;%0Aimport io.netty.channel.ChannelInboundHandlerAdapter;%0Aimport io.netty.handler.timeout.IdleStateEvent;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport cn.strong.fastdfs.ex.FastdfsTimeoutException;%0A%0A/**%0A * %E9%93%BE%E6%8E%A5%E5%AE%88%E6%8A%A4%E5%A4%84%E7%90%86%E5%99%A8%0A * %0A * @author liulongbiao%0A *%0A */%0Apublic class ConnectionWatchdog extends ChannelInboundHandlerAdapter %7B%0A%09private final Logger LOG = LoggerFactory.getLogger(ConnectionWatchdog.class);%0A%0A%09@Override%0A%09public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception %7B%0A%09%09if (evt instanceof IdleStateEvent) %7B%0A%09%09%09throw new FastdfsTimeoutException(%22channel was idle for maxIdleSeconds%22);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception %7B%0A%09%09if (cause instanceof FastdfsTimeoutException) %7B%0A%09%09%09LOG.info(cause.getMessage(), cause);%0A%09%09%7D else %7B%0A%09%09%09LOG.error(cause.getMessage(), cause);%0A%09%09%7D%0A%09%09ctx.close();%0A%09%7D%0A%7D%0A

add ConnectionWatchdog