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> </developers>
<dependencies> <dependencies>
<!-- This is for the JavaDocs
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.28.Final</version>
</dependency> -->
<dependency> <dependency>
<groupId>cglib</groupId> <groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId> <artifactId>cglib-nodep</artifactId>

View File

@ -284,13 +284,11 @@ public class NettyChannelInjector extends ByteToMessageDecoder implements Channe
ChannelHandlerAdapter exceptionHandler = new ChannelHandlerAdapter() { ChannelHandlerAdapter exceptionHandler = new ChannelHandlerAdapter() {
@Override @Override
public void exceptionCaught(ChannelHandlerContext context, Throwable ex) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (ex instanceof ClosedChannelException) { if (cause instanceof ClosedChannelException) {
// Ignore // Ignore
} else { } else {
// TODO Actually handle exceptions? super.exceptionCaught(ctx, cause);
System.err.println("[ProtocolLib] Encountered an uncaught exception in the channel pipeline:");
ex.printStackTrace();
} }
} }
}; };
@ -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 // 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. // 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() { executeInChannelThread(new Runnable() {
@Override @Override
public void run() { public void run() {