Class BlockingClientManager

java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.bitcoinj.net.BlockingClientManager
All Implemented Interfaces:
com.google.common.util.concurrent.Service, ClientConnectionManager

public class BlockingClientManager extends com.google.common.util.concurrent.AbstractIdleService implements ClientConnectionManager

A thin wrapper around a set of BlockingClients.

Generally, using NioClient and NioClientManager should be preferred over BlockingClient and BlockingClientManager as they scale significantly better, unless you wish to connect over a proxy or use some other network settings that cannot be set using NIO.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

    com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Creates a blocking client manager that will obtain sockets from the given factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes n peer connections
    int
    Gets the number of connected peers
    openConnection(SocketAddress serverAddress, StreamConnection connection)
    Creates a new connection to the given address, with the given connection used to handle incoming data.
    void
    setConnectTimeout(Duration connectTimeout)
    Sets the number of milliseconds to wait before giving up on a connect attempt
    void
    setConnectTimeoutMillis(int connectTimeoutMillis)
    protected void
     
    protected void
     

    Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

    addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.common.util.concurrent.Service

    addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
  • Constructor Details

    • BlockingClientManager

      public BlockingClientManager()
    • BlockingClientManager

      public BlockingClientManager(SocketFactory socketFactory)
      Creates a blocking client manager that will obtain sockets from the given factory. Useful for customising how bitcoinj connects to the P2P network.
  • Method Details