public class PortAllocator extends Object
Given a port range and a set of used ports it will randomly search through the port range until it finds an available port and claim it. Static ports are simply checked against the used ports.
| Constructor and Description |
|---|
PortAllocator(int start,
int end) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Integer> |
allocate(Map<String,com.spotify.helios.common.descriptors.PortMapping> ports,
Set<Integer> used)
Allocate ports for port mappings with no external ports configured.
|
public Map<String,Integer> allocate(Map<String,com.spotify.helios.common.descriptors.PortMapping> ports, Set<Integer> used)
ports - A map of port mappings for a container, both with statically configured
external ports and dynamic unconfigured external ports.used - A set of used ports. The ports allocated will not clash with these ports.Copyright © 2017. All rights reserved.