Mpush系列[1]之启动过程分析
2019-07-25 10:23:04 1 举报
mpush 源码分析
作者其他创作
大纲/内容
A4.1: 逐个执行BootJob
GatewayServer()
next
...
void channelInactive(): 1. 通过 connManager 把 map 里的 channel 注销掉.
id3
byte[] body
void init(): 1. 为messageDispatcher注册不同类型消息的handler.
RouterCenterBoot
ServerChannelHandler extends ChannelInboundHandlerAdapter
MessageHandler3
AtomicReference<State> serverState: 保存 server 状态的类变量
BootJob boot;
ConnectionHolderN
cmd2
MessageHandler
void stop(Listener listener);
MessageHandler2
MPushServer mPushServer;
ServerBootX4
get
A6: 调用 start 启动服务
void channelRead(): 1. 通过 connManager 更新 channel;2. 通过 dispatcher调用不同 receiver 处理消息.
MessageDispatcher messageDispatcher;
Mpush系列之启动过程分析
N
A6.2
int sessionId
id2
ServerChannelHandler channelHandler;
byte cmd
BootChain chain;
ConnectionManager
A2.4.1 创建
stop()
CacheManagerBoot
GatewayServer
MessageDispatcher implements PacketReceiver
MPushServer
id1
MessageHandlerN
ConnectionHolder1
void start(final Listener listener)
A2.4 创建 gatewayServer
get();
ConnectionManager connectionManager;
ServiceDiscoveryBoot
AdminServer adminServer;
abstract ChannelHandler getChannelHandler();
MessageHandler1
serverEventListener;
NettyTCPServer
void channelActive(): 1. 通过 connManager 注册channel到 map 里.
A1: 创建 server
A6.3
byte flags
short cc
createServer(): 基于ServerBootstrap创建 netty server的典型方法.
ServerBoot extends BootJob
start()
ConnectionServer connectionServer;
add
ServiceRegistryBoot
ConnectionHolder3
A2.1: 创建 connserver
abstract void init():
ServerLauncher
A2.3 创建websocketServer
destroy();
BootChain
WebsocketServer
Packet
cmdN
根据 cmd 路由到不同的 handler
byte lrc
handle()
ConnectionServer
WebsocketServer websocketServer;
add();
cmd1
A2.2 创建websocketServer
init()
A6.1
GatewayServer gatewayServer;
PushCenterBoot
ConnectionHolder2
cmd3
AdminServer
0 条评论
下一页