Class ReservedPorts


  • public final class ReservedPorts
    extends java.lang.Object
    Identifies reserved ports on a platform.

    More recent releases of Microsoft Windows has the ability, by API or command, to reserve a port for use by an application. While typical usage would be to reserve an ephemeral/dynamic port, reservation is not restricted to these ports so reserved ports need to be avoided in PortManager processing.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  ReservedPorts.Linux
      Determine the reserved ports on a Linux platform.
      private static class  ReservedPorts.Windows
      Determine the reserved ports on a Windows platform.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger LOGGER  
    • Constructor Summary

      Constructors 
      Constructor Description
      ReservedPorts()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static java.util.List<EphemeralPorts.Range> getRange()
      Gets the list of port ranges considered reserved by the platform.
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
    • Constructor Detail

      • ReservedPorts

        public ReservedPorts()
    • Method Detail

      • getRange

        static java.util.List<EphemeralPorts.Range> getRange()
        Gets the list of port ranges considered reserved by the platform.

        This list is calculated for each call to this method; since determining the list of reserved ports is likely to be expensive, repeated calls should be avoided.

        Returns:
        a list, possibly empty, of reserved port ranges
      • main

        public static void main​(java.lang.String[] args)