Converted an inner class to a nested class

This commit is contained in:
Trustin Lee 2009-04-15 23:49:26 +00:00
parent 5127313e97
commit f2f09e66aa

View File

@ -806,13 +806,8 @@ public class SslHandler extends FrameDecoder {
if (sentCloseNotify.compareAndSet(false, true)) { if (sentCloseNotify.compareAndSet(false, true)) {
engine.closeOutbound(); engine.closeOutbound();
ChannelFuture closeNotifyFuture = wrapNonAppData(context, e.getChannel()); ChannelFuture closeNotifyFuture = wrapNonAppData(context, e.getChannel());
closeNotifyFuture.addListener(new ChannelFutureListener() { closeNotifyFuture.addListener(
public void operationComplete(ChannelFuture closeNotifyFuture) throws Exception { new ClosingChannelFutureListener(context, e));
if (!(closeNotifyFuture.getCause() instanceof ClosedChannelException)) {
Channels.close(context, e.getFuture());
}
}
});
return; return;
} }
} }
@ -842,4 +837,22 @@ public class SslHandler extends FrameDecoder {
this.outAppBuf = outAppBuf; this.outAppBuf = outAppBuf;
} }
} }
private static final class ClosingChannelFutureListener implements ChannelFutureListener {
private final ChannelHandlerContext context;
private final ChannelStateEvent e;
ClosingChannelFutureListener(
ChannelHandlerContext context, ChannelStateEvent e) {
this.context = context;
this.e = e;
}
public void operationComplete(ChannelFuture closeNotifyFuture) throws Exception {
if (!(closeNotifyFuture.getCause() instanceof ClosedChannelException)) {
Channels.close(context, e.getFuture());
}
}
}
} }