Package org.apache.mina.core.session
Class AbstractIoSessionConfig
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSessionConfig
-
- All Implemented Interfaces:
IoSessionConfig
- Direct Known Subclasses:
AbstractDatagramSessionConfig
,AbstractSocketSessionConfig
public abstract class AbstractIoSessionConfig extends Object implements IoSessionConfig
A base implementation ofIoSessionConfig
.- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractIoSessionConfig()
-
Method Summary
All Methods Instance Methods Concrete 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
-
setAll
public void setAll(IoSessionConfig config)
Sets all configuration properties retrieved from the specifiedconfig
.- Specified by:
setAll
in interfaceIoSessionConfig
- Parameters:
config
- The configuration to use
-
getReadBufferSize
public int getReadBufferSize()
- Specified by:
getReadBufferSize
in interfaceIoSessionConfig
- 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
public 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.- Specified by:
setReadBufferSize
in interfaceIoSessionConfig
- Parameters:
readBufferSize
- The size of the read buffer
-
getMinReadBufferSize
public int getMinReadBufferSize()
- Specified by:
getMinReadBufferSize
in interfaceIoSessionConfig
- 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
public 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.- Specified by:
setMinReadBufferSize
in interfaceIoSessionConfig
- Parameters:
minReadBufferSize
- The minimum size of the read buffer
-
getMaxReadBufferSize
public int getMaxReadBufferSize()
- Specified by:
getMaxReadBufferSize
in interfaceIoSessionConfig
- 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
public 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.- Specified by:
setMaxReadBufferSize
in interfaceIoSessionConfig
- Parameters:
maxReadBufferSize
- The maximum size of the read buffer
-
getIdleTime
public int getIdleTime(IdleStatus status)
- Specified by:
getIdleTime
in interfaceIoSessionConfig
- 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
public long getIdleTimeInMillis(IdleStatus status)
- Specified by:
getIdleTimeInMillis
in interfaceIoSessionConfig
- 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
public void setIdleTime(IdleStatus status, int idleTime)
Sets idle time for the specified type of idleness in seconds.- Specified by:
setIdleTime
in interfaceIoSessionConfig
- 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
-
getBothIdleTime
public final int getBothIdleTime()
- Specified by:
getBothIdleTime
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.BOTH_IDLE
in seconds.
-
getBothIdleTimeInMillis
public final long getBothIdleTimeInMillis()
- Specified by:
getBothIdleTimeInMillis
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.BOTH_IDLE
in milliseconds.
-
getReaderIdleTime
public final int getReaderIdleTime()
- Specified by:
getReaderIdleTime
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.READER_IDLE
in seconds.
-
getReaderIdleTimeInMillis
public final long getReaderIdleTimeInMillis()
- Specified by:
getReaderIdleTimeInMillis
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.READER_IDLE
in milliseconds.
-
getWriterIdleTime
public final int getWriterIdleTime()
- Specified by:
getWriterIdleTime
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.WRITER_IDLE
in seconds.
-
getWriterIdleTimeInMillis
public final long getWriterIdleTimeInMillis()
- Specified by:
getWriterIdleTimeInMillis
in interfaceIoSessionConfig
- Returns:
- idle time for
IdleStatus.WRITER_IDLE
in milliseconds.
-
setBothIdleTime
public void setBothIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.- Specified by:
setBothIdleTime
in interfaceIoSessionConfig
- Parameters:
idleTime
- The time to set
-
setReaderIdleTime
public void setReaderIdleTime(int idleTime)
Sets idle time forIdleStatus.READER_IDLE
in seconds.- Specified by:
setReaderIdleTime
in interfaceIoSessionConfig
- Parameters:
idleTime
- The time to set
-
setWriterIdleTime
public void setWriterIdleTime(int idleTime)
Sets idle time forIdleStatus.WRITER_IDLE
in seconds.- Specified by:
setWriterIdleTime
in interfaceIoSessionConfig
- Parameters:
idleTime
- The time to set
-
getWriteTimeout
public int getWriteTimeout()
- Specified by:
getWriteTimeout
in interfaceIoSessionConfig
- Returns:
- write timeout in seconds.
-
getWriteTimeoutInMillis
public long getWriteTimeoutInMillis()
- Specified by:
getWriteTimeoutInMillis
in interfaceIoSessionConfig
- Returns:
- write timeout in milliseconds.
-
setWriteTimeout
public void setWriteTimeout(int writeTimeout)
Sets write timeout in seconds.- Specified by:
setWriteTimeout
in interfaceIoSessionConfig
- Parameters:
writeTimeout
- The timeout to set
-
isUseReadOperation
public boolean isUseReadOperation()
- Specified by:
isUseReadOperation
in interfaceIoSessionConfig
- 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
public 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.- Specified by:
setUseReadOperation
in interfaceIoSessionConfig
- Parameters:
useReadOperation
-true
if the read operation is enabled,false
otherwise
-
getThroughputCalculationInterval
public int getThroughputCalculationInterval()
- Specified by:
getThroughputCalculationInterval
in interfaceIoSessionConfig
- Returns:
- the interval (seconds) between each throughput calculation.
The default value is
3
seconds.
-
setThroughputCalculationInterval
public void setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation. The default value is3
seconds.- Specified by:
setThroughputCalculationInterval
in interfaceIoSessionConfig
- Parameters:
throughputCalculationInterval
- The interval
-
getThroughputCalculationIntervalInMillis
public long getThroughputCalculationIntervalInMillis()
- Specified by:
getThroughputCalculationIntervalInMillis
in interfaceIoSessionConfig
- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3
seconds.
-
-