Package org.fisco.bcos.sdk.network
Class ConnectionManager
java.lang.Object
org.fisco.bcos.sdk.network.ConnectionManager
public class ConnectionManager
extends java.lang.Object
Maintain peer connections. Start a schedule to reconnect failed peers.
-
Constructor Summary
Constructors Constructor Description ConnectionManager(ConfigOption configOption, MsgHandler msgHandler)
-
Method Summary
Modifier and Type Method Description protected io.netty.channel.ChannelHandlerContext
addConnectionContext(java.lang.String ip, int port, io.netty.channel.ChannelHandlerContext ctx)
java.util.Map<java.lang.String,io.netty.channel.ChannelHandlerContext>
getAvailableConnections()
io.netty.channel.ChannelHandlerContext
getConnectionCtx(java.lang.String peer)
java.util.List<ConnectionInfo>
getConnectionInfoList()
protected void
removeConnection(java.lang.String peerIpPort)
protected void
removeConnectionContext(java.lang.String ip, int port, io.netty.channel.ChannelHandlerContext ctx)
void
setMsgHandleThreadPool(java.util.concurrent.ExecutorService msgHandleThreadPool)
void
startConnect(ConfigOption configOption)
void
startReconnectSchedule()
void
stopNetty()
void
stopReconnectSchedule()
-
Constructor Details
-
Method Details
-
startConnect
- Throws:
NetworkException
-
startReconnectSchedule
public void startReconnectSchedule() -
stopReconnectSchedule
public void stopReconnectSchedule() -
stopNetty
public void stopNetty() -
setMsgHandleThreadPool
public void setMsgHandleThreadPool(java.util.concurrent.ExecutorService msgHandleThreadPool) -
getConnectionInfoList
-
getAvailableConnections
public java.util.Map<java.lang.String,io.netty.channel.ChannelHandlerContext> getAvailableConnections() -
getConnectionCtx
public io.netty.channel.ChannelHandlerContext getConnectionCtx(java.lang.String peer) -
addConnectionContext
protected io.netty.channel.ChannelHandlerContext addConnectionContext(java.lang.String ip, int port, io.netty.channel.ChannelHandlerContext ctx) -
removeConnectionContext
protected void removeConnectionContext(java.lang.String ip, int port, io.netty.channel.ChannelHandlerContext ctx) -
removeConnection
protected void removeConnection(java.lang.String peerIpPort)
-