public interface PortService
Modifier and Type | Interface and Description |
---|---|
static interface |
PortService.Lock
Interface used to mark boundaries of transactions grouping several atomic PortService operations.
|
Modifier and Type | Method and Description |
---|---|
PortService.Lock |
acquirePortLock()
May be used to group several operations related to port query/release/lookup
|
java.util.Set<java.lang.Integer> |
findUsedPortByContainer(Container container)
Returns all the registered ports of the
Container . |
java.util.Set<java.lang.Integer> |
findUsedPortByHost(Container container)
Returns all the registered ports for the address of the
Container . |
java.util.Set<java.lang.Integer> |
findUsedPortByHost(Container container,
PortService.Lock lock)
Returns all the registered ports for the address of the
Container . |
int |
lookupPort(Container container,
java.lang.String pid,
java.lang.String key)
Looks up the registry and returns a registered port.
|
void |
registerPort(Container container,
java.lang.String pid,
java.lang.String key,
int port)
Registers a port to the registry.
|
int |
registerPort(Container container,
java.lang.String pid,
java.lang.String key,
int fromPort,
int toPort,
java.util.Set<java.lang.Integer> excludes)
Registers a port from the specified range to the registry.
|
void |
registerPort(Container container,
java.lang.String pid,
java.lang.String key,
int port,
PortService.Lock lock)
Registers a port to the registry.
|
void |
releasePortLock(PortService.Lock lock)
Releases lock obtained by
acquirePortLock() |
void |
unregisterPort(Container container)
Un-register the ports bound to the container.
|
void |
unregisterPort(Container container,
java.lang.String pid)
Un-register the ports bound to the specific pid.
|
void |
unregisterPort(Container container,
java.lang.String pid,
java.lang.String key)
Un-register the port bound to the specified pid and key.
|
int registerPort(Container container, java.lang.String pid, java.lang.String key, int fromPort, int toPort, java.util.Set<java.lang.Integer> excludes)
container
- The Container
under which the port will be registered.pid
- The pid that is using the registered port.key
- The key of the pid that requires the port.fromPort
- The lower bound of the range.toPort
- The upper bound of the range.excludes
- A set of ports to ignore.void registerPort(Container container, java.lang.String pid, java.lang.String key, int port)
container
- The Container
under which the port will be registered.pid
- The pid that is using the registered port.key
- The key of the pid that requires the port.port
- The actual port number.void registerPort(Container container, java.lang.String pid, java.lang.String key, int port, PortService.Lock lock)
container
- The Container
under which the port will be registered.pid
- The pid that is using the registered port.key
- The key of the pid that requires the port.port
- The actual port number.lock
- Externally controller PortService.Lockvoid unregisterPort(Container container, java.lang.String pid, java.lang.String key)
container
- pid
- key
- void unregisterPort(Container container, java.lang.String pid)
container
- pid
- void unregisterPort(Container container)
container
- int lookupPort(Container container, java.lang.String pid, java.lang.String key)
container
- The Container
to lookup.pid
- The pid to use for the lookup.key
- The key of the pid.java.util.Set<java.lang.Integer> findUsedPortByHost(Container container)
Container
.
The method takes into consideration ports of other containers co-located with the target.container
- java.util.Set<java.lang.Integer> findUsedPortByHost(Container container, PortService.Lock lock)
Container
.
The method takes into consideration ports of other containers co-located with the target.
This method, after acquiring a lock, may be used as part of broader transaction related
to port manipulation.container
- lock
- java.util.Set<java.lang.Integer> findUsedPortByContainer(Container container)
Container
.container
- PortService.Lock acquirePortLock() throws java.lang.Exception
java.lang.Exception
void releasePortLock(PortService.Lock lock)
acquirePortLock()
lock
- Copyright © 2016 Red Hat. All Rights Reserved.