Interface ChannelConfig

    • Method Detail

      • setOptions

        boolean setOptions​(java.util.Map<ChannelOption<?>,​?> options)
        Sets the configuration properties from the specified Map.
      • setOption

        <T> boolean setOption​(ChannelOption<T> option,
                              T value)
        Sets a configuration property with the specified name and value. To override this method properly, you must call the super class:
         public boolean setOption(ChannelOption<T> option, T value) {
             if (super.setOption(option, value)) {
                 return true;
             }
        
             if (option.equals(additionalOption)) {
                 ....
                 return true;
             }
        
             return false;
         }
         
        Returns:
        true if and only if the property has been set
      • getConnectTimeoutMillis

        int getConnectTimeoutMillis()
        Returns the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.
        Returns:
        the connect timeout in milliseconds. 0 if disabled.
      • setConnectTimeoutMillis

        ChannelConfig setConnectTimeoutMillis​(int connectTimeoutMillis)
        Sets the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.
        Parameters:
        connectTimeoutMillis - the connect timeout in milliseconds. 0 to disable.
      • getWriteSpinCount

        int getWriteSpinCount()
        Returns the maximum loop count for a write operation until WritableByteChannel.write(ByteBuffer) returns a non-zero value. It is similar to what a spin lock is used for in concurrency programming. It improves memory utilization and write throughput depending on the platform that JVM runs on. The default value is 16.
      • setWriteSpinCount

        ChannelConfig setWriteSpinCount​(int writeSpinCount)
        Sets the maximum loop count for a write operation until WritableByteChannel.write(ByteBuffer) returns a non-zero value. It is similar to what a spin lock is used for in concurrency programming. It improves memory utilization and write throughput depending on the platform that JVM runs on. The default value is 16.
        Throws:
        java.lang.IllegalArgumentException - if the specified value is 0 or less than 0
      • isAutoRead

        boolean isAutoRead()
        Returns true if and only if ChannelHandlerContext.read() will be invoked automatically so that a user application doesn't need to call it at all. The default value is true.
      • setAutoRead

        ChannelConfig setAutoRead​(boolean autoRead)
        Sets if ChannelHandlerContext.read() will be invoked automatically so that a user application doesn't need to call it at all. The default value is true.
      • isAutoClose

        boolean isAutoClose()
        Returns true if and only if the Channel will be closed automatically and immediately on write failure. The default is true.
      • setAutoClose

        ChannelConfig setAutoClose​(boolean autoClose)
        Sets whether the Channel should be closed automatically and immediately on write failure. The default is true.
      • getWriteBufferHighWaterMark

        int getWriteBufferHighWaterMark()
        Returns the high water mark of the write buffer. If the number of bytes queued in the write buffer exceeds this value, Channel.isWritable() will start to return false.
      • setWriteBufferHighWaterMark

        ChannelConfig setWriteBufferHighWaterMark​(int writeBufferHighWaterMark)

        Sets the high water mark of the write buffer. If the number of bytes queued in the write buffer exceeds this value, Channel.isWritable() will start to return false.

      • getWriteBufferLowWaterMark

        int getWriteBufferLowWaterMark()
        Returns the low water mark of the write buffer. Once the number of bytes queued in the write buffer exceeded the high water mark and then dropped down below this value, Channel.isWritable() will start to return true again.
      • setWriteBufferLowWaterMark

        ChannelConfig setWriteBufferLowWaterMark​(int writeBufferLowWaterMark)

        Sets the low water mark of the write buffer. Once the number of bytes queued in the write buffer exceeded the high water mark and then dropped down below this value, Channel.isWritable() will start to return true again.