Only suppress ClosedChannelExceptions

This commit is contained in:
Dan Mulloy 2015-07-18 21:07:41 -04:00
parent 900b31e0c9
commit ae47ae3b89
2 changed files with 10 additions and 6 deletions

View File

@ -243,6 +243,12 @@
</developers>
<dependencies>
<!-- This is for the JavaDocs
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.28.Final</version>
</dependency> -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>

View File

@ -284,13 +284,11 @@ public class NettyChannelInjector extends ByteToMessageDecoder implements Channe
ChannelHandlerAdapter exceptionHandler = new ChannelHandlerAdapter() {
@Override
public void exceptionCaught(ChannelHandlerContext context, Throwable ex) throws Exception {
if (ex instanceof ClosedChannelException) {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (cause instanceof ClosedChannelException) {
// Ignore
} else {
// TODO Actually handle exceptions?
System.err.println("[ProtocolLib] Encountered an uncaught exception in the channel pipeline:");
ex.printStackTrace();
super.exceptionCaught(ctx, cause);
}
}
};
@ -821,7 +819,7 @@ public class NettyChannelInjector extends ByteToMessageDecoder implements Channe
// we end up with a deadlock. The main thread is waiting for the worker thread to process the task, and
// the worker thread is waiting for the main thread to finish executing PlayerQuitEvent.
//
// TLDR: Concurrency is hard.
// TL;DR: Concurrency is hard.
executeInChannelThread(new Runnable() {
@Override
public void run() {