Class AbstractIoSessionConfig

java.lang.Object
org.apache.mina.core.session.AbstractIoSessionConfig
All Implemented Interfaces:
IoSessionConfig
Direct Known Subclasses:
AbstractDatagramSessionConfig, AbstractSocketSessionConfig, DefaultVmPipeSessionConfig

public abstract class AbstractIoSessionConfig extends Object implements IoSessionConfig
A base implementation of IoSessionConfig.
  • Field Details

    • minReadBufferSize

      private int minReadBufferSize
      The minimum size of the buffer used to read incoming data
    • readBufferSize

      private int readBufferSize
      The default size of the buffer used to read incoming data
    • maxReadBufferSize

      private int maxReadBufferSize
      The maximum size of the buffer used to read incoming data
    • idleTimeForRead

      private int idleTimeForRead
      The delay before we notify a session that it has been idle on read. Default to infinite
    • idleTimeForWrite

      private int idleTimeForWrite
      The delay before we notify a session that it has been idle on write. Default to infinite
    • idleTimeForBoth

      private int idleTimeForBoth
      The delay before we notify a session that it has been idle on read and write. Default to infinite
    • writeTimeout

      private int writeTimeout
      The delay to wait for a write operation to complete before bailing out
    • useReadOperation

      private boolean useReadOperation
      A 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

      public void setAll(IoSessionConfig config)
      Sets all configuration properties retrieved from the specified config.
      Specified by:
      setAll in interface IoSessionConfig
      Parameters:
      config - The configuration to use
    • getReadBufferSize

      public int getReadBufferSize()
      Specified by:
      getReadBufferSize in interface IoSessionConfig
      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 interface IoSessionConfig
      Parameters:
      readBufferSize - The size of the read buffer
    • getMinReadBufferSize

      public int getMinReadBufferSize()
      Specified by:
      getMinReadBufferSize in interface IoSessionConfig
      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 interface IoSessionConfig
      Parameters:
      minReadBufferSize - The minimum size of the read buffer
    • getMaxReadBufferSize

      public int getMaxReadBufferSize()
      Specified by:
      getMaxReadBufferSize in interface IoSessionConfig
      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 interface IoSessionConfig
      Parameters:
      maxReadBufferSize - The maximum size of the read buffer
    • getIdleTime

      public int getIdleTime(IdleStatus status)
      Specified by:
      getIdleTime in interface IoSessionConfig
      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 interface IoSessionConfig
      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 interface IoSessionConfig
      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 interface IoSessionConfig
      Returns:
      idle time for IdleStatus.BOTH_IDLE in seconds.
    • getBothIdleTimeInMillis

      public final long getBothIdleTimeInMillis()
      Specified by:
      getBothIdleTimeInMillis in interface IoSessionConfig
      Returns:
      idle time for IdleStatus.BOTH_IDLE in milliseconds.
    • getReaderIdleTime

      public final int getReaderIdleTime()
      Specified by:
      getReaderIdleTime in interface IoSessionConfig
      Returns:
      idle time for IdleStatus.READER_IDLE in seconds.
    • getReaderIdleTimeInMillis

      public final long getReaderIdleTimeInMillis()
      Specified by:
      getReaderIdleTimeInMillis in interface IoSessionConfig
      Returns:
      idle time for IdleStatus.READER_IDLE in milliseconds.
    • getWriterIdleTime

      public final int getWriterIdleTime()
      Specified by:
      getWriterIdleTime in interface IoSessionConfig
      Returns:
      idle time for IdleStatus.WRITER_IDLE in seconds.
    • getWriterIdleTimeInMillis

      public final long getWriterIdleTimeInMillis()
      Specified by:
      getWriterIdleTimeInMillis in interface IoSessionConfig
      Returns:
      idle time for IdleStatus.WRITER_IDLE in milliseconds.
    • setBothIdleTime

      public void setBothIdleTime(int idleTime)
      Sets idle time for IdleStatus.WRITER_IDLE in seconds.
      Specified by:
      setBothIdleTime in interface IoSessionConfig
      Parameters:
      idleTime - The time to set
    • setReaderIdleTime

      public void setReaderIdleTime(int idleTime)
      Sets idle time for IdleStatus.READER_IDLE in seconds.
      Specified by:
      setReaderIdleTime in interface IoSessionConfig
      Parameters:
      idleTime - The time to set
    • setWriterIdleTime

      public void setWriterIdleTime(int idleTime)
      Sets idle time for IdleStatus.WRITER_IDLE in seconds.
      Specified by:
      setWriterIdleTime in interface IoSessionConfig
      Parameters:
      idleTime - The time to set
    • getWriteTimeout

      public int getWriteTimeout()
      Specified by:
      getWriteTimeout in interface IoSessionConfig
      Returns:
      write timeout in seconds.
    • getWriteTimeoutInMillis

      public long getWriteTimeoutInMillis()
      Specified by:
      getWriteTimeoutInMillis in interface IoSessionConfig
      Returns:
      write timeout in milliseconds.
    • setWriteTimeout

      public void setWriteTimeout(int writeTimeout)
      Sets write timeout in seconds.
      Specified by:
      setWriteTimeout in interface IoSessionConfig
      Parameters:
      writeTimeout - The timeout to set
    • isUseReadOperation

      public boolean isUseReadOperation()
      Specified by:
      isUseReadOperation in interface IoSessionConfig
      Returns:
      true if and only if IoSession.read() operation is enabled. If enabled, all received messages are stored in an internal BlockingQueue 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 disabled IoSession.read() operation. If enabled, all received messages are stored in an internal BlockingQueue 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 interface IoSessionConfig
      Parameters:
      useReadOperation - true if the read operation is enabled, false otherwise
    • getThroughputCalculationInterval

      public int getThroughputCalculationInterval()
      Specified by:
      getThroughputCalculationInterval in interface IoSessionConfig
      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 is 3 seconds.
      Specified by:
      setThroughputCalculationInterval in interface IoSessionConfig
      Parameters:
      throughputCalculationInterval - The interval
    • getThroughputCalculationIntervalInMillis

      public long getThroughputCalculationIntervalInMillis()
      Specified by:
      getThroughputCalculationIntervalInMillis in interface IoSessionConfig
      Returns:
      the interval (milliseconds) between each throughput calculation. The default value is 3 seconds.