Top Description Fields Constructors Methods
io.netty.channel.socket

public Class DefaultDatagramChannelConfig

extends DefaultChannelConfig
implements DatagramChannelConfig
Class Inheritance
All Implemented Interfaces
io.netty.channel.socket.DatagramChannelConfig, io.netty.channel.ChannelConfig
Known Direct Subclasses
io.netty.channel.socket.nio.NioDatagramChannelConfig, io.netty.channel.socket.oio.DefaultOioDatagramChannelConfig
Imports
io.netty.buffer.ByteBufAllocator, io.netty.channel.ChannelException, .ChannelOption, .DefaultChannelConfig, .FixedRecvByteBufAllocator, .MessageSizeEstimator, .RecvByteBufAllocator, .WriteBufferWaterMark, io.netty.util.internal.ObjectUtil, .PlatformDependent, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, java.net.DatagramSocket, .InetAddress, .MulticastSocket, .NetworkInterface, .SocketException, java.util.Map

The default DatagramChannelConfig implementation.

Field Summary

Modifier and TypeField and Description
private volatile boolean
private final DatagramSocket
private static final InternalLogger
Inherited from io.netty.channel.DefaultChannelConfig:
channel

Constructor Summary

AccessConstructor and Description
public
DefaultDatagramChannelConfig(DatagramChannel channel, DatagramSocket javaSocket)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public InetAddress
getInterface()

Implements io.netty.channel.socket.DatagramChannelConfig.getInterface.

Gets the address of the network interface used for multicast packets.
public NetworkInterface
public <T> T
public Map<ChannelOption<?>, Object>
public int
public int
public int
public int
public boolean
public boolean
public boolean
protected final DatagramSocket
private void
setActiveOnOpen(boolean activeOnOpen)

public DatagramChannelConfig
public DatagramChannelConfig
setAutoClose(boolean autoClose)

Overrides io.netty.channel.DefaultChannelConfig.setAutoClose.

Implements io.netty.channel.socket.DatagramChannelConfig.setAutoClose, io.netty.channel.ChannelConfig.setAutoClose.

Sets whether the Channel should be closed automatically and immediately on write failure.
public DatagramChannelConfig
setAutoRead(boolean autoRead)

Overrides io.netty.channel.DefaultChannelConfig.setAutoRead.

Implements io.netty.channel.socket.DatagramChannelConfig.setAutoRead, io.netty.channel.ChannelConfig.setAutoRead.

Sets if ChannelHandlerContext#read() will be invoked automatically so that a user application doesn't need to call it at all.
public DatagramChannelConfig
public DatagramChannelConfig
setConnectTimeoutMillis(int
the connect timeout in milliseconds. 0 to disable.
connectTimeoutMillis
)

Overrides io.netty.channel.DefaultChannelConfig.setConnectTimeoutMillis.

Implements io.netty.channel.socket.DatagramChannelConfig.setConnectTimeoutMillis, io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Sets the connect timeout of the channel in milliseconds.
public DatagramChannelConfig
setInterface(InetAddress interfaceAddress)

Implements io.netty.channel.socket.DatagramChannelConfig.setInterface.

Sets the address of the network interface used for multicast packets.
public DatagramChannelConfig
setLoopbackModeDisabled(boolean
true if and only if the loopback mode has been disabled
loopbackModeDisabled
)

Implements io.netty.channel.socket.DatagramChannelConfig.setLoopbackModeDisabled.

Sets the StandardSocketOptions#IP_MULTICAST_LOOP option.
public DatagramChannelConfig
public DatagramChannelConfig
setMaxMessagesPerWrite(int maxMessagesPerWrite)

Overrides io.netty.channel.DefaultChannelConfig.setMaxMessagesPerWrite.

Set the maximum number of message to write per eventloop run.
public DatagramChannelConfig
public DatagramChannelConfig
public <T> boolean
setOption(ChannelOption<T> option, T value)

Overrides io.netty.channel.DefaultChannelConfig.setOption.

Implements io.netty.channel.ChannelConfig.setOption.

Sets a configuration property with the specified name and value.
public DatagramChannelConfig
public DatagramChannelConfig
public DatagramChannelConfig
public DatagramChannelConfig
public DatagramChannelConfig
public DatagramChannelConfig
public DatagramChannelConfig
setWriteBufferHighWaterMark(int writeBufferHighWaterMark)

Overrides io.netty.channel.DefaultChannelConfig.setWriteBufferHighWaterMark.

Implements io.netty.channel.ChannelConfig.setWriteBufferHighWaterMark.

Sets the high water mark of the write buffer.

public DatagramChannelConfig
setWriteBufferLowWaterMark(int writeBufferLowWaterMark)

Overrides io.netty.channel.DefaultChannelConfig.setWriteBufferLowWaterMark.

Implements io.netty.channel.ChannelConfig.setWriteBufferLowWaterMark.

