Class WildcardPortManager

java.lang.Object
io.aeron.driver.media.WildcardPortManager
All Implemented Interfaces:
PortManager

public class WildcardPortManager extends Object implements PortManager
Class for managing wildcard ports for UDP channel transports within a specific range.

Does not track per interface, but as a range over all interfaces.

  • Field Details

    • EMPTY_PORT_RANGE

      public static final int[] EMPTY_PORT_RANGE
      Placeholder to represent an empty port range.
  • Constructor Details

    • WildcardPortManager

      public WildcardPortManager(int[] portRange, boolean isSender)
      Instantiate a wildcard port manager with the given port range.
      Parameters:
      portRange - for the port manager
      isSender - for this port manager
  • Method Details

    • getManagedPort

      public InetSocketAddress getManagedPort(UdpChannel udpChannel, InetSocketAddress bindAddress) throws BindException
      Called before an OS bind to adjust the bound address and to notify of the bind for the port manager.
      Specified by:
      getManagedPort in interface PortManager
      Parameters:
      udpChannel - for the UDP endpoint being bound.
      bindAddress - for the bind.
      Returns:
      InetSocketAddress to use for the bind.
      Throws:
      BindException - if the bind should not be performed.
    • freeManagedPort

      public void freeManagedPort(InetSocketAddress bindAddress)
      Called after the bound socket is to be closed.
      Specified by:
      freeManagedPort in interface PortManager
      Parameters:
      bindAddress - used for the bind previously.
    • parsePortRange

      public static int[] parsePortRange(String value)
      Parse a port range in the format "low high".
      Parameters:
      value - for the port range in string format.
      Returns:
      port range as low index 0 and high index 1.