Class TCPIPLinkServer

  • All Implemented Interfaces:
    CSProcess

    class TCPIPLinkServer
    extends LinkServer
    implements CSProcess
    A process to accept links to a ServerSocket, create appropriate TCPIPLink objects, and register them with the LinkManager.

    This is a package-private implementation class.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int QUEUE_LENGTH  
      private java.net.ServerSocket serverSocket
      The socket to accept from.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TCPIPLinkServer​(java.net.ServerSocket serverSocket, boolean uniqueAddress)
      Private constructor.
    • Field Detail

      • serverSocket

        private final java.net.ServerSocket serverSocket
        The socket to accept from.
      • QUEUE_LENGTH

        private static int QUEUE_LENGTH
    • Constructor Detail

      • TCPIPLinkServer

        private TCPIPLinkServer​(java.net.ServerSocket serverSocket,
                                boolean uniqueAddress)
        Private constructor. To make life easier for you, you don't have to call this. Just use the static start() method in this class and a process will be created and executed for you.
        Parameters:
        socket - The ServerSocket to accept from
        See Also:
        #start(ServerSocket)
    • Method Detail

      • run

        public void run()
        Start accepting links and dealing with them. This method runs forever.
        Specified by:
        run in interface CSProcess
      • create

        protected static LinkServer create​(NodeAddressID addressID)
        Create a server on a specified NodeAddressID, and start it. The server is spawned off in parallel, so this call returns immediately. This NEEDS to be overridden.
        Parameters:
        addressID - The NodeAddressID to accept from
      • stop

        protected boolean stop()
        Stops the LinkServer. This NEEDS to be overridden.
        Overrides:
        stop in class LinkServer
        Returns:
        true iff the LinkServer has stopped.