Package io.netty.channel.epoll
Class EpollDatagramChannelConfig
- java.lang.Object
-
- io.netty.channel.DefaultChannelConfig
-
- io.netty.channel.epoll.EpollChannelConfig
-
- io.netty.channel.epoll.EpollDatagramChannelConfig
-
- All Implemented Interfaces:
ChannelConfig,DatagramChannelConfig
public final class EpollDatagramChannelConfig extends EpollChannelConfig implements DatagramChannelConfig
-
-
Field Summary
-
Fields inherited from class io.netty.channel.DefaultChannelConfig
channel
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.net.InetAddressgetInterface()Gets the address of the network interface used for multicast packets.intgetMaxDatagramPayloadSize()Get the maximumDatagramPacketsize.java.net.NetworkInterfacegetNetworkInterface()Gets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> TgetOption(ChannelOption<T> option)Return the value of the givenChannelOptionjava.util.Map<ChannelOption<?>,java.lang.Object>getOptions()Return all setChannelOption's.intgetReceiveBufferSize()Gets theStandardSocketOptions.SO_RCVBUFoption.intgetSendBufferSize()Gets theStandardSocketOptions.SO_SNDBUFoption.intgetTimeToLive()Gets theStandardSocketOptions.IP_MULTICAST_TTLoption.intgetTrafficClass()Gets theStandardSocketOptions.IP_TOSoption.booleanisBroadcast()Gets theStandardSocketOptions.SO_BROADCASToption.booleanisFreeBind()booleanisIpRecvOrigDestAddr()booleanisIpTransparent()booleanisLoopbackModeDisabled()Gets theStandardSocketOptions.IP_MULTICAST_LOOPoption.booleanisReuseAddress()Gets theStandardSocketOptions.SO_REUSEADDRoption.booleanisReusePort()Returnstrueif the SO_REUSEPORT option is set.booleanisUdpGro()Returns ifUDP_GROis enabled.EpollDatagramChannelConfigsetAllocator(ByteBufAllocator allocator)Set theByteBufAllocatorwhich is used for the channel to allocate buffers.EpollDatagramChannelConfigsetAutoClose(boolean autoClose)Sets whether theChannelshould be closed automatically and immediately on write failure.EpollDatagramChannelConfigsetAutoRead(boolean autoRead)Sets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all.EpollDatagramChannelConfigsetBroadcast(boolean broadcast)Sets theStandardSocketOptions.SO_BROADCASToption.EpollDatagramChannelConfigsetConnectTimeoutMillis(int connectTimeoutMillis)Sets the connect timeout of the channel in milliseconds.EpollDatagramChannelConfigsetEpollMode(EpollMode mode)Set theEpollModeused.EpollDatagramChannelConfigsetFreeBind(boolean freeBind)EpollDatagramChannelConfigsetInterface(java.net.InetAddress interfaceAddress)Sets the address of the network interface used for multicast packets.EpollDatagramChannelConfigsetIpRecvOrigDestAddr(boolean ipTransparent)EpollDatagramChannelConfigsetIpTransparent(boolean ipTransparent)DatagramChannelConfigsetLoopbackModeDisabled(boolean loopbackModeDisabled)Sets theStandardSocketOptions.IP_MULTICAST_LOOPoption.EpollDatagramChannelConfigsetMaxDatagramPayloadSize(int maxDatagramSize)Set the maximumDatagramPacketsize.EpollDatagramChannelConfigsetMaxMessagesPerRead(int maxMessagesPerRead)Deprecated.EpollDatagramChannelConfigsetMaxMessagesPerWrite(int maxMessagesPerWrite)Set the maximum number of message to write per eventloop run.EpollDatagramChannelConfigsetMessageSizeEstimator(MessageSizeEstimator estimator)Set theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.EpollDatagramChannelConfigsetNetworkInterface(java.net.NetworkInterface networkInterface)Sets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> booleansetOption(ChannelOption<T> option, T value)Sets a configuration property with the specified name and value.EpollDatagramChannelConfigsetReceiveBufferSize(int receiveBufferSize)Sets theStandardSocketOptions.SO_RCVBUFoption.EpollDatagramChannelConfigsetRecvByteBufAllocator(RecvByteBufAllocator allocator)Set theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.EpollDatagramChannelConfigsetReuseAddress(boolean reuseAddress)Gets theStandardSocketOptions.SO_REUSEADDRoption.EpollDatagramChannelConfigsetReusePort(boolean reusePort)Set the SO_REUSEPORT option on the underlying Channel.EpollDatagramChannelConfigsetSendBufferSize(int sendBufferSize)Sets theStandardSocketOptions.SO_SNDBUFoption.EpollDatagramChannelConfigsetTimeToLive(int ttl)Sets theStandardSocketOptions.IP_MULTICAST_TTLoption.EpollDatagramChannelConfigsetTrafficClass(int trafficClass)Sets theStandardSocketOptions.IP_TOSoption.EpollDatagramChannelConfigsetUdpGro(boolean gro)Enable / disable UDP_GRO.EpollDatagramChannelConfigsetWriteBufferHighWaterMark(int writeBufferHighWaterMark)Deprecated.EpollDatagramChannelConfigsetWriteBufferLowWaterMark(int writeBufferLowWaterMark)Deprecated.EpollDatagramChannelConfigsetWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)Set theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.EpollDatagramChannelConfigsetWriteSpinCount(int writeSpinCount)Sets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.-
Methods inherited from class io.netty.channel.epoll.EpollChannelConfig
autoReadCleared, getEpollMode, getMaxBytesPerGatheringWrite, setMaxBytesPerGatheringWrite, socket
-
Methods inherited from class io.netty.channel.DefaultChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMaxMessagesPerWrite, getMessageSizeEstimator, getOptions, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMessageSizeEstimator, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions
-
-
-
-
Method Detail
-
getOptions
public java.util.Map<ChannelOption<?>,java.lang.Object> getOptions()
Description copied from interface:ChannelConfigReturn all setChannelOption's.- Specified by:
getOptionsin interfaceChannelConfig- Overrides:
getOptionsin classEpollChannelConfig
-
getOption
public <T> T getOption(ChannelOption<T> option)
Description copied from interface:ChannelConfigReturn the value of the givenChannelOption- Specified by:
getOptionin interfaceChannelConfig- Overrides:
getOptionin classEpollChannelConfig
-
setOption
public <T> boolean setOption(ChannelOption<T> option, T value)
Description copied from interface:ChannelConfigSets a configuration property with the specified name and value. To override this method properly, you must call the super class:public boolean setOption(ChannelOption<T> option, T value) { if (super.setOption(option, value)) { return true; } if (option.equals(additionalOption)) { .... return true; } return false; }- Specified by:
setOptionin interfaceChannelConfig- Overrides:
setOptionin classEpollChannelConfig- Returns:
trueif and only if the property has been set
-
setMessageSizeEstimator
public EpollDatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator)
Description copied from interface:ChannelConfigSet theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.- Specified by:
setMessageSizeEstimatorin interfaceChannelConfig- Specified by:
setMessageSizeEstimatorin interfaceDatagramChannelConfig- Overrides:
setMessageSizeEstimatorin classEpollChannelConfig
-
setWriteBufferLowWaterMark
@Deprecated public EpollDatagramChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
Deprecated.Description copied from interface:ChannelConfigSets the low water mark of the write buffer. Once the number of bytes queued in the write buffer exceeded the high water mark and then dropped down below this value,
Channel.isWritable()will start to returntrueagain.- Specified by:
setWriteBufferLowWaterMarkin interfaceChannelConfig- Overrides:
setWriteBufferLowWaterMarkin classEpollChannelConfig
-
setWriteBufferHighWaterMark
@Deprecated public EpollDatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
Deprecated.Description copied from interface:ChannelConfigSets the high water mark of the write buffer. If the number of bytes queued in the write buffer exceeds this value,
Channel.isWritable()will start to returnfalse.- Specified by:
setWriteBufferHighWaterMarkin interfaceChannelConfig- Overrides:
setWriteBufferHighWaterMarkin classEpollChannelConfig
-
setWriteBufferWaterMark
public EpollDatagramChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)
Description copied from interface:ChannelConfigSet theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.- Specified by:
setWriteBufferWaterMarkin interfaceChannelConfig- Specified by:
setWriteBufferWaterMarkin interfaceDatagramChannelConfig- Overrides:
setWriteBufferWaterMarkin classEpollChannelConfig
-
setAutoClose
public EpollDatagramChannelConfig setAutoClose(boolean autoClose)
Description copied from interface:ChannelConfigSets whether theChannelshould be closed automatically and immediately on write failure. The default istrue.- Specified by:
setAutoClosein interfaceChannelConfig- Specified by:
setAutoClosein interfaceDatagramChannelConfig- Overrides:
setAutoClosein classDefaultChannelConfig
-
setAutoRead
public EpollDatagramChannelConfig setAutoRead(boolean autoRead)
Description copied from interface:ChannelConfigSets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all. The default value istrue.- Specified by:
setAutoReadin interfaceChannelConfig- Specified by:
setAutoReadin interfaceDatagramChannelConfig- Overrides:
setAutoReadin classEpollChannelConfig
-
setRecvByteBufAllocator
public EpollDatagramChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator)
Description copied from interface:ChannelConfigSet theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.- Specified by:
setRecvByteBufAllocatorin interfaceChannelConfig- Specified by:
setRecvByteBufAllocatorin interfaceDatagramChannelConfig- Overrides:
setRecvByteBufAllocatorin classEpollChannelConfig
-
setWriteSpinCount
public EpollDatagramChannelConfig setWriteSpinCount(int writeSpinCount)
Description copied from interface:ChannelConfigSets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value. It is similar to what a spin lock is used for in concurrency programming. It improves memory utilization and write throughput depending on the platform that JVM runs on. The default value is16.- Specified by:
setWriteSpinCountin interfaceChannelConfig- Specified by:
setWriteSpinCountin interfaceDatagramChannelConfig- Overrides:
setWriteSpinCountin classEpollChannelConfig
-
setAllocator
public EpollDatagramChannelConfig setAllocator(ByteBufAllocator allocator)
Description copied from interface:ChannelConfigSet theByteBufAllocatorwhich is used for the channel to allocate buffers.- Specified by:
setAllocatorin interfaceChannelConfig- Specified by:
setAllocatorin interfaceDatagramChannelConfig- Overrides:
setAllocatorin classEpollChannelConfig
-
setConnectTimeoutMillis
public EpollDatagramChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis)
Description copied from interface:ChannelConfigSets the connect timeout of the channel in milliseconds. If theChanneldoes not support connect operation, this property is not used at all, and therefore will be ignored.- Specified by:
setConnectTimeoutMillisin interfaceChannelConfig- Specified by:
setConnectTimeoutMillisin interfaceDatagramChannelConfig- Overrides:
setConnectTimeoutMillisin classEpollChannelConfig- Parameters:
connectTimeoutMillis- the connect timeout in milliseconds.0to disable.
-
setMaxMessagesPerRead
@Deprecated public EpollDatagramChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead)
Deprecated.Description copied from class:DefaultChannelConfig- Specified by:
setMaxMessagesPerReadin interfaceChannelConfig- Specified by:
setMaxMessagesPerReadin interfaceDatagramChannelConfig- Overrides:
setMaxMessagesPerReadin classEpollChannelConfig
-
getSendBufferSize
public int getSendBufferSize()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_SNDBUFoption.- Specified by:
getSendBufferSizein interfaceDatagramChannelConfig
-
setSendBufferSize
public EpollDatagramChannelConfig setSendBufferSize(int sendBufferSize)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_SNDBUFoption.- Specified by:
setSendBufferSizein interfaceDatagramChannelConfig
-
getReceiveBufferSize
public int getReceiveBufferSize()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_RCVBUFoption.- Specified by:
getReceiveBufferSizein interfaceDatagramChannelConfig
-
setReceiveBufferSize
public EpollDatagramChannelConfig setReceiveBufferSize(int receiveBufferSize)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_RCVBUFoption.- Specified by:
setReceiveBufferSizein interfaceDatagramChannelConfig
-
getTrafficClass
public int getTrafficClass()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_TOSoption.- Specified by:
getTrafficClassin interfaceDatagramChannelConfig
-
setTrafficClass
public EpollDatagramChannelConfig setTrafficClass(int trafficClass)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_TOSoption.- Specified by:
setTrafficClassin interfaceDatagramChannelConfig
-
isReuseAddress
public boolean isReuseAddress()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_REUSEADDRoption.- Specified by:
isReuseAddressin interfaceDatagramChannelConfig
-
setReuseAddress
public EpollDatagramChannelConfig setReuseAddress(boolean reuseAddress)
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_REUSEADDRoption.- Specified by:
setReuseAddressin interfaceDatagramChannelConfig
-
isBroadcast
public boolean isBroadcast()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_BROADCASToption.- Specified by:
isBroadcastin interfaceDatagramChannelConfig
-
setBroadcast
public EpollDatagramChannelConfig setBroadcast(boolean broadcast)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_BROADCASToption.- Specified by:
setBroadcastin interfaceDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
isLoopbackModeDisabledin interfaceDatagramChannelConfig- Returns:
trueif and only if the loopback mode has been disabled
-
setLoopbackModeDisabled
public DatagramChannelConfig setLoopbackModeDisabled(boolean loopbackModeDisabled)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
setLoopbackModeDisabledin interfaceDatagramChannelConfig- Parameters:
loopbackModeDisabled-trueif and only if the loopback mode has been disabled
-
getTimeToLive
public int getTimeToLive()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
getTimeToLivein interfaceDatagramChannelConfig
-
setTimeToLive
public EpollDatagramChannelConfig setTimeToLive(int ttl)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
setTimeToLivein interfaceDatagramChannelConfig
-
getInterface
public java.net.InetAddress getInterface()
Description copied from interface:DatagramChannelConfigGets the address of the network interface used for multicast packets.- Specified by:
getInterfacein interfaceDatagramChannelConfig
-
setInterface
public EpollDatagramChannelConfig setInterface(java.net.InetAddress interfaceAddress)
Description copied from interface:DatagramChannelConfigSets the address of the network interface used for multicast packets.- Specified by:
setInterfacein interfaceDatagramChannelConfig
-
getNetworkInterface
public java.net.NetworkInterface getNetworkInterface()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
getNetworkInterfacein interfaceDatagramChannelConfig
-
setNetworkInterface
public EpollDatagramChannelConfig setNetworkInterface(java.net.NetworkInterface networkInterface)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
setNetworkInterfacein interfaceDatagramChannelConfig
-
setEpollMode
public EpollDatagramChannelConfig setEpollMode(EpollMode mode)
Description copied from class:EpollChannelConfigSet theEpollModeused. Default isEpollMode.EDGE_TRIGGERED. If you want to useDefaultChannelConfig.isAutoRead()falseorDefaultChannelConfig.getMaxMessagesPerRead()and have an accurate behaviour you should useEpollMode.LEVEL_TRIGGERED. Be aware this config setting can only be adjusted before the channel was registered.- Overrides:
setEpollModein classEpollChannelConfig
-
isReusePort
public boolean isReusePort()
Returnstrueif the SO_REUSEPORT option is set.
-
setReusePort
public EpollDatagramChannelConfig setReusePort(boolean reusePort)
Set the SO_REUSEPORT option on the underlying Channel. This will allow to bind multipleEpollSocketChannels to the same port and so accept connections with multiple threads. Be aware this method needs be called beforeChannel.bind(java.net.SocketAddress)to have any affect.
-
isIpTransparent
public boolean isIpTransparent()
-
setIpTransparent
public EpollDatagramChannelConfig setIpTransparent(boolean ipTransparent)
-
isFreeBind
public boolean isFreeBind()
-
setFreeBind
public EpollDatagramChannelConfig setFreeBind(boolean freeBind)
-
isIpRecvOrigDestAddr
public boolean isIpRecvOrigDestAddr()
-
setIpRecvOrigDestAddr
public EpollDatagramChannelConfig setIpRecvOrigDestAddr(boolean ipTransparent)
-
setMaxDatagramPayloadSize
public EpollDatagramChannelConfig setMaxDatagramPayloadSize(int maxDatagramSize)
Set the maximumDatagramPacketsize. This will be used to determine ifrecvmmsgshould be used when reading from the underlying socket. Whenrecvmmsgis used we may be able to read multipleDatagramPackets with one syscall and so greatly improve the performance. This number will be used to sliceByteBufs returned by the usedRecvByteBufAllocator. You can use0to disable the usage of recvmmsg, any other bigger value will enable it.
-
getMaxDatagramPayloadSize
public int getMaxDatagramPayloadSize()
Get the maximumDatagramPacketsize.
-
setUdpGro
public EpollDatagramChannelConfig setUdpGro(boolean gro)
Enable / disable UDP_GRO.- Parameters:
gro-trueifUDP_GROshould be enabled,falseotherwise.- Returns:
- this.
-
isUdpGro
public boolean isUdpGro()
Returns ifUDP_GROis enabled.- Returns:
trueif enabled,falseotherwise.
-
setMaxMessagesPerWrite
public EpollDatagramChannelConfig setMaxMessagesPerWrite(int maxMessagesPerWrite)
Description copied from class:DefaultChannelConfigSet the maximum number of message to write per eventloop run. Once this limit is reached we will continue to process other events before trying to write the remaining messages.- Overrides:
setMaxMessagesPerWritein classDefaultChannelConfig
-
-