public class MultiplexingDiscovery extends java.lang.Object implements PeerDiscovery
Modifier and Type | Field and Description |
---|---|
protected NetworkParameters |
netParams |
protected java.util.List<PeerDiscovery> |
seeds |
Constructor and Description |
---|
MultiplexingDiscovery(NetworkParameters params,
java.util.List<PeerDiscovery> seeds)
Will query the given seeds in parallel before producing a merged response.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.concurrent.ExecutorService |
createExecutor() |
static MultiplexingDiscovery |
forServices(NetworkParameters params,
long services)
Builds a suitable set of peer discoveries.
|
java.net.InetSocketAddress[] |
getPeers(long services,
long timeoutValue,
java.util.concurrent.TimeUnit timeoutUnit)
Returns an array of addresses.
|
void |
shutdown()
Stops any discovery in progress when we want to shut down quickly.
|
protected final java.util.List<PeerDiscovery> seeds
protected final NetworkParameters netParams
public MultiplexingDiscovery(NetworkParameters params, java.util.List<PeerDiscovery> seeds)
public static MultiplexingDiscovery forServices(NetworkParameters params, long services)
params
- Network to use.services
- Required services as a bitmask, e.g. VersionMessage.NODE_NETWORK
.public java.net.InetSocketAddress[] getPeers(long services, long timeoutValue, java.util.concurrent.TimeUnit timeoutUnit) throws PeerDiscoveryException
PeerDiscovery
getPeers
in interface PeerDiscovery
services
- Required services as a bitmask, e.g. VersionMessage.NODE_NETWORK
.PeerDiscoveryException
protected java.util.concurrent.ExecutorService createExecutor()
public void shutdown()
PeerDiscovery
shutdown
in interface PeerDiscovery