org.jboss.netty.channel.socket.nio
Interface NioSocketChannelConfig

All Superinterfaces:
ChannelConfig, SocketChannelConfig

public interface NioSocketChannelConfig
extends SocketChannelConfig

A SocketChannelConfig for a NIO TCP/IP SocketChannel.

Available options

In addition to the options provided by ChannelConfig and SocketChannelConfig, NioSocketChannelConfig allows the following options in the option map:
NameAssociated setter method
"writeBufferHighWaterMark"setWriteBufferHighWaterMark(int)
"writeBufferLowWaterMark"setWriteBufferLowWaterMark(int)
"writeSpinCount"setWriteSpinCount(int)
"receiveBufferSizePredictor"setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)
"receiveBufferSizePredictorFactory"setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory)

Version:
$Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
The Netty Project, Trustin Lee

Method Summary
 ReceiveBufferSizePredictor getReceiveBufferSizePredictor()
          Returns the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer.
 ReceiveBufferSizePredictorFactory getReceiveBufferSizePredictorFactory()
          Returns the ReceiveBufferSizePredictorFactory which creates a new ReceiveBufferSizePredictor when a new channel is created and no ReceiveBufferSizePredictor was set.
 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 until WritableByteChannel.write(ByteBuffer) returns a non-zero value.
 void setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
          Sets the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer.
 void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory)
          Sets the ReceiveBufferSizePredictor which creates a new ReceiveBufferSizePredictor when a new channel is created and no ReceiveBufferSizePredictor was set.
 void setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
          Sets the high water mark of the write buffer.
 void setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
          Sets the low water mark of the write buffer.
 void setWriteSpinCount(int writeSpinCount)
          Sets the maximum loop count for a write operation until WritableByteChannel.write(ByteBuffer) returns a non-zero value.
 
Methods inherited from interface org.jboss.netty.channel.socket.SocketChannelConfig
getReceiveBufferSize, getSendBufferSize, getSoLinger, getTrafficClass, isKeepAlive, isReuseAddress, isTcpNoDelay, setKeepAlive, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass
 
Methods inherited from interface org.jboss.netty.channel.ChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setOption, setOptions, setPipelineFactory
 

Method Detail

getWriteBufferHighWaterMark

int getWriteBufferHighWaterMark()
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 return false.


setWriteBufferHighWaterMark

void setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
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.


getWriteBufferLowWaterMark

int getWriteBufferLowWaterMark()
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 return true again.


setWriteBufferLowWaterMark

void setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
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 return true again.


getWriteSpinCount

int getWriteSpinCount()
Returns 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.


setWriteSpinCount

void setWriteSpinCount(int writeSpinCount)
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.

Throws:
IllegalArgumentException - if the specified value is 0 or less than 0

getReceiveBufferSizePredictor

ReceiveBufferSizePredictor getReceiveBufferSizePredictor()
Returns the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer. The default predictor is AdaptiveReceiveBufferSizePredictor(64, 1024, 65536).


setReceiveBufferSizePredictor

void setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
Sets the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer. The default predictor is AdaptiveReceiveBufferSizePredictor(64, 1024, 65536).


getReceiveBufferSizePredictorFactory

ReceiveBufferSizePredictorFactory getReceiveBufferSizePredictorFactory()
Returns the ReceiveBufferSizePredictorFactory which creates a new ReceiveBufferSizePredictor when a new channel is created and no ReceiveBufferSizePredictor was set. If no predictor was set for the channel, setReceiveBufferSizePredictor(ReceiveBufferSizePredictor) will be called with the new predictor. The default factory is AdaptiveReceiveBufferSizePredictorFactory(64, 1024, 65536).


setReceiveBufferSizePredictorFactory

void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory)
Sets the ReceiveBufferSizePredictor which creates a new ReceiveBufferSizePredictor when a new channel is created and no ReceiveBufferSizePredictor was set. If no predictor was set for the channel, setReceiveBufferSizePredictor(ReceiveBufferSizePredictor) will be called with the new predictor. The default factory is AdaptiveReceiveBufferSizePredictorFactory(64, 1024, 65536).



Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.