Tomcat Webscoket 实现
以tomcat的实现来熟悉java-websocket的规范。
一.初始流程
1. 基于SPI机制初始化
WebSocket Servlet Container Initializer (简称
WsSci
)ServletContainerInitializers (SCIs) are registered via an entry in the file META-INF/services/javax.servlet.ServletContainerInitializer that must be included in the JAR file that contains the SCI implementation
tomcat-websocket-8.0.36.jar 包中的org.apache.tomcat.websocket.server.WsSci
遵循Servlet 3.0标准,并在META-INF/services/javax.servlet.ServletContainerInitializer文件中被指定,此机制即Java中的SPI机制。
2.创建WsServerContainer
上一步中最重要的一环为构造并配置了WsServerContainer.
其它细节
WsThreadFactory 直接