Class ServerConnection
java.lang.Object
server.netty.ServerConnection
封裝單一 Netty TCP 伺服器實例的生命週期管理,代表登入、頻道或商城三伺服器之一。
內部持有一對 NioEventLoopGroup(boss 負責接受新連線、worker
負責讀寫 I/O),透過 ServerBootstrap 綁定指定 IP 與埠口後開始監聽。
Channel pipeline 由 ServerInitializer 負責組裝;ServerType 區分伺服器種類,
並透過 world/channels 欄位傳遞給 MapleServerHandler。
呼叫 run() 啟動伺服器(同步等待 Channel 開啟),呼叫 close() 關閉 Channel
並優雅地關閉兩個 EventLoopGroup,以確保資源完整釋放。
-
Constructor Summary
ConstructorsConstructorDescriptionServerConnection(String ip, int port, int world, int channels, ServerType type) -
Method Summary
-
Constructor Details
-
ServerConnection
-
-
Method Details
-
run
public void run() -
close
public void close()
-