PortManagerImpl, PortManagerSingletonpublic interface PortManager
| Modifier and Type | Method | Description |
|---|---|---|
Integer |
bindAnyPort() |
Any free port in the range as defined by
PortRange.DYNAMIC_PORTS
is bound (reserved) and returned. |
default Integer |
bindNextPort(int aBeginPortIndex) |
The first free port in the range of the given Port-Number and the
PortRange.DYNAMIC_PORTS max port number (as of
PortRange.getMaxValue()) bound (reserved) and returned. |
Integer |
bindNextPort(int aBeginPortIndex,
int aEndPortIndex) |
The first free port in the range of the given begin Port-Number index and
the given end Port-Number index is bound (reserved) and returned.
|
default Integer |
bindNextPort(PortRange aPortRange) |
The first free port in the range of the given begin Port-Number index and
the given end Port-Number index is bound (reserved) and returned.
|
Integer |
bindPort(int aPortNumber) |
The port is bound and returned.
|
default boolean |
isPortAvaialble(int aPortNumber) |
Tests whether there is already some Server-Socket technically bound to
the given port.
|
boolean |
isPortBound(int aPortNumber) |
Determines whether the given Port-Number is already in use.
|
boolean |
unbindPort(Integer aPortNumber) |
Unbinds a port for the given Port-Number using the
Integer as
handle for unbinding. |
boolean isPortBound(int aPortNumber)
bindPort(int), bindAnyPort() or
bindNextPort(int)) or if the port is already in use and cannot
be bound, e.g. there is already some Server-Socket technically bound to
the given port.aPortNumber - The port number to be tested if it is already bound.Integer bindAnyPort() throws PortNotFoundRuntimeException
PortRange.DYNAMIC_PORTS
is bound (reserved) and returned. A port is aught to be free when
isPortBound(int) returns false.Integer instance is the
handle for unbinding a port via unbindPort(Integer).PortNotFoundRuntimeException - thrown in case no port can be
determined.Integer bindPort(int aPortNumber) throws PortAlreadyBoundException
isPortBound(int) returns false.aPortNumber - The Port-Number which to bind (reserve).Integerinstance is the
handle for unbinding a port via unbindPort(Integer).PortAlreadyBoundException - the port already bound exceptionboolean unbindPort(Integer aPortNumber) throws IllegalArgumentException
Integer as
handle for unbinding. This means that another Integer instance
with another identity fails to unbind the given port.aPortNumber - The Port-Number for the port to be unbound.IllegalArgumentException - thrown in case the ginven
Integer identity is not allowed to unbind the given port.default Integer bindNextPort(int aBeginPortIndex) throws PortNotFoundRuntimeException
PortRange.DYNAMIC_PORTS max port number (as of
PortRange.getMaxValue()) bound (reserved) and returned. A port is
aught to be free when isPortBound(int) returns false.aBeginPortIndex - The start index of the Port-Number which to bind
(reserve).Integer instance
is the handle for unbinding a port via
unbindPort(Integer).PortNotFoundRuntimeException - thrown in case no port can be
determined.default Integer bindNextPort(PortRange aPortRange)
isPortBound(int) returns false.aPortRange - The begin index (included) of the Port-Number which to
bind (reserve)and the end index (included) of the Port-Number
which to bind (reserve).Integer instance
is the handle for unbinding a port via
unbindPort(Integer).Integer bindNextPort(int aBeginPortIndex, int aEndPortIndex) throws PortNotFoundRuntimeException
isPortBound(int) returns false.aBeginPortIndex - The begin index (included) of the Port-Number
which to bind (reserve).aEndPortIndex - The end index (included) of the Port-Number which to
bind (reserve).Integer instance
is the handle for unbinding a port via
unbindPort(Integer).PortNotFoundRuntimeException - thrown in case no port can be
determined.default boolean isPortAvaialble(int aPortNumber)
aPortNumber - The Port-Number to be technically tested if a
Server-Socket could still bind to it.Copyright © 2018. All rights reserved.