Class SocketManager


  • public class SocketManager
    extends java.lang.Object
    Manages the Socket interaction.
    Author:
    Daniel Sagenschneider
    • Field Detail

      • DEFAULT_SERVER_SOCKET_BACKLOG_SIZE

        public static final int DEFAULT_SERVER_SOCKET_BACKLOG_SIZE
        Default ServerSocket backlog size.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SocketManager

        public SocketManager​(int listenerCount,
                             int socketReceiveBufferSize,
                             int maxReadsOnSelect,
                             StreamBufferPool<java.nio.ByteBuffer> bufferPool,
                             int socketSendBufferSize)
                      throws java.io.IOException
        Instantiate.
        Parameters:
        listenerCount - Number of SocketManager.SocketListener instances.
        socketReceiveBufferSize - Receive buffer size for the Socket.
        maxReadsOnSelect - Maximum number of reads per SocketChannel per select. The Selector has locking overheads that slow performance. By undertaking multiple reads on the SocketChannel it makes draining and servicing more efficient (and subsequently faster). This also allows the StreamBuffer sizes to be smaller than the receive Socket buffer size (but still maintain efficiency).
        bufferPool - StreamBufferPool.
        socketSendBufferSize - Send buffer size for the Socket.
        Throws:
        java.io.IOException - If fails to initialise Socket management.