mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -54,7 +54,7 @@ public class ChannelUtil {
|
||||
try {
|
||||
channel.connect(address).get();
|
||||
} catch (final InterruptedException | ExecutionException e) {
|
||||
IoUtil.close(channel);
|
||||
IoUtil.closeQuietly(channel);
|
||||
throw new SocketRuntimeException(e);
|
||||
}
|
||||
return channel;
|
||||
|
@@ -147,7 +147,7 @@ public class AioServer implements Closeable {
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.channel);
|
||||
IoUtil.closeQuietly(this.channel);
|
||||
|
||||
if (null != this.group && false == this.group.isShutdown()) {
|
||||
try {
|
||||
|
@@ -199,7 +199,7 @@ public class AioSession implements Closeable{
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.channel);
|
||||
IoUtil.closeQuietly(this.channel);
|
||||
this.readBuffer = null;
|
||||
this.writeBuffer = null;
|
||||
}
|
||||
|
@@ -161,7 +161,7 @@ public class NioClient implements Closeable {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.selector);
|
||||
IoUtil.close(this.channel);
|
||||
IoUtil.closeQuietly(this.selector);
|
||||
IoUtil.closeQuietly(this.channel);
|
||||
}
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ public class NioServer implements Closeable {
|
||||
try{
|
||||
handler.handle(socketChannel);
|
||||
} catch (final Exception e){
|
||||
IoUtil.close(socketChannel);
|
||||
IoUtil.closeQuietly(socketChannel);
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class NioServer implements Closeable {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.selector);
|
||||
IoUtil.close(this.serverSocketChannel);
|
||||
IoUtil.closeQuietly(this.selector);
|
||||
IoUtil.closeQuietly(this.serverSocketChannel);
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ public class NioServerTest {
|
||||
|
||||
doWrite(sc, body);
|
||||
} else if (readBytes < 0) {
|
||||
IoUtil.close(sc);
|
||||
IoUtil.closeQuietly(sc);
|
||||
}
|
||||
} catch (final IOException e){
|
||||
throw new IORuntimeException(e);
|
||||
|
Reference in New Issue
Block a user