public class ConnectionHandler extends Object
Modifier and Type | Field and Description |
---|---|
static String |
THREAD_NAME
The thread name is important to identify threads where blocking (wait) is possible.
|
static int |
UDP_LIMIT |
Constructor and Description |
---|
ConnectionHandler(ConnectionHandler parent,
Number160 id,
KeyPair keyPair,
PeerMap peerMap)
Attaches a peer to an existing connection and use existing information.
|
ConnectionHandler(int udpPort,
int tcpPort,
Number160 id,
Bindings bindings,
int p2pID,
ConnectionConfiguration configuration,
File messageLogger,
KeyPair keyPair,
PeerMap peerMap,
org.jboss.netty.util.Timer timer,
int maxMessageSize,
int maintenanceThreads,
int replicationThreads,
int workerThreads) |
Modifier and Type | Method and Description |
---|---|
void |
customLoggerMessage(String customMessage)
Writes a custom message to the logger filter.
|
ConnectionBean |
getConnectionBean() |
NATUtils |
getNATUtils() |
PeerBean |
getPeerBean() |
boolean |
isListening() |
void |
shutdown()
Shuts down the dispatcher and frees resources.
|
boolean |
startupTCP(InetSocketAddress listenAddressesTCP,
DispatcherReply dispatcher,
int maxMessageSize,
int tcpIdleSeconds)
Creates TCP channels and listens on them.
|
boolean |
startupUDP(InetSocketAddress listenAddressesUDP,
DispatcherReply dispatcher)
Creates UDP channels and listens on them.
|
public static final String THREAD_NAME
public static final int UDP_LIMIT
public ConnectionHandler(int udpPort, int tcpPort, Number160 id, Bindings bindings, int p2pID, ConnectionConfiguration configuration, File messageLogger, KeyPair keyPair, PeerMap peerMap, org.jboss.netty.util.Timer timer, int maxMessageSize, int maintenanceThreads, int replicationThreads, int workerThreads) throws IOException
udpPort
- tcpPort
- id
- bindings
- p2pID
- configuration
- messageLogger
- keyPair
- peerMap
- listeners
- peerConfiguration
- Exception
IOException
public ConnectionHandler(ConnectionHandler parent, Number160 id, KeyPair keyPair, PeerMap peerMap)
parent
- The parent handlerid
- The id of the child peerkeyPair
- The keypair of the child peerpeerMap
- The peer map of the child peerpublic final ConnectionBean getConnectionBean()
public final PeerBean getPeerBean()
public final NATUtils getNATUtils()
public final boolean startupUDP(InetSocketAddress listenAddressesUDP, DispatcherReply dispatcher)
listenAddressesUDP
- The address to listen todispatcher
- The dispatcher that handles incoming messagespublic final boolean startupTCP(InetSocketAddress listenAddressesTCP, DispatcherReply dispatcher, int maxMessageSize, int tcpIdleSeconds)
listenAddressesTCP
- the addresses which we will listen ondispatcher
- The dispatcher that handles incoming messagesmaxMessageSize
- The maximum message size that is toleratedtcpIdleSeconds
- The number of seconds that an connection (incoming) can be idlepublic final void customLoggerMessage(String customMessage)
customMessage
- The custom message to print.public final void shutdown()
public final boolean isListening()
Copyright © 2013. All Rights Reserved.