Add new ChanelFuureListener impl that mimic the old behavior of Netty 3 and so allow to also call fireException for outbound operations

This commit is contained in:
Norman Maurer 2012-12-31 16:17:08 +01:00
parent 1e9652b47a
commit 8cf9f52919

View File

@ -56,6 +56,19 @@ public interface ChannelFutureListener extends EventListener {
} }
}; };
/**
* A {@link ChannelFutureListener} that forwards the {@link Throwable} of the {@link ChannelFuture} into the
* {@link ChannelPipeline}. This mimics the old behavior of Netty 3.
*/
ChannelFutureListener FIRE_EXCEPTION_ON_FAILURE = new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (!future.isSuccess()) {
future.channel().pipeline().fireExceptionCaught(future.cause());
}
}
};
/** /**
* Invoked when the I/O operation associated with the {@link ChannelFuture} * Invoked when the I/O operation associated with the {@link ChannelFuture}
* has been completed. * has been completed.