public interface NioSocketChannelConfig extends SocketChannelConfig
SocketChannelConfig
for a NIO TCP/IP SocketChannel
.
ChannelConfig
and
SocketChannelConfig
, NioSocketChannelConfig
allows the
following options in the option map:
Name | Associated setter method |
---|---|
"writeBufferHighWaterMark" | setWriteBufferHighWaterMark(int) |
"writeBufferLowWaterMark" | setWriteBufferLowWaterMark(int) |
"writeSpinCount" | setWriteSpinCount(int) |
"receiveBufferSizePredictor" | setReceiveBufferSizePredictor(ReceiveBufferSizePredictor) |
"readWriteFair" | setReadWriteFair(boolean) |
Modifier and Type | Method and Description |
---|---|
ReceiveBufferSizePredictor |
getReceiveBufferSizePredictor()
Returns the
ReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. |
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. |
boolean |
isReadWriteFair()
Deprecated.
This property has been replaced by the
writeBufferHighWaterMark and writeBufferLowWaterMark .
Returns true if and only if an I/O thread should do its effort
to balance the ratio of read and write operations. Assuring
the read-write fairness is sometimes necessary in a high speed network
because a certain channel can spend too much time on flushing the
large number of write requests not giving enough time for other channels
to perform I/O. The default value is false . |
void |
setReadWriteFair(boolean fair)
Deprecated.
This property has been replaced by the
writeBufferHighWaterMark and writeBufferLowWaterMark .
Sets if an I/O thread should balance the ratio of read and write
operations. Assuring the read-write fairness is sometimes necessary
in a high speed network because a certain channel can spend too much
time on flushing the large number of write requests not giving enough
time for other channels to perform I/O. The default value is
false . |
void |
setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
Sets the
ReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. |
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. |
getReceiveBufferSize, getSendBufferSize, getSoLinger, getTrafficClass, isKeepAlive, isReuseAddress, isTcpNoDelay, setKeepAlive, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, getWriteTimeoutMillis, setBufferFactory, setConnectTimeoutMillis, setOption, setOptions, setPipelineFactory, setWriteTimeoutMillis
int getWriteBufferHighWaterMark()
Channel.isWritable()
will start to return true
.void setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
Channel.isWritable()
will start to return true
.int getWriteBufferLowWaterMark()
Channel.isWritable()
will return
false
again.void setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
Channel.isWritable()
will return
false
again.int getWriteSpinCount()
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
.void setWriteSpinCount(int writeSpinCount)
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
.IllegalArgumentException
- if the specified value is 0
or less than 0
ReceiveBufferSizePredictor getReceiveBufferSizePredictor()
ReceiveBufferSizePredictor
which predicts the
number of readable bytes in the socket receive buffer. The default
predictor is AdaptiveReceiveBufferSizePredictor
.void setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
ReceiveBufferSizePredictor
which predicts the
number of readable bytes in the socket receive buffer. The default
predictor is AdaptiveReceiveBufferSizePredictor
.@Deprecated boolean isReadWriteFair()
writeBufferHighWaterMark
and writeBufferLowWaterMark
.
Returns true
if and only if an I/O thread should do its effort
to balance the ratio of read and write operations. Assuring
the read-write fairness is sometimes necessary in a high speed network
because a certain channel can spend too much time on flushing the
large number of write requests not giving enough time for other channels
to perform I/O. The default value is false
.@Deprecated void setReadWriteFair(boolean fair)
writeBufferHighWaterMark
and writeBufferLowWaterMark
.
Sets if an I/O thread should balance the ratio of read and write
operations. Assuring the read-write fairness is sometimes necessary
in a high speed network because a certain channel can spend too much
time on flushing the large number of write requests not giving enough
time for other channels to perform I/O. The default value is
false
.Copyright © 2008–2014 JBoss, by Red Hat. All rights reserved.