Class DefaultNioSocketChannelConfig
java.lang.Object
org.jboss.netty.channel.DefaultChannelConfig
org.jboss.netty.channel.socket.DefaultSocketChannelConfig
org.jboss.netty.channel.socket.nio.DefaultNioSocketChannelConfig
- All Implemented Interfaces:
ChannelConfig,NioChannelConfig,NioSocketChannelConfig,SocketChannelConfig
class DefaultNioSocketChannelConfig
extends DefaultSocketChannelConfig
implements NioSocketChannelConfig
The default
NioSocketChannelConfig implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ReceiveBufferSizePredictorFactoryprivate static final InternalLoggerprivate ReceiveBufferSizePredictorprivate intprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns theReceiveBufferSizePredictorwhich predicts the number of readable bytes in the socket receive buffer.Returns theReceiveBufferSizePredictorFactorywhich creates a newReceiveBufferSizePredictorwhen a new channel is created and noReceiveBufferSizePredictorwas set.intReturns the high water mark of the write buffer.intReturns the low water mark of the write buffer.intReturns the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.booleanSets a configuration property with the specified name and value.voidsetOptions(Map<String, Object> options) Sets the configuration properties from the specifiedMap.voidSets theReceiveBufferSizePredictorwhich predicts the number of readable bytes in the socket receive buffer.voidsetReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory) Sets theReceiveBufferSizePredictorwhich creates a newReceiveBufferSizePredictorwhen a new channel is created and noReceiveBufferSizePredictorwas set.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.DefaultSocketChannelConfig
getReceiveBufferSize, getSendBufferSize, getSoLinger, getTrafficClass, isKeepAlive, isReuseAddress, isTcpNoDelay, setKeepAlive, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClassMethods inherited from class org.jboss.netty.channel.DefaultChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setPipelineFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.netty.channel.ChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setPipelineFactoryMethods inherited from interface org.jboss.netty.channel.socket.SocketChannelConfig
getReceiveBufferSize, getSendBufferSize, getSoLinger, getTrafficClass, isKeepAlive, isReuseAddress, isTcpNoDelay, setKeepAlive, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass
-
Field Details
-
logger
-
DEFAULT_PREDICTOR_FACTORY
-
writeBufferHighWaterMark
private volatile int writeBufferHighWaterMark -
writeBufferLowWaterMark
private volatile int writeBufferLowWaterMark -
predictor
-
predictorFactory
-
writeSpinCount
private volatile int writeSpinCount
-
-
Constructor Details
-
DefaultNioSocketChannelConfig
DefaultNioSocketChannelConfig(Socket socket)
-
-
Method Details
-
setOptions
Description copied from interface:ChannelConfigSets the configuration properties from the specifiedMap.- Specified by:
setOptionsin interfaceChannelConfig- Overrides:
setOptionsin classDefaultChannelConfig
-
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(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 classDefaultSocketChannelConfig- 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
-
getReceiveBufferSizePredictor
Description copied from interface:NioSocketChannelConfigReturns theReceiveBufferSizePredictorwhich predicts the number of readable bytes in the socket receive buffer. The default predictor isAdaptiveReceiveBufferSizePredictor(64, 1024, 65536).- Specified by:
getReceiveBufferSizePredictorin interfaceNioSocketChannelConfig
-
setReceiveBufferSizePredictor
Description copied from interface:NioSocketChannelConfigSets theReceiveBufferSizePredictorwhich predicts the number of readable bytes in the socket receive buffer. The default predictor isAdaptiveReceiveBufferSizePredictor(64, 1024, 65536).- Specified by:
setReceiveBufferSizePredictorin interfaceNioSocketChannelConfig
-
getReceiveBufferSizePredictorFactory
Description copied from interface:NioSocketChannelConfigReturns theReceiveBufferSizePredictorFactorywhich creates a newReceiveBufferSizePredictorwhen a new channel is created and noReceiveBufferSizePredictorwas set. If no predictor was set for the channel,NioSocketChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)will be called with the new predictor. The default factory isAdaptiveReceiveBufferSizePredictorFactory(64, 1024, 65536).- Specified by:
getReceiveBufferSizePredictorFactoryin interfaceNioSocketChannelConfig
-
setReceiveBufferSizePredictorFactory
public void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory) Description copied from interface:NioSocketChannelConfigSets theReceiveBufferSizePredictorwhich creates a newReceiveBufferSizePredictorwhen a new channel is created and noReceiveBufferSizePredictorwas set. If no predictor was set for the channel,NioSocketChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)will be called with the new predictor. The default factory isAdaptiveReceiveBufferSizePredictorFactory(64, 1024, 65536).- Specified by:
setReceiveBufferSizePredictorFactoryin interfaceNioSocketChannelConfig
-