public class ReachableSocketFinder
extends java.lang.Object
| Constructor and Description |
|---|
ReachableSocketFinder() |
ReachableSocketFinder(<any> socketTester) |
ReachableSocketFinder(<any> socketTester,
Duration gracePeriod) |
| Modifier and Type | Method and Description |
|---|---|
HostAndPort |
findOpenSocketOnNode(java.lang.Iterable<? extends HostAndPort> sockets,
Duration timeout)
Returns the first element of sockets that is reachable.
|
java.lang.Iterable<HostAndPort> |
findOpenSocketsOnNode(java.lang.Iterable<? extends HostAndPort> sockets,
Duration timeout)
Returns an iterable of the elements in sockets that are reachable.
|
public ReachableSocketFinder()
public ReachableSocketFinder(<any> socketTester)
public ReachableSocketFinder(<any> socketTester,
Duration gracePeriod)
socketTester - A predicate that determines the reachability of a host and portgracePeriod - The duration to allow remaining checks to continue after a socket is reached for the first time.public HostAndPort findOpenSocketOnNode(java.lang.Iterable<? extends HostAndPort> sockets,
Duration timeout)
sockets - The host-and-ports to testtimeout - Max time to try to connect to the ip:portjava.util.NoSuchElementException - If no ports are accessible within the given timejava.lang.NullPointerException - If sockets or timeout is nulljava.lang.IllegalStateException - If the sockets to test is emptypublic java.lang.Iterable<HostAndPort> findOpenSocketsOnNode(java.lang.Iterable<? extends HostAndPort> sockets,
Duration timeout)
sockets - The host-and-ports to testtimeout - Max time to try to connect to each ip:portsocketTester.java.lang.NullPointerException - If sockets or timeout is nulljava.lang.IllegalStateException - If the sockets to test is empty