Skip to content

Commit

Permalink
Ignore ClosedChannelException.
Browse files Browse the repository at this point in the history
Closes ratpack#917.
  • Loading branch information
ldaley committed Mar 22, 2016
1 parent 21bc2c6 commit de9acd1
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.CharBuffer;
import java.nio.channels.ClosedChannelException;
import java.time.Instant;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -207,8 +208,10 @@ public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exceptio
}

private boolean isIgnorableException(Throwable throwable) {
// There really does not seem to be a better way of detecting this kind of exception
if (throwable instanceof IOException) {
if (throwable instanceof ClosedChannelException) {
return true;
} else if (throwable instanceof IOException) {
// There really does not seem to be a better way of detecting this kind of exception
String message = throwable.getMessage();
return message != null && message.endsWith("Connection reset by peer");
} else {
Expand Down

0 comments on commit de9acd1

Please sign in to comment.