Package org.apache.mina.core.session
Interface IoSessionConfig
- All Known Subinterfaces:
DatagramSessionConfig,SocketSessionConfig,VmPipeSessionConfig
- All Known Implementing Classes:
AbstractDatagramSessionConfig,AbstractIoSessionConfig,AbstractSocketSessionConfig,DefaultDatagramSessionConfig,DefaultSocketSessionConfig,DefaultVmPipeSessionConfig,NioDatagramSessionConfig,NioSocketSession.SessionConfigImpl
public interface IoSessionConfig
The configuration of
IoSession.-
Method Summary
Modifier and TypeMethodDescriptionintGet the idle time for reads and writeslongGet the idle time in millisecondsintgetIdleTime(IdleStatus status) Get the idle timelonggetIdleTimeInMillis(IdleStatus status) Get the idle time in millisecondsintGet the maximum size of the read bufferintGet the minimum size of the read bufferintGet the read buffer sizeintGet the read idle timelongGet the read idle time in millisecondsintGet the throughput intervallongGet the throughput interval in millisecondsintGet the write idle timelongGet the write idle time in millisecondsintGet the write timeout in seconds.longGet the write timeout in milliseconds.booleanTell if the read operation is enabledvoidsetAll(IoSessionConfig config) Sets all configuration properties retrieved from the specifiedconfig.voidsetBothIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.voidsetIdleTime(IdleStatus status, int idleTime) Sets idle time for the specified type of idleness in seconds.voidsetMaxReadBufferSize(int maxReadBufferSize) Sets the maximum size of the read buffer that I/O processor allocates per each read.voidsetMinReadBufferSize(int minReadBufferSize) Sets the minimum size of the read buffer that I/O processor allocates per each read.voidsetReadBufferSize(int readBufferSize) Sets the size of the read buffer that I/O processor allocates per each read.voidsetReaderIdleTime(int idleTime) Sets idle time forIdleStatus.READER_IDLEin seconds.voidsetThroughputCalculationInterval(int throughputCalculationInterval) Sets the interval (seconds) between each throughput calculation.voidsetUseReadOperation(boolean useReadOperation) Enables or disabledIoSession.read()operation.voidsetWriterIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.voidsetWriteTimeout(int writeTimeout) Sets write timeout in seconds.
-
Method Details
-
getReadBufferSize
int getReadBufferSize()Get the read buffer size- Returns:
- the size of the read buffer that I/O processor allocates per each read. It's unusual to adjust this property because it's often adjusted automatically by the I/O processor.
-
setReadBufferSize
void setReadBufferSize(int readBufferSize) Sets the size of the read buffer that I/O processor allocates per each read. It's unusual to adjust this property because it's often adjusted automatically by the I/O processor.- Parameters:
readBufferSize- The size of the read buffer
-
getMinReadBufferSize
int getMinReadBufferSize()Get the minimum size of the read buffer- Returns:
- the minimum size of the read buffer that I/O processor allocates per each read. I/O processor will not decrease the read buffer size to the smaller value than this property value.
-
setMinReadBufferSize
void setMinReadBufferSize(int minReadBufferSize) Sets the minimum size of the read buffer that I/O processor allocates per each read. I/O processor will not decrease the read buffer size to the smaller value than this property value.- Parameters:
minReadBufferSize- The minimum size of the read buffer
-
getMaxReadBufferSize
int getMaxReadBufferSize()Get the maximum size of the read buffer- Returns:
- the maximum size of the read buffer that I/O processor allocates per each read. I/O processor will not increase the read buffer size to the greater value than this property value.
-
setMaxReadBufferSize
void setMaxReadBufferSize(int maxReadBufferSize) Sets the maximum size of the read buffer that I/O processor allocates per each read. I/O processor will not increase the read buffer size to the greater value than this property value.- Parameters:
maxReadBufferSize- The maximum size of the read buffer
-
getThroughputCalculationInterval
int getThroughputCalculationInterval()Get the throughput interval- Returns:
- the interval (seconds) between each throughput calculation.
The default value is
3seconds.
-
getThroughputCalculationIntervalInMillis
long getThroughputCalculationIntervalInMillis()Get the throughput interval in milliseconds- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3seconds.
-
setThroughputCalculationInterval
void setThroughputCalculationInterval(int throughputCalculationInterval) Sets the interval (seconds) between each throughput calculation. The default value is3seconds.- Parameters:
throughputCalculationInterval- The interval
-
getIdleTime
Get the idle time- Parameters:
status- The status for which we want the idle time (One of READER_IDLE, WRITER_IDLE or BOTH_IDLE)- Returns:
- idle time for the specified type of idleness in seconds.
-
getIdleTimeInMillis
Get the idle time in milliseconds- Parameters:
status- The status for which we want the idle time (One of READER_IDLE, WRITER_IDLE or BOTH_IDLE)- Returns:
- idle time for the specified type of idleness in milliseconds.
-
setIdleTime
Sets idle time for the specified type of idleness in seconds.- Parameters:
status- The status for which we want to set the idle time (One of READER_IDLE, WRITER_IDLE or BOTH_IDLE)idleTime- The time in second to set
-
getReaderIdleTime
int getReaderIdleTime()Get the read idle time- Returns:
- idle time for
IdleStatus.READER_IDLEin seconds.
-
getReaderIdleTimeInMillis
long getReaderIdleTimeInMillis()Get the read idle time in milliseconds- Returns:
- idle time for
IdleStatus.READER_IDLEin milliseconds.
-
setReaderIdleTime
void setReaderIdleTime(int idleTime) Sets idle time forIdleStatus.READER_IDLEin seconds.- Parameters:
idleTime- The time to set
-
getWriterIdleTime
int getWriterIdleTime()Get the write idle time- Returns:
- idle time for
IdleStatus.WRITER_IDLEin seconds.
-
getWriterIdleTimeInMillis
long getWriterIdleTimeInMillis()Get the write idle time in milliseconds- Returns:
- idle time for
IdleStatus.WRITER_IDLEin milliseconds.
-
setWriterIdleTime
void setWriterIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.- Parameters:
idleTime- The time to set
-
getBothIdleTime
int getBothIdleTime()Get the idle time for reads and writes- Returns:
- idle time for
IdleStatus.BOTH_IDLEin seconds.
-
getBothIdleTimeInMillis
long getBothIdleTimeInMillis()Get the idle time in milliseconds- Returns:
- idle time for
IdleStatus.BOTH_IDLEin milliseconds.
-
setBothIdleTime
void setBothIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.- Parameters:
idleTime- The time to set
-
getWriteTimeout
int getWriteTimeout()Get the write timeout in seconds.- Returns:
- write timeout in seconds.
-
getWriteTimeoutInMillis
long getWriteTimeoutInMillis()Get the write timeout in milliseconds.- Returns:
- write timeout in milliseconds.
-
setWriteTimeout
void setWriteTimeout(int writeTimeout) Sets write timeout in seconds.- Parameters:
writeTimeout- The timeout to set
-
isUseReadOperation
boolean isUseReadOperation()Tell if the read operation is enabled- Returns:
trueif and only ifIoSession.read()operation is enabled. If enabled, all received messages are stored in an internalBlockingQueueso you can read received messages in more convenient way for client applications. Enabling this option is not useful to server applications and can cause unintended memory leak, and therefore it's disabled by default.
-
setUseReadOperation
void setUseReadOperation(boolean useReadOperation) Enables or disabledIoSession.read()operation. If enabled, all received messages are stored in an internalBlockingQueueso you can read received messages in more convenient way for client applications. Enabling this option is not useful to server applications and can cause unintended memory leak, and therefore it's disabled by default.- Parameters:
useReadOperation-trueif the read operation is enabled,falseotherwise
-
setAll
Sets all configuration properties retrieved from the specifiedconfig.- Parameters:
config- The configuration to use
-