Package io.aeron.driver.media
Class WildcardPortManager
java.lang.Object
io.aeron.driver.media.WildcardPortManager
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int[]Placeholder to represent an empty port range. -
Constructor Summary
ConstructorsConstructorDescriptionWildcardPortManager(int[] portRange, boolean isSender) Instantiate a wildcard port manager with the given port range. -
Method Summary
Modifier and TypeMethodDescriptionvoidfreeManagedPort(InetSocketAddress bindAddress) Called after the bound socket is to be closed.getManagedPort(UdpChannel udpChannel, InetSocketAddress bindAddress) Called before an OS bind to adjust the bound address and to notify of the bind for the port manager.static int[]parsePortRange(String value) Parse a port range in the format "low high".
-
Field Details
-
EMPTY_PORT_RANGE
public static final int[] EMPTY_PORT_RANGEPlaceholder 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 managerisSender- 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:
getManagedPortin interfacePortManager- 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
Called after the bound socket is to be closed.- Specified by:
freeManagedPortin interfacePortManager- Parameters:
bindAddress- used for the bind previously.
-
parsePortRange
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.
-