Class ServerEndpoint


  • public class ServerEndpoint
    extends Object
    A server endpoint. This endpoint listens on a specified port and host IP for incoming connections from client endpoints. When a connection is established, it spawns a new Endpoint for that specific connection and continues listening for more connections.
    Author:
    Rene Schneider - initial API and implementation
    • Constructor Detail

      • ServerEndpoint

        public ServerEndpoint​(String aHostIP,
                              int aPort,
                              Map<Class<? extends AbstractMessage>,​MessageProcessor<?>> aProcessorMap,
                              ClassLoader aClassLoader,
                              boolean anIsForkFlag)
                       throws UnknownHostException,
                              IOException
        Creates a new server endpoint that listens on a specified port/IP.
        Parameters:
        aHostIP - the host IP to listen on
        aPort - the port to bind to (0 = auto-choose a free port)
        aProcessorMap - the map of processors to use for processing incoming messages
        aClassLoader - the classloader to use when deserializing objects
        anIsForkFlag - whether this server endpoint is serving inside an Integrity fork process
        Throws:
        UnknownHostException
        IOException
    • Method Detail

      • isActive

        public boolean isActive()
      • getPort

        public int getPort()
        Returns the port number on which the server endpoint is listening.
        Returns:
      • closeAll

        public void closeAll​(boolean anEmptyOutputQueueFlag)
        Closes the server endpoint and all endpoints currently active.
        Parameters:
        anEmptyOutputQueueFlag - whether output queues to the endpoints shall be emptied before closing the connection.
      • broadcastMessage

        public void broadcastMessage​(AbstractMessage aMessage)
        Broadcasts a message to all active endpoints.
        Parameters:
        aMessage - the message