Sets the low water mark of the write buffer.

public DatagramChannelConfig
public DatagramChannelConfig
Inherited from io.netty.channel.DefaultChannelConfig:
autoReadClearedgetAllocatorgetConnectTimeoutMillisgetMaxMessagesPerReadgetMaxMessagesPerWritegetMessageSizeEstimatorgetOptionsgetRecvByteBufAllocatorgetWriteBufferHighWaterMarkgetWriteBufferLowWaterMarkgetWriteBufferWaterMarkgetWriteSpinCountisAutoCloseisAutoReadsetOptionsvalidate

Field Detail

activeOnOpenback to summary
private volatile boolean activeOnOpen
javaSocketback to summary
private final DatagramSocket javaSocket
loggerback to summary
private static final InternalLogger logger

Constructor Detail

DefaultDatagramChannelConfigback to summary
public DefaultDatagramChannelConfig(DatagramChannel channel, DatagramSocket javaSocket)

Creates a new instance.

Method Detail

getInterfaceback to summary
public InetAddress getInterface()

Implements io.netty.channel.socket.DatagramChannelConfig.getInterface.

Doc from io.netty.channel.socket.DatagramChannelConfig.getInterface.

Gets the address of the network interface used for multicast packets.

Annotations
@Override
getNetworkInterfaceback to summary
public NetworkInterface getNetworkInterface()

Implements io.netty.channel.socket.DatagramChannelConfig.getNetworkInterface.

Doc from io.netty.channel.socket.DatagramChannelConfig.getNetworkInterface.

Gets the StandardSocketOptions#IP_MULTICAST_IF option.

Annotations
@Override
getOptionback to summary
public <T> T getOption(ChannelOption<T> option)

Overrides io.netty.channel.DefaultChannelConfig.getOption.

Implements io.netty.channel.ChannelConfig.getOption.

Doc from io.netty.channel.ChannelConfig.getOption.

Return the value of the given ChannelOption

Annotations
@Override
@SuppressWarnings:unchecked, deprecation
getOptionsback to summary
public Map<ChannelOption<?>, Object> getOptions()

Overrides io.netty.channel.DefaultChannelConfig.getOptions.

Implements io.netty.channel.ChannelConfig.getOptions.

Doc from io.netty.channel.ChannelConfig.getOptions.

Return all set ChannelOption's.

Annotations
@Override
@SuppressWarnings:deprecation
getReceiveBufferSizeback to summary
public int getReceiveBufferSize()

Implements io.netty.channel.socket.DatagramChannelConfig.getReceiveBufferSize.

Doc from io.netty.channel.socket.DatagramChannelConfig.getReceiveBufferSize.

Gets the StandardSocketOptions#SO_RCVBUF option.

Annotations
@Override
getSendBufferSizeback to summary
public int getSendBufferSize()

Implements io.netty.channel.socket.DatagramChannelConfig.getSendBufferSize.

Doc from io.netty.channel.socket.DatagramChannelConfig.getSendBufferSize.

Gets the StandardSocketOptions#SO_SNDBUF option.

Annotations
@Override
getTimeToLiveback to summary
public int getTimeToLive()

Implements io.netty.channel.socket.DatagramChannelConfig.getTimeToLive.

Doc from io.netty.channel.socket.DatagramChannelConfig.getTimeToLive.

Gets the StandardSocketOptions#IP_MULTICAST_TTL option.

Annotations
@Override
getTrafficClassback to summary
public int getTrafficClass()

Implements io.netty.channel.socket.DatagramChannelConfig.getTrafficClass.

Doc from io.netty.channel.socket.DatagramChannelConfig.getTrafficClass.

Gets the StandardSocketOptions#IP_TOS option.

Annotations
@Override
isBroadcastback to summary
public boolean isBroadcast()

Implements io.netty.channel.socket.DatagramChannelConfig.isBroadcast.

Doc from io.netty.channel.socket.DatagramChannelConfig.isBroadcast.

Gets the StandardSocketOptions#SO_BROADCAST option.

Annotations
@Override
isLoopbackModeDisabledback to summary
public boolean isLoopbackModeDisabled()

Implements io.netty.channel.socket.DatagramChannelConfig.isLoopbackModeDisabled.

Doc from io.netty.channel.socket.DatagramChannelConfig.isLoopbackModeDisabled.

Gets the StandardSocketOptions#IP_MULTICAST_LOOP option.

Returns:boolean

true if and only if the loopback mode has been disabled

Annotations
@Override
isReuseAddressback to summary
public boolean isReuseAddress()

Implements io.netty.channel.socket.DatagramChannelConfig.isReuseAddress.

Doc from io.netty.channel.socket.DatagramChannelConfig.isReuseAddress.

Gets the StandardSocketOptions#SO_REUSEADDR option.

