Package org.apache.mina.core.session
Interface IoSessionConfig
-
- All Known Subinterfaces:
DatagramSessionConfig
,SerialSessionConfig
,SocketSessionConfig
,VmPipeSessionConfig
- All Known Implementing Classes:
AbstractDatagramSessionConfig
,AbstractIoSessionConfig
,AbstractSocketSessionConfig
,DefaultDatagramSessionConfig
,DefaultSocketSessionConfig
public interface IoSessionConfig
The configuration ofIoSession
.- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getBothIdleTime()
long
getBothIdleTimeInMillis()
int
getIdleTime(IdleStatus status)
long
getIdleTimeInMillis(IdleStatus status)
int
getMaxReadBufferSize()
int
getMinReadBufferSize()
int
getReadBufferSize()
int
getReaderIdleTime()
long
getReaderIdleTimeInMillis()
int
getThroughputCalculationInterval()
long
getThroughputCalculationIntervalInMillis()
int
getWriterIdleTime()
long
getWriterIdleTimeInMillis()
int
getWriteTimeout()
long
getWriteTimeoutInMillis()
boolean
isUseReadOperation()
void
setAll(IoSessionConfig config)
Sets all configuration properties retrieved from the specifiedconfig
.void
setBothIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.void
setIdleTime(IdleStatus status, int idleTime)
Sets idle time for the specified type of idleness in seconds.void
setMaxReadBufferSize(int maxReadBufferSize)
Sets the maximum size of the read buffer that I/O processor allocates per each read.void
setMinReadBufferSize(int minReadBufferSize)
Sets the minimum size of the read buffer that I/O processor allocates per each read.void
setReadBufferSize(int readBufferSize)
Sets the size of the read buffer that I/O processor allocates per each read.void
setReaderIdleTime(int idleTime)
Sets idle time forIdleStatus.READER_IDLE
in seconds.void
setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation.void
setUseReadOperation(boolean useReadOperation)
Enables or disabledIoSession.read()
operation.void
setWriterIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.void
setWriteTimeout(int writeTimeout)
Sets write timeout in seconds.
-
-
-
Method Detail
-
getReadBufferSize
int getReadBufferSize()
- 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()
- 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()
- 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()
- Returns:
- the interval (seconds) between each throughput calculation.
The default value is
3
seconds.
-
getThroughputCalculationIntervalInMillis
long getThroughputCalculationIntervalInMillis()
- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3
seconds.
-
setThroughputCalculationInterval
void setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation. The default value is3
seconds.- Parameters:
throughputCalculationInterval
- The interval
-
getIdleTime
int getIdleTime(IdleStatus status)
- 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
long getIdleTimeInMillis(IdleStatus status)
- 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
void setIdleTime(IdleStatus status, int idleTime)
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()
- Returns:
- idle time for
IdleStatus.READER_IDLE
in seconds.
-
getReaderIdleTimeInMillis
long getReaderIdleTimeInMillis()
- Returns:
- idle time for
IdleStatus.READER_IDLE
in milliseconds.
-
setReaderIdleTime
void setReaderIdleTime(int idleTime)
Sets idle time forIdleStatus.READER_IDLE
in seconds.- Parameters:
idleTime
- The time to set
-
getWriterIdleTime
int getWriterIdleTime()
- Returns:
- idle time for
IdleStatus.WRITER_IDLE
in seconds.
-
getWriterIdleTimeInMillis
long getWriterIdleTimeInMillis()
- Returns:
- idle time for
IdleStatus.WRITER_IDLE
in milliseconds.
-
setWriterIdleTime
void setWriterIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.- Parameters:
idleTime
- The time to set
-
getBothIdleTime
int getBothIdleTime()
- Returns:
- idle time for
IdleStatus.BOTH_IDLE
in seconds.
-
getBothIdleTimeInMillis
long getBothIdleTimeInMillis()
- Returns:
- idle time for
IdleStatus.BOTH_IDLE
in milliseconds.
-
setBothIdleTime
void setBothIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.- Parameters:
idleTime
- The time to set
-
getWriteTimeout
int getWriteTimeout()
- Returns:
- write timeout in seconds.
-
getWriteTimeoutInMillis
long getWriteTimeoutInMillis()
- Returns:
- write timeout in milliseconds.
-
setWriteTimeout
void setWriteTimeout(int writeTimeout)
Sets write timeout in seconds.- Parameters:
writeTimeout
- The timeout to set
-
isUseReadOperation
boolean isUseReadOperation()
- Returns:
true
if and only ifIoSession.read()
operation is enabled. If enabled, all received messages are stored in an internalBlockingQueue
so 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 internalBlockingQueue
so 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
-true
if the read operation is enabled,false
otherwise
-
setAll
void setAll(IoSessionConfig config)
Sets all configuration properties retrieved from the specifiedconfig
.- Parameters:
config
- The configuration to use
-
-