mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
将接口抛出的Exception改为Throwable,扩大适用范围,避免尴尬情况;
This commit is contained in:
@@ -27,5 +27,5 @@ public interface ChannelHandler {
|
||||
* @param socketChannel {@link SocketChannel}
|
||||
* @throws Exception 可能的处理异常
|
||||
*/
|
||||
void handle(SocketChannel socketChannel) throws Exception;
|
||||
void handle(SocketChannel socketChannel) throws Throwable;
|
||||
}
|
||||
|
@@ -139,7 +139,7 @@ public class NioClient implements Closeable {
|
||||
final SocketChannel socketChannel = (SocketChannel) key.channel();
|
||||
try{
|
||||
handler.handle(socketChannel);
|
||||
} catch (final Exception e){
|
||||
} catch (final Throwable e){
|
||||
throw new SocketRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ public class NioServer implements Closeable {
|
||||
final SocketChannel socketChannel = (SocketChannel) key.channel();
|
||||
try{
|
||||
handler.handle(socketChannel);
|
||||
} catch (final Exception e){
|
||||
} catch (final Throwable e){
|
||||
IoUtil.closeQuietly(socketChannel);
|
||||
log.error(e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user