Class ServerPortRegistry

  • public class ServerPortRegistry
    extends Object
    This class holds a collection of of all server ports that are formally registered to the platform. To get an open port for the platform, create a ServerPort object and register it with ServerPortRegistry.addPort. The physical port number can then be assigned with ServerPort#assignPort().
    • Method Detail

      • addPort

        public static void addPort​(ServerPort serverPort)
        Add a port to the Server's port registry. To ensure that no other server instance on this host uses the same port, the port should be opened when karaf starts, or, if karaf has started, the socket should be opened immediately after calling this method.
        serverPort -
      • addService

        public static void addService​(Service service)
        Adds a ServicePortService to the ServerPortRegistry. ServerPorts can be grouped by Service
        service - The Service to register. Once registered, ServerPorts can be associated with this Service.
      • removePort

        public static void removePort​(ServerPort serverPort)
        Removes a port from the ServerPortRegistry and any Service it belongs to.
        serverPort -
      • clear

        public static void clear()
        Clear the service port registry. Should only be called if resources have been closed.
      • getService

        public static Service getService​(String serviceName)
        Returns the Service associated with the given service name or null, if none exist.
        serviceName - The service name.
      • getPort

        public static ServerPort getPort​(String portId)
        Returns the ServerPort associated with the given portId or null, none exist.
        portId - The id of the server port.
      • getServices

        public static Set<Service> getServices()
        Returns all registered Services.