com.google.bitcoin.net
Class NioClientManager
java.lang.Object
com.google.common.util.concurrent.AbstractExecutionThreadService
com.google.bitcoin.net.NioClientManager
- All Implemented Interfaces:
- ClientConnectionManager, com.google.common.util.concurrent.Service
public class NioClientManager
- extends com.google.common.util.concurrent.AbstractExecutionThreadService
- implements ClientConnectionManager
A class which manages a set of client connections. Uses Java NIO to select network events and processes them in a
single network processing thread.
| 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 |
NioClientManager()
Creates a new client manager which uses Java NIO for socket management. |
| Methods inherited from class com.google.common.util.concurrent.AbstractExecutionThreadService |
addListener, executor, getServiceName, isRunning, shutDown, start, startAndWait, startUp, state, stop, stopAndWait, toString |
| Methods inherited from interface com.google.common.util.concurrent.Service |
addListener, isRunning, start, startAndWait, state, stop, stopAndWait |
NioClientManager
public NioClientManager()
- Creates a new client manager which uses Java NIO for socket management. Uses a single thread to handle all select
calls.
run
public void run()
- Specified by:
run in class com.google.common.util.concurrent.AbstractExecutionThreadService
openConnection
public void openConnection(SocketAddress serverAddress,
StreamParser parser)
- Description copied from interface:
ClientConnectionManager
- Creates a new connection to the given address, with the given parser used to handle incoming data.
- Specified by:
openConnection in interface ClientConnectionManager
triggerShutdown
public void triggerShutdown()
- Overrides:
triggerShutdown in class com.google.common.util.concurrent.AbstractExecutionThreadService
getConnectedClientCount
public int getConnectedClientCount()
- Description copied from interface:
ClientConnectionManager
- Gets the number of connected peers
- Specified by:
getConnectedClientCount in interface ClientConnectionManager
closeConnections
public void closeConnections(int n)
- Description copied from interface:
ClientConnectionManager
- Closes n peer connections
- Specified by:
closeConnections in interface ClientConnectionManager
Copyright © 2014. All rights reserved.