EpollDatagramChannel avoid getOption
Motivation: EpollDatagramChannel uses getOption in the isActive method. getOption is backed by a relatively large conditional if/else if block and this conditional checking can be avoided in the epoll transport. Modifications: - Add EpollDatagramChannelConfig#getActiveOnOpen and use this in EpollDatagramChannel Result: Conditional checking due to getOption is removed from EpollDatagramChannel.
This commit is contained in:
parent
f3dd410142
commit
0befcd8431
@ -21,7 +21,6 @@ import io.netty.buffer.CompositeByteBuf;
|
||||
import io.netty.channel.AddressedEnvelope;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelOutboundBuffer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
@ -105,9 +104,7 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isActive() {
|
||||
return fd().isOpen() &&
|
||||
(config.getOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION) && isRegistered()
|
||||
|| active);
|
||||
return fd().isOpen() && (config.getActiveOnOpen() && isRegistered() || active);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,6 +132,10 @@ public final class EpollDatagramChannelConfig extends EpollChannelConfig impleme
|
||||
this.activeOnOpen = activeOnOpen;
|
||||
}
|
||||
|
||||
boolean getActiveOnOpen() {
|
||||
return activeOnOpen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EpollDatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator) {
|
||||
super.setMessageSizeEstimator(estimator);
|
||||
|
Loading…
Reference in New Issue
Block a user