Do not use finally to propagate events in AbstractRemoteAddressFilter
Motivation: We don't really need to propagate an event when handling the event fails. Modifications: Do not use finally block in AbstractRemoteAddressFilter Result: AbstractRemoteaddressFilter does not forward an event in case of failure.
This commit is contained in:
parent
fddbde7df2
commit
614dc72b56
@ -39,20 +39,15 @@ public abstract class AbstractRemoteAddressFilter<T extends SocketAddress> exten
|
||||
|
||||
@Override
|
||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||
try {
|
||||
handleNewChannel(ctx);
|
||||
} finally {
|
||||
ctx.fireChannelRegistered();
|
||||
}
|
||||
handleNewChannel(ctx);
|
||||
ctx.fireChannelRegistered();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
try {
|
||||
if (!handleNewChannel(ctx)) {
|
||||
throw new IllegalStateException("cannot determine to accept or reject a channel: " + ctx.channel());
|
||||
}
|
||||
} finally {
|
||||
if (!handleNewChannel(ctx)) {
|
||||
throw new IllegalStateException("cannot determine to accept or reject a channel: " + ctx.channel());
|
||||
} else {
|
||||
ctx.fireChannelActive();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user