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 defaultNioSocketChannelConfig
implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.channels.DatagramChannel
channel
private static InternalLogger
logger
private int
writeBufferHighWaterMark
private int
writeBufferLowWaterMark
private int
writeSpinCount
-
Constructor Summary
Constructors Constructor Description DefaultNioDatagramChannelConfig(java.nio.channels.DatagramChannel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.InetAddress
getInterface()
Gets the address of the network interface used for multicast packets.java.net.NetworkInterface
getNetworkInterface()
Gets theStandardSocketOptions.IP_MULTICAST_IF
option.int
getTimeToLive()
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.int
getWriteBufferHighWaterMark()
Returns the high water mark of the write buffer.int
getWriteBufferLowWaterMark()
Returns the low water mark of the write buffer.int
getWriteSpinCount()
Returns the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)
returns a non-zero value.boolean
isLoopbackModeDisabled()
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.void
setInterface(java.net.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(java.net.NetworkInterface networkInterface)
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.boolean
setOption(java.lang.String key, java.lang.Object value)
Sets a configuration property with the specified name and value.void
setOptions(java.util.Map<java.lang.String,java.lang.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 Detail
-
logger
private static final InternalLogger logger
-
writeBufferHighWaterMark
private volatile int writeBufferHighWaterMark
-
writeBufferLowWaterMark
private volatile int writeBufferLowWaterMark
-
writeSpinCount
private volatile int writeSpinCount
-
channel
private final java.nio.channels.DatagramChannel channel
-
-
Method Detail
-
setOptions
public void setOptions(java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface:ChannelConfig
Sets the configuration properties from the specifiedMap
.- Specified by:
setOptions
in interfaceChannelConfig
- Overrides:
setOptions
in classDefaultChannelConfig
-
setOption
public boolean setOption(java.lang.String key, java.lang.Object value)
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
public void setNetworkInterface(java.net.NetworkInterface networkInterface)
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
setNetworkInterface
in interfaceDatagramChannelConfig
- Overrides:
setNetworkInterface
in classDefaultDatagramChannelConfig
-
getNetworkInterface
public java.net.NetworkInterface 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
public java.net.InetAddress 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
public void setInterface(java.net.InetAddress interfaceAddress)
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
-
-