public class NioClientManager extends com.google.common.util.concurrent.AbstractExecutionThreadService implements ClientConnectionManager
| Constructor and Description |
|---|
NioClientManager()
Creates a new client manager which uses Java NIO for socket management.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnections(int n)
Closes n peer connections
|
protected java.util.concurrent.Executor |
executor() |
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 |
run() |
void |
triggerShutdown() |
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, serviceName, shutDown, startAsync, startUp, state, stopAsync, toStringpublic NioClientManager()
public void run()
run in class com.google.common.util.concurrent.AbstractExecutionThreadServicepublic com.google.common.util.concurrent.ListenableFuture<java.net.SocketAddress> openConnection(java.net.SocketAddress serverAddress,
StreamConnection connection)
ClientConnectionManageropenConnection in interface ClientConnectionManagerpublic void triggerShutdown()
triggerShutdown in class com.google.common.util.concurrent.AbstractExecutionThreadServicepublic int getConnectedClientCount()
ClientConnectionManagergetConnectedClientCount in interface ClientConnectionManagerpublic void closeConnections(int n)
ClientConnectionManagercloseConnections in interface ClientConnectionManagerprotected java.util.concurrent.Executor executor()
executor in class com.google.common.util.concurrent.AbstractExecutionThreadService