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 defaultNioSocketChannelConfigimplementation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.channels.DatagramChannelchannelprivate static InternalLoggerloggerprivate intwriteBufferHighWaterMarkprivate intwriteBufferLowWaterMarkprivate intwriteSpinCount
-
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.InetAddressgetInterface()Gets the address of the network interface used for multicast packets.java.net.NetworkInterfacegetNetworkInterface()Gets theStandardSocketOptions.IP_MULTICAST_IFoption.intgetTimeToLive()Gets theStandardSocketOptions.IP_MULTICAST_TTLoption.intgetWriteBufferHighWaterMark()Returns the high water mark of the write buffer.intgetWriteBufferLowWaterMark()Returns the low water mark of the write buffer.intgetWriteSpinCount()Returns the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.booleanisLoopbackModeDisabled()Gets theStandardSocketOptions.IP_MULTICAST_LOOPoption.voidsetInterface(java.net.InetAddress interfaceAddress)Sets the address of the network interface used for multicast packets.voidsetLoopbackModeDisabled(boolean loopbackModeDisabled)Sets theStandardSocketOptions.IP_MULTICAST_LOOPoption.voidsetNetworkInterface(java.net.NetworkInterface networkInterface)Sets theStandardSocketOptions.IP_MULTICAST_IFoption.booleansetOption(java.lang.String key, java.lang.Object value)Sets a configuration property with the specified name and value.voidsetOptions(java.util.Map<java.lang.String,java.lang.Object> options)Sets the configuration properties from the specifiedMap.voidsetTimeToLive(int ttl)Sets theStandardSocketOptions.IP_MULTICAST_TTLoption.voidsetWriteBufferHighWaterMark(int writeBufferHighWaterMark)Sets the high water mark of the write buffer.private voidsetWriteBufferHighWaterMark0(int writeBufferHighWaterMark)voidsetWriteBufferLowWaterMark(int writeBufferLowWaterMark)Sets the low water mark of the write buffer.private voidsetWriteBufferLowWaterMark0(int writeBufferLowWaterMark)voidsetWriteSpinCount(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:ChannelConfigSets the configuration properties from the specifiedMap.- Specified by:
setOptionsin interfaceChannelConfig- Overrides:
setOptionsin classDefaultChannelConfig
-
setOption
public boolean setOption(java.lang.String key, java.lang.Object 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(String name, Object value) { if (super.setOption(name, value)) { return true; } if (name.equals("additionalOption")) { .... return true; } return false; }- Specified by:
setOptionin interfaceChannelConfig- Overrides:
setOptionin classDefaultDatagramChannelConfig- Returns:
trueif and only if the property has been set
-
getWriteBufferHighWaterMark
public int getWriteBufferHighWaterMark()
Description copied from interface:NioChannelConfigReturns 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:
getWriteBufferHighWaterMarkin interfaceNioChannelConfig
-
setWriteBufferHighWaterMark
public void setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
Description copied from interface:NioChannelConfigSets 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 interfaceNioChannelConfig
-
setWriteBufferHighWaterMark0
private void setWriteBufferHighWaterMark0(int writeBufferHighWaterMark)
-
getWriteBufferLowWaterMark
public int getWriteBufferLowWaterMark()
Description copied from interface:NioChannelConfigReturns 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:
getWriteBufferLowWaterMarkin interfaceNioChannelConfig
-
setWriteBufferLowWaterMark
public void setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
Description copied from interface:NioChannelConfigSets 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 toreturntrueagain.- Specified by:
setWriteBufferLowWaterMarkin interfaceNioChannelConfig
-
setWriteBufferLowWaterMark0
private void setWriteBufferLowWaterMark0(int writeBufferLowWaterMark)
-
getWriteSpinCount
public int getWriteSpinCount()
Description copied from interface:NioChannelConfigReturns 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:
getWriteSpinCountin interfaceNioChannelConfig
-
setWriteSpinCount
public void setWriteSpinCount(int writeSpinCount)
Description copied from interface:NioChannelConfigSets 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 interfaceNioChannelConfig
-
setNetworkInterface
public void setNetworkInterface(java.net.NetworkInterface networkInterface)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
setNetworkInterfacein interfaceDatagramChannelConfig- Overrides:
setNetworkInterfacein classDefaultDatagramChannelConfig
-
getNetworkInterface
public java.net.NetworkInterface getNetworkInterface()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
getNetworkInterfacein interfaceDatagramChannelConfig- Overrides:
getNetworkInterfacein classDefaultDatagramChannelConfig
-
getTimeToLive
public int getTimeToLive()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
getTimeToLivein interfaceDatagramChannelConfig- Overrides:
getTimeToLivein classDefaultDatagramChannelConfig
-
setTimeToLive
public void setTimeToLive(int ttl)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
setTimeToLivein interfaceDatagramChannelConfig- Overrides:
setTimeToLivein classDefaultDatagramChannelConfig
-
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- Overrides:
getInterfacein classDefaultDatagramChannelConfig
-
setInterface
public void setInterface(java.net.InetAddress interfaceAddress)
Description copied from interface:DatagramChannelConfigSets the address of the network interface used for multicast packets.- Specified by:
setInterfacein interfaceDatagramChannelConfig- Overrides:
setInterfacein classDefaultDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
isLoopbackModeDisabledin interfaceDatagramChannelConfig- Overrides:
isLoopbackModeDisabledin classDefaultDatagramChannelConfig
-
setLoopbackModeDisabled
public void setLoopbackModeDisabled(boolean loopbackModeDisabled)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
setLoopbackModeDisabledin interfaceDatagramChannelConfig- Overrides:
setLoopbackModeDisabledin classDefaultDatagramChannelConfig- Parameters:
loopbackModeDisabled-trueif and only if the loopback mode has been disabled
-
-