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.
| Constructor and Description | 
|---|
BlockingClientManager()  | 
BlockingClientManager(javax.net.SocketFactory socketFactory)
Creates a blocking client manager that will obtain sockets from the given factory. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
closeConnections(int n)
Closes n peer connections 
 | 
int | 
getConnectedClientCount()
Gets the number of connected peers 
 | 
com.google.common.util.concurrent.ListenableFuture<java.net.SocketAddress> | 
openConnection(java.net.SocketAddress serverAddress,
              StreamConnection connection)
Creates a new connection to the given address, with the given connection used to handle incoming data. 
 | 
void | 
setConnectTimeoutMillis(int connectTimeoutMillis)
Sets the number of milliseconds to wait before giving up on a connect attempt 
 | 
protected void | 
shutDown()  | 
protected void | 
startUp()  | 
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toStringpublic BlockingClientManager()
public BlockingClientManager(javax.net.SocketFactory socketFactory)
public com.google.common.util.concurrent.ListenableFuture<java.net.SocketAddress> openConnection(java.net.SocketAddress serverAddress,
                                                                                                 StreamConnection connection)
ClientConnectionManageropenConnection in interface ClientConnectionManagerpublic void setConnectTimeoutMillis(int connectTimeoutMillis)
protected void startUp()
                throws java.lang.Exception
startUp in class com.google.common.util.concurrent.AbstractIdleServicejava.lang.Exceptionprotected void shutDown()
                 throws java.lang.Exception
shutDown in class com.google.common.util.concurrent.AbstractIdleServicejava.lang.Exceptionpublic int getConnectedClientCount()
ClientConnectionManagergetConnectedClientCount in interface ClientConnectionManagerpublic void closeConnections(int n)
ClientConnectionManagercloseConnections in interface ClientConnectionManager