Annotations
@Override
javaSocketback to summary
protected final DatagramSocket javaSocket()
setActiveOnOpenback to summary
private void setActiveOnOpen(boolean activeOnOpen)
setAllocatorback to summary
public DatagramChannelConfig setAllocator(ByteBufAllocator allocator)

Overrides io.netty.channel.DefaultChannelConfig.setAllocator.

Implements io.netty.channel.socket.DatagramChannelConfig.setAllocator, io.netty.channel.ChannelConfig.setAllocator.

Doc from io.netty.channel.ChannelConfig.setAllocator.

Set the ByteBufAllocator which is used for the channel to allocate buffers.

Annotations
@Override
setAutoCloseback to summary
public DatagramChannelConfig setAutoClose(boolean autoClose)

Overrides io.netty.channel.DefaultChannelConfig.setAutoClose.

Implements io.netty.channel.socket.DatagramChannelConfig.setAutoClose, io.netty.channel.ChannelConfig.setAutoClose.

Doc from io.netty.channel.ChannelConfig.setAutoClose.

Sets whether the Channel should be closed automatically and immediately on write failure. The default is true.

Annotations
@Override
setAutoReadback to summary
public DatagramChannelConfig setAutoRead(boolean autoRead)

Overrides io.netty.channel.DefaultChannelConfig.setAutoRead.

Implements io.netty.channel.socket.DatagramChannelConfig.setAutoRead, io.netty.channel.ChannelConfig.setAutoRead.

Doc from io.netty.channel.ChannelConfig.setAutoRead.

Sets if ChannelHandlerContext#read() will be invoked automatically so that a user application doesn't need to call it at all. The default value is true.

Annotations
@Override
setBroadcastback to summary
public DatagramChannelConfig setBroadcast(boolean broadcast)

Implements io.netty.channel.socket.DatagramChannelConfig.setBroadcast.

Doc from io.netty.channel.socket.DatagramChannelConfig.setBroadcast.

Sets the StandardSocketOptions#SO_BROADCAST option.

Annotations
@Override
setConnectTimeoutMillisback to summary
public DatagramChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis)

Overrides io.netty.channel.DefaultChannelConfig.setConnectTimeoutMillis.

Implements io.netty.channel.socket.DatagramChannelConfig.setConnectTimeoutMillis, io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Doc from io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Sets the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.

Parameters
connectTimeoutMillis:int

the connect timeout in milliseconds. 0 to disable.

Annotations
@Override
setInterfaceback to summary
public DatagramChannelConfig setInterface(InetAddress interfaceAddress)

Implements io.netty.channel.socket.DatagramChannelConfig.setInterface.

Doc from io.netty.channel.socket.DatagramChannelConfig.setInterface.

Sets the address of the network interface used for multicast packets.

Annotations
@Override
setLoopbackModeDisabledback to summary
public DatagramChannelConfig setLoopbackModeDisabled(boolean loopbackModeDisabled)

Implements io.netty.channel.socket.DatagramChannelConfig.setLoopbackModeDisabled.

Doc from io.netty.channel.socket.DatagramChannelConfig.setLoopbackModeDisabled.

Sets the StandardSocketOptions#IP_MULTICAST_LOOP option.

Parameters
loopbackModeDisabled:boolean

true if and only if the loopback mode has been disabled

Annotations
@Override
setMaxMessagesPerReadback to summary
public DatagramChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead)

Overrides io.netty.channel.DefaultChannelConfig.setMaxMessagesPerRead.

Implements io.netty.channel.socket.DatagramChannelConfig.setMaxMessagesPerRead, io.netty.channel.ChannelConfig.setMaxMessagesPerRead.

Doc from io.netty.channel.DefaultChannelConfig.setMaxMessagesPerRead.

Deprecated

Annotations
@Override
@Deprecated
setMaxMessagesPerWriteback to summary
public DatagramChannelConfig setMaxMessagesPerWrite(int maxMessagesPerWrite)

Overrides io.netty.channel.DefaultChannelConfig.setMaxMessagesPerWrite.

Doc from io.netty.channel.DefaultChannelConfig.setMaxMessagesPerWrite.

Set 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.

Annotations
@Override
setMessageSizeEstimatorback to summary
public DatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator)

Overrides io.netty.channel.DefaultChannelConfig.setMessageSizeEstimator.

Implements io.netty.channel.socket.DatagramChannelConfig.setMessageSizeEstimator, io.netty.channel.ChannelConfig.setMessageSizeEstimator.

Doc from io.netty.channel.ChannelConfig.setMessageSizeEstimator.

Set the MessageSizeEstimator which is used for the channel to detect the size of a message.

Annotations
@Override
setNetworkInterfaceback to summary
public DatagramChannelConfig setNetworkInterface(NetworkInterface networkInterface)

Implements io.netty.channel.socket.DatagramChannelConfig.setNetworkInterface.

