* Better exception handling on bind failure in ServerBootstrap

* Fixed a problem where UnfailingChannelFuture doesn't tell what exception cause the IllegalStateException
This commit is contained in:
Trustin Lee 2009-02-24 04:58:19 +00:00
parent ae22b0aaa1
commit 0c27f015bf
2 changed files with 5 additions and 1 deletions

View File

@ -333,6 +333,10 @@ public class ServerBootstrap extends Bootstrap {
public void exceptionCaught(
ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
System.err.println(e);
e.getCause().printStackTrace();
boolean finished = futureQueue.offer(failedFuture(e.getChannel(), e.getCause()));
assert finished;
ctx.sendUpstream(e);
}
}

View File

@ -48,6 +48,6 @@ public class UnfailingChannelFuture extends DefaultChannelFuture {
@Override
public boolean setFailure(Throwable cause) {
throw new IllegalStateException("Can not fail");
throw new IllegalStateException("Can not fail", cause);
}
}