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
|
@Override
|
||||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||||
try {
|
|
||||||
handleNewChannel(ctx);
|
handleNewChannel(ctx);
|
||||||
} finally {
|
|
||||||
ctx.fireChannelRegistered();
|
ctx.fireChannelRegistered();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
try {
|
|
||||||
if (!handleNewChannel(ctx)) {
|
if (!handleNewChannel(ctx)) {
|
||||||
throw new IllegalStateException("cannot determine to accept or reject a channel: " + ctx.channel());
|
throw new IllegalStateException("cannot determine to accept or reject a channel: " + ctx.channel());
|
||||||
}
|
} else {
|
||||||
} finally {
|
|
||||||
ctx.fireChannelActive();
|
ctx.fireChannelActive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user