Doc from io.netty.channel.socket.DatagramChannelConfig.setNetworkInterface.

Sets the StandardSocketOptions#IP_MULTICAST_IF option.

Annotations
@Override
setOptionback to summary
public <T> boolean setOption(ChannelOption<T> option, T value)

Overrides io.netty.channel.DefaultChannelConfig.setOption.

Implements io.netty.channel.ChannelConfig.setOption.

Doc from io.netty.channel.ChannelConfig.setOption.

Sets 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;
}
Returns:boolean

true if and only if the property has been set

Annotations
@Override
@SuppressWarnings:deprecation
setReceiveBufferSizeback to summary
public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize)

Implements io.netty.channel.socket.DatagramChannelConfig.setReceiveBufferSize.

Doc from io.netty.channel.socket.DatagramChannelConfig.setReceiveBufferSize.

Sets the StandardSocketOptions#SO_RCVBUF option.

Annotations
@Override
setRecvByteBufAllocatorback to summary
public DatagramChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator)

Overrides io.netty.channel.DefaultChannelConfig.setRecvByteBufAllocator.

Implements io.netty.channel.socket.DatagramChannelConfig.setRecvByteBufAllocator, io.netty.channel.ChannelConfig.setRecvByteBufAllocator.

Doc from io.netty.channel.ChannelConfig.setRecvByteBufAllocator.

Set the RecvByteBufAllocator which is used for the channel to allocate receive buffers.

Annotations
@Override
setReuseAddressback to summary
public DatagramChannelConfig setReuseAddress(boolean reuseAddress)

Implements io.netty.channel.socket.DatagramChannelConfig.setReuseAddress.

Doc from io.netty.channel.socket.DatagramChannelConfig.setReuseAddress.

Gets the StandardSocketOptions#SO_REUSEADDR option.

Annotations
@Override
setSendBufferSizeback to summary
public DatagramChannelConfig setSendBufferSize(int sendBufferSize)

Implements io.netty.channel.socket.DatagramChannelConfig.setSendBufferSize.

Doc from io.netty.channel.socket.DatagramChannelConfig.setSendBufferSize.

Sets the StandardSocketOptions#SO_SNDBUF option.

Annotations
@Override
setTimeToLiveback to summary
public DatagramChannelConfig setTimeToLive(int ttl)

Implements io.netty.channel.socket.DatagramChannelConfig.setTimeToLive.

Doc from io.netty.channel.socket.DatagramChannelConfig.setTimeToLive.

Sets the StandardSocketOptions#IP_MULTICAST_TTL option.

Annotations
@Override
setTrafficClassback to summary
public DatagramChannelConfig setTrafficClass(int trafficClass)

Implements io.netty.channel.socket.DatagramChannelConfig.setTrafficClass.

Doc from io.netty.channel.socket.DatagramChannelConfig.setTrafficClass.

Sets the StandardSocketOptions#IP_TOS option.

Annotations
@Override
setWriteBufferHighWaterMarkback to summary
public DatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark)

Overrides io.netty.channel.DefaultChannelConfig.setWriteBufferHighWaterMark.

Implements io.netty.channel.ChannelConfig.setWriteBufferHighWaterMark.

Doc from io.netty.channel.ChannelConfig.setWriteBufferHighWaterMark.

Sets 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 return false.

Annotations
@Override
setWriteBufferLowWaterMarkback to summary
public DatagramChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark)

Overrides io.netty.channel.DefaultChannelConfig.setWriteBufferLowWaterMark.

Implements io.netty.channel.ChannelConfig.setWriteBufferLowWaterMark.

Doc from io.netty.channel.ChannelConfig.setWriteBufferLowWaterMark.

Sets 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 return true again.

Annotations
@Override
setWriteBufferWaterMarkback to summary
public DatagramChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)

Overrides io.netty.channel.DefaultChannelConfig.setWriteBufferWaterMark.

Implements io.netty.channel.socket.DatagramChannelConfig.setWriteBufferWaterMark, io.netty.channel.ChannelConfig.setWriteBufferWaterMark.

Doc from io.netty.channel.ChannelConfig.setWriteBufferWaterMark.

Set the WriteBufferWaterMark which is used for setting the high and low water mark of the write buffer.

Annotations
@Override
setWriteSpinCountback to summary
public DatagramChannelConfig setWriteSpinCount(int writeSpinCount)

Overrides io.netty.channel.DefaultChannelConfig.setWriteSpinCount.

Implements io.netty.channel.socket.DatagramChannelConfig.setWriteSpinCount, io.netty.channel.ChannelConfig.setWriteSpinCount.

Doc from io.netty.channel.ChannelConfig.setWriteSpinCount.

Sets the maximum loop count for a write operation until WritableByteChannel#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 is 16.

Annotations
@Override