Package org.apache.hadoop.hbase
Class HBaseCommonTestingUtility.PortAllocator
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtility.PortAllocator
- Enclosing class:
- HBaseCommonTestingUtility
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
private final Random
A set of ports that have been claimed usingrandomFreePort()
. -
Constructor Summary
ConstructorDescriptionPortAllocator
(Random random, HBaseCommonTestingUtility.PortAllocator.AvailablePortChecker portChecker) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns a random free port and marks that port as taken.private int
Returns a random port.
-
Field Details
-
MIN_RANDOM_PORT
- See Also:
-
MAX_RANDOM_PORT
- See Also:
-
takenRandomPorts
A set of ports that have been claimed usingrandomFreePort()
. -
random
-
portChecker
-
-
Constructor Details
-
PortAllocator
public PortAllocator() -
PortAllocator
public PortAllocator(Random random, HBaseCommonTestingUtility.PortAllocator.AvailablePortChecker portChecker) -
PortAllocator
-
-
Method Details
-
randomFreePort
Returns a random free port and marks that port as taken. Not thread-safe. Expected to be called from single-threaded test setup code/ -
randomPort
Returns a random port. These ports cannot be registered with IANA and are intended for dynamic allocation (see http://bit.ly/dynports).
-