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 DefaultChannelConfig
channel -
Method Summary
Modifier and TypeMethodDescriptionGets the address of the network interface used for multicast packets.intGet the maximumDatagramPacketsize.Gets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> TgetOption(ChannelOption<T> option) Return the value of the givenChannelOptionMap<ChannelOption<?>, Object> Return all setChannelOption's.intGets theStandardSocketOptions.SO_RCVBUFoption.intGets theStandardSocketOptions.SO_SNDBUFoption.intGets theStandardSocketOptions.IP_MULTICAST_TTLoption.intGets theStandardSocketOptions.IP_TOSoption.booleanGets theStandardSocketOptions.SO_BROADCASToption.booleanbooleanbooleanbooleanbooleanGets theStandardSocketOptions.IP_MULTICAST_LOOPoption.booleanGets theStandardSocketOptions.SO_REUSEADDRoption.booleanReturnstrueif the SO_REUSEPORT option is set.booleanisUdpGro()Returns ifUDP_GROis enabled.setAllocator(ByteBufAllocator allocator) Set theByteBufAllocatorwhich is used for the channel to allocate buffers.setAutoClose(boolean autoClose) Sets whether theChannelshould be closed automatically and immediately on write failure.setAutoRead(boolean autoRead) Sets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all.setBroadcast(boolean broadcast) Sets theStandardSocketOptions.SO_BROADCASToption.setConnectTimeoutMillis(int connectTimeoutMillis) Sets the connect timeout of the channel in milliseconds.setEpollMode(EpollMode mode) Set theEpollModeused.setFreeBind(boolean freeBind) setInterface(InetAddress interfaceAddress) Sets the address of the network interface used for multicast packets.setIpMulticastAll(boolean multicastAll) setIpRecvOrigDestAddr(boolean ipTransparent) setIpTransparent(boolean ipTransparent) setLoopbackModeDisabled(boolean loopbackModeDisabled) Sets theStandardSocketOptions.IP_MULTICAST_LOOPoption.setMaxDatagramPayloadSize(int maxDatagramSize) Set the maximumDatagramPacketsize.setMaxMessagesPerRead(int maxMessagesPerRead) Deprecated.setMaxMessagesPerWrite(int maxMessagesPerWrite) Set the maximum number of message to write per eventloop run.setMessageSizeEstimator(MessageSizeEstimator estimator) Set theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.setNetworkInterface(NetworkInterface networkInterface) Sets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> booleansetOption(ChannelOption<T> option, T value) Sets a configuration property with the specified name and value.setReceiveBufferSize(int receiveBufferSize) Sets theStandardSocketOptions.SO_RCVBUFoption.setRecvByteBufAllocator(RecvByteBufAllocator allocator) Set theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.setReuseAddress(boolean reuseAddress) Gets theStandardSocketOptions.SO_REUSEADDRoption.setReusePort(boolean reusePort) Set the SO_REUSEPORT option on the underlying Channel.setSendBufferSize(int sendBufferSize) Sets theStandardSocketOptions.SO_SNDBUFoption.setTimeToLive(int ttl) Sets theStandardSocketOptions.IP_MULTICAST_TTLoption.setTrafficClass(int trafficClass) Sets theStandardSocketOptions.IP_TOSoption.setUdpGro(boolean gro) Enable / disable UDP_GRO.setWriteBufferHighWaterMark(int writeBufferHighWaterMark) Deprecated.setWriteBufferLowWaterMark(int writeBufferLowWaterMark) Deprecated.setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark) Set theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.setWriteSpinCount(int writeSpinCount) Sets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.Methods inherited from class EpollChannelConfig
autoReadCleared, getEpollMode, getMaxBytesPerGatheringWrite, setMaxBytesPerGatheringWrite, socketMethods inherited from class DefaultChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMaxMessagesPerWrite, getMessageSizeEstimator, getOptions, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions, validate
-
Method Details
-
getOptions
Description copied from interface:ChannelConfigReturn all setChannelOption's.- Specified by:
getOptionsin interfaceChannelConfig- Overrides:
getOptionsin classEpollChannelConfig
-
getOption
Description copied from interface:ChannelConfigReturn the value of the givenChannelOption- Specified by:
getOptionin interfaceChannelConfig- Overrides:
getOptionin classEpollChannelConfig
-
setOption
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
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
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
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
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
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
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
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.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
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
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
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
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
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
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
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
setTimeToLivein interfaceDatagramChannelConfig
-
getInterface
Description copied from interface:DatagramChannelConfigGets the address of the network interface used for multicast packets.- Specified by:
getInterfacein interfaceDatagramChannelConfig
-
setInterface
Description copied from interface:DatagramChannelConfigSets the address of the network interface used for multicast packets.- Specified by:
setInterfacein interfaceDatagramChannelConfig
-
getNetworkInterface
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
getNetworkInterfacein interfaceDatagramChannelConfig
-
setNetworkInterface
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
setNetworkInterfacein interfaceDatagramChannelConfig
-
setEpollMode
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
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
-
isFreeBind
public boolean isFreeBind() -
setFreeBind
-
isIpRecvOrigDestAddr
public boolean isIpRecvOrigDestAddr() -
setIpRecvOrigDestAddr
-
isIpMulticastAll
public boolean isIpMulticastAll() -
setIpMulticastAll
Iftrueis used IP_MULTICAST_ALL is enabled (or IPV6_MULTICAST_ALL for IPV6),falsefor disable it. Default is enabled. -
setMaxDatagramPayloadSize
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
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
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
-