Class TransportFilter

    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • openedConnections

        private static final java.util.concurrent.atomic.AtomicInteger openedConnections
      • connectionCloseScheduler

        private static final java.util.concurrent.ScheduledExecutorService connectionCloseScheduler
      • channelGroup

        private static volatile java.nio.channels.AsynchronousChannelGroup channelGroup
      • closeWaitTask

        private static volatile java.util.concurrent.ScheduledFuture<?> closeWaitTask
      • currentContainerIdleTimeout

        private static volatile java.lang.Integer currentContainerIdleTimeout
        Idle timeout that will be used when closing current channelGroup
      • inputBufferSize

        private final int inputBufferSize
      • containerIdleTimeout

        private final int containerIdleTimeout
      • socketChannel

        private volatile java.nio.channels.AsynchronousSocketChannel socketChannel
    • Constructor Detail

      • TransportFilter

        TransportFilter​(int inputBufferSize,
                        ThreadPoolConfig threadPoolConfig,
                        int containerIdleTimeout)
        Constructor.

        If the channel group is not active (all connections have been closed and the shutdown timeout is running) and a new transport is created with tread pool configuration different from the one of the current thread pool, the current thread pool will be shut down and a new one created with the new configuration.

        Parameters:
        inputBufferSize - size of buffer to be allocated for reading data from a socket.
        threadPoolConfig - thread pool configuration used for creating thread pool.
        containerIdleTimeout - idle time after which the shared thread pool will be destroyed.
    • Method Detail

      • write

        void write​(java.nio.ByteBuffer data,
                   CompletionHandler<java.nio.ByteBuffer> completionHandler)
        Description copied from class: Filter
        Perform write operation for this filter and invokes write method on the next filter in the filter chain.
        Overrides:
        write in class Filter<java.nio.ByteBuffer,​java.nio.ByteBuffer,​java.lang.Void,​java.nio.ByteBuffer>
        Parameters:
        data - on which write operation is performed.
        completionHandler - will be invoked when the write operation is completed or has failed.
      • close

        void close()
        Description copied from class: Filter
        Close the filter, invokes close operation on the next filter in the filter chain.

        The filter is expected to clean up any allocated resources and pass the invocation to downstream filter.

        Overrides:
        close in class Filter<java.nio.ByteBuffer,​java.nio.ByteBuffer,​java.lang.Void,​java.nio.ByteBuffer>
      • startSsl

        void startSsl()
        Description copied from class: Filter
        Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.
        Overrides:
        startSsl in class Filter<java.nio.ByteBuffer,​java.nio.ByteBuffer,​java.lang.Void,​java.nio.ByteBuffer>
      • updateThreadPoolConfig

        private void updateThreadPoolConfig()
      • initializeChannelGroup

        private void initializeChannelGroup()
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _read

        private void _read​(java.nio.ByteBuffer inputBuffer)
      • scheduleClose

        private void scheduleClose()