Class AbstractIoSessionConfig
java.lang.Object
org.apache.mina.core.session.AbstractIoSessionConfig
- All Implemented Interfaces:
IoSessionConfig
- Direct Known Subclasses:
AbstractDatagramSessionConfig, AbstractSocketSessionConfig, DefaultVmPipeSessionConfig
A base implementation of
IoSessionConfig.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe delay before we notify a session that it has been idle on read and write.private intThe delay before we notify a session that it has been idle on read.private intThe delay before we notify a session that it has been idle on write.private intThe maximum size of the buffer used to read incoming dataprivate intThe minimum size of the buffer used to read incoming dataprivate intThe default size of the buffer used to read incoming dataprivate intprivate booleanA flag set to true when weallow the application to do a session.read().private intThe delay to wait for a write operation to complete before bailing out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal longintgetIdleTime(IdleStatus status) longgetIdleTimeInMillis(IdleStatus status) intintintfinal intfinal longintlongfinal intfinal longintlongbooleanvoidsetAll(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.
-
Field Details
-
minReadBufferSize
private int minReadBufferSizeThe minimum size of the buffer used to read incoming data -
readBufferSize
private int readBufferSizeThe default size of the buffer used to read incoming data -
maxReadBufferSize
private int maxReadBufferSizeThe maximum size of the buffer used to read incoming data -
idleTimeForRead
private int idleTimeForReadThe delay before we notify a session that it has been idle on read. Default to infinite -
idleTimeForWrite
private int idleTimeForWriteThe delay before we notify a session that it has been idle on write. Default to infinite -
idleTimeForBoth
private int idleTimeForBothThe delay before we notify a session that it has been idle on read and write. Default to infinite -
writeTimeout
private int writeTimeoutThe delay to wait for a write operation to complete before bailing out -
useReadOperation
private boolean useReadOperationA flag set to true when weallow the application to do a session.read(). Default to false -
throughputCalculationInterval
private int throughputCalculationInterval
-
-
Constructor Details
-
AbstractIoSessionConfig
protected AbstractIoSessionConfig()
-
-
Method Details
-
setAll
Sets all configuration properties retrieved from the specifiedconfig.- Specified by:
setAllin interfaceIoSessionConfig- Parameters:
config- The configuration to use
-
getReadBufferSize
public int getReadBufferSize()- Specified by:
getReadBufferSizein 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:
setReadBufferSizein interfaceIoSessionConfig- Parameters:
readBufferSize- The size of the read buffer
-
getMinReadBufferSize
public int getMinReadBufferSize()- Specified by:
getMinReadBufferSizein 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:
setMinReadBufferSizein interfaceIoSessionConfig- Parameters:
minReadBufferSize- The minimum size of the read buffer
-
getMaxReadBufferSize
public int getMaxReadBufferSize()- Specified by:
getMaxReadBufferSizein 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:
setMaxReadBufferSizein interfaceIoSessionConfig- Parameters:
maxReadBufferSize- The maximum size of the read buffer
-
getIdleTime
- Specified by:
getIdleTimein 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
- Specified by:
getIdleTimeInMillisin 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
Sets idle time for the specified type of idleness in seconds.- Specified by:
setIdleTimein 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:
getBothIdleTimein interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.BOTH_IDLEin seconds.
-
getBothIdleTimeInMillis
public final long getBothIdleTimeInMillis()- Specified by:
getBothIdleTimeInMillisin interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.BOTH_IDLEin milliseconds.
-
getReaderIdleTime
public final int getReaderIdleTime()- Specified by:
getReaderIdleTimein interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.READER_IDLEin seconds.
-
getReaderIdleTimeInMillis
public final long getReaderIdleTimeInMillis()- Specified by:
getReaderIdleTimeInMillisin interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.READER_IDLEin milliseconds.
-
getWriterIdleTime
public final int getWriterIdleTime()- Specified by:
getWriterIdleTimein interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.WRITER_IDLEin seconds.
-
getWriterIdleTimeInMillis
public final long getWriterIdleTimeInMillis()- Specified by:
getWriterIdleTimeInMillisin interfaceIoSessionConfig- Returns:
- idle time for
IdleStatus.WRITER_IDLEin milliseconds.
-
setBothIdleTime
public void setBothIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.- Specified by:
setBothIdleTimein interfaceIoSessionConfig- Parameters:
idleTime- The time to set
-
setReaderIdleTime
public void setReaderIdleTime(int idleTime) Sets idle time forIdleStatus.READER_IDLEin seconds.- Specified by:
setReaderIdleTimein interfaceIoSessionConfig- Parameters:
idleTime- The time to set
-
setWriterIdleTime
public void setWriterIdleTime(int idleTime) Sets idle time forIdleStatus.WRITER_IDLEin seconds.- Specified by:
setWriterIdleTimein interfaceIoSessionConfig- Parameters:
idleTime- The time to set
-
getWriteTimeout
public int getWriteTimeout()- Specified by:
getWriteTimeoutin interfaceIoSessionConfig- Returns:
- write timeout in seconds.
-
getWriteTimeoutInMillis
public long getWriteTimeoutInMillis()- Specified by:
getWriteTimeoutInMillisin interfaceIoSessionConfig- Returns:
- write timeout in milliseconds.
-
setWriteTimeout
public void setWriteTimeout(int writeTimeout) Sets write timeout in seconds.- Specified by:
setWriteTimeoutin interfaceIoSessionConfig- Parameters:
writeTimeout- The timeout to set
-
isUseReadOperation
public boolean isUseReadOperation()- Specified by:
isUseReadOperationin interfaceIoSessionConfig- 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
public 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.- Specified by:
setUseReadOperationin interfaceIoSessionConfig- Parameters:
useReadOperation-trueif the read operation is enabled,falseotherwise
-
getThroughputCalculationInterval
public int getThroughputCalculationInterval()- Specified by:
getThroughputCalculationIntervalin interfaceIoSessionConfig- Returns:
- the interval (seconds) between each throughput calculation.
The default value is
3seconds.
-
setThroughputCalculationInterval
public void setThroughputCalculationInterval(int throughputCalculationInterval) Sets the interval (seconds) between each throughput calculation. The default value is3seconds.- Specified by:
setThroughputCalculationIntervalin interfaceIoSessionConfig- Parameters:
throughputCalculationInterval- The interval
-
getThroughputCalculationIntervalInMillis
public long getThroughputCalculationIntervalInMillis()- Specified by:
getThroughputCalculationIntervalInMillisin interfaceIoSessionConfig- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3seconds.
-