Class DefaultNioDatagramChannelConfig
java.lang.Object
org.jboss.netty.channel.DefaultChannelConfig
org.jboss.netty.channel.socket.DefaultDatagramChannelConfig
org.jboss.netty.channel.socket.nio.DefaultNioDatagramChannelConfig
- All Implemented Interfaces:
ChannelConfig
,DatagramChannelConfig
,NioChannelConfig
,NioDatagramChannelConfig
class DefaultNioDatagramChannelConfig
extends DefaultDatagramChannelConfig
implements NioDatagramChannelConfig
The default
NioSocketChannelConfig
implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DatagramChannel
private static final InternalLogger
private int
private int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the address of the network interface used for multicast packets.Gets theStandardSocketOptions.IP_MULTICAST_IF
option.int
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.int
Returns the high water mark of the write buffer.int
Returns the low water mark of the write buffer.int
Returns the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)
returns a non-zero value.boolean
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.void
setInterface
(InetAddress interfaceAddress) Sets the address of the network interface used for multicast packets.void
setLoopbackModeDisabled
(boolean loopbackModeDisabled) Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.void
setNetworkInterface
(NetworkInterface networkInterface) Sets theStandardSocketOptions.IP_MULTICAST_IF
option.boolean
Sets a configuration property with the specified name and value.void
setOptions
(Map<String, Object> options) Sets the configuration properties from the specifiedMap
.void
setTimeToLive
(int ttl) Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.void
setWriteBufferHighWaterMark
(int writeBufferHighWaterMark) Sets the high water mark of the write buffer.private void
setWriteBufferHighWaterMark0
(int writeBufferHighWaterMark) void
setWriteBufferLowWaterMark
(int writeBufferLowWaterMark) Sets the low water mark of the write buffer.private void
setWriteBufferLowWaterMark0
(int writeBufferLowWaterMark) void
setWriteSpinCount
(int writeSpinCount) Sets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)
returns a non-zero value.Methods inherited from class org.jboss.netty.channel.socket.DefaultDatagramChannelConfig
getReceiveBufferSize, getReceiveBufferSizePredictor, getReceiveBufferSizePredictorFactory, getSendBufferSize, getTrafficClass, isBroadcast, isReuseAddress, setBroadcast, setReceiveBufferSize, setReceiveBufferSizePredictor, setReceiveBufferSizePredictorFactory, setReuseAddress, setSendBufferSize, setTrafficClass
Methods inherited from class org.jboss.netty.channel.DefaultChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setPipelineFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.netty.channel.ChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setPipelineFactory
Methods inherited from interface org.jboss.netty.channel.socket.DatagramChannelConfig
getReceiveBufferSize, getReceiveBufferSizePredictor, getReceiveBufferSizePredictorFactory, getSendBufferSize, getTrafficClass, isBroadcast, isReuseAddress, setBroadcast, setReceiveBufferSize, setReceiveBufferSizePredictor, setReceiveBufferSizePredictorFactory, setReuseAddress, setSendBufferSize, setTrafficClass
-
Field Details
-
logger
-
writeBufferHighWaterMark
private volatile int writeBufferHighWaterMark -
writeBufferLowWaterMark
private volatile int writeBufferLowWaterMark -
writeSpinCount
private volatile int writeSpinCount -
channel
-
-
Constructor Details
-
DefaultNioDatagramChannelConfig
DefaultNioDatagramChannelConfig(DatagramChannel channel)
-
-
Method Details
-
setOptions
Description copied from interface:ChannelConfig
Sets the configuration properties from the specifiedMap
.- Specified by:
setOptions
in interfaceChannelConfig
- Overrides:
setOptions
in classDefaultChannelConfig
-
setOption
Description copied from interface:ChannelConfig
Sets a configuration property with the specified name and value. To override this method properly, you must call the super class:public boolean setOption(String name, Object value) { if (super.setOption(name, value)) { return true; } if (name.equals("additionalOption")) { .... return true; } return false; }
- Specified by:
setOption
in interfaceChannelConfig
- Overrides:
setOption
in classDefaultDatagramChannelConfig
- Returns:
true
if and only if the property has been set
-
getWriteBufferHighWaterMark
public int getWriteBufferHighWaterMark()Description copied from interface:NioChannelConfig
Returns 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:
getWriteBufferHighWaterMark
in interfaceNioChannelConfig
-
setWriteBufferHighWaterMark
public void setWriteBufferHighWaterMark(int writeBufferHighWaterMark) Description copied from interface:NioChannelConfig
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 returnfalse
.- Specified by:
setWriteBufferHighWaterMark
in interfaceNioChannelConfig
-
setWriteBufferHighWaterMark0
private void setWriteBufferHighWaterMark0(int writeBufferHighWaterMark) -
getWriteBufferLowWaterMark
public int getWriteBufferLowWaterMark()Description copied from interface:NioChannelConfig
Returns 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 returntrue
again.- Specified by:
getWriteBufferLowWaterMark
in interfaceNioChannelConfig
-
setWriteBufferLowWaterMark
public void setWriteBufferLowWaterMark(int writeBufferLowWaterMark) Description copied from interface:NioChannelConfig
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 toreturntrue
again.- Specified by:
setWriteBufferLowWaterMark
in interfaceNioChannelConfig
-
setWriteBufferLowWaterMark0
private void setWriteBufferLowWaterMark0(int writeBufferLowWaterMark) -
getWriteSpinCount
public int getWriteSpinCount()Description copied from interface:NioChannelConfig
Returns 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:
getWriteSpinCount
in interfaceNioChannelConfig
-
setWriteSpinCount
public void setWriteSpinCount(int writeSpinCount) Description copied from interface:NioChannelConfig
Sets 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:
setWriteSpinCount
in interfaceNioChannelConfig
-
setNetworkInterface
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
setNetworkInterface
in interfaceDatagramChannelConfig
- Overrides:
setNetworkInterface
in classDefaultDatagramChannelConfig
-
getNetworkInterface
Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
getNetworkInterface
in interfaceDatagramChannelConfig
- Overrides:
getNetworkInterface
in classDefaultDatagramChannelConfig
-
getTimeToLive
public int getTimeToLive()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
getTimeToLive
in interfaceDatagramChannelConfig
- Overrides:
getTimeToLive
in classDefaultDatagramChannelConfig
-
setTimeToLive
public void setTimeToLive(int ttl) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
setTimeToLive
in interfaceDatagramChannelConfig
- Overrides:
setTimeToLive
in classDefaultDatagramChannelConfig
-
getInterface
Description copied from interface:DatagramChannelConfig
Gets the address of the network interface used for multicast packets.- Specified by:
getInterface
in interfaceDatagramChannelConfig
- Overrides:
getInterface
in classDefaultDatagramChannelConfig
-
setInterface
Description copied from interface:DatagramChannelConfig
Sets the address of the network interface used for multicast packets.- Specified by:
setInterface
in interfaceDatagramChannelConfig
- Overrides:
setInterface
in classDefaultDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
isLoopbackModeDisabled
in interfaceDatagramChannelConfig
- Overrides:
isLoopbackModeDisabled
in classDefaultDatagramChannelConfig
-
setLoopbackModeDisabled
public void setLoopbackModeDisabled(boolean loopbackModeDisabled) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
setLoopbackModeDisabled
in interfaceDatagramChannelConfig
- Overrides:
setLoopbackModeDisabled
in classDefaultDatagramChannelConfig
- Parameters:
loopbackModeDisabled
-true
if and only if the loopback mode has been disabled
-