SESSION_WRAPPER - 会话包装类型MESSAGE_TYPE - 消息类型public class NioSessionManager<SESSION_WRAPPER extends NioSessionWrapper,MESSAGE_TYPE> extends AbstractSessionManager<SESSION_WRAPPER,String,MESSAGE_TYPE>
| Constructor and Description |
|---|
NioSessionManager(IServerCfg serverCfg,
INioCodec codec,
INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> listener) |
NioSessionManager(IServerCfg serverCfg,
INioCodec codec,
INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> listener,
long idleTimeInMillis) |
| Modifier and Type | Method and Description |
|---|---|
protected IServer<?,?> |
buildServer(IServerCfg serverCfg,
INioCodec codec)
根据服务端配置构建服务端实例
|
protected SESSION_WRAPPER |
buildSessionWrapper(INioSession session,
InetSocketAddress socketAddress)
根据会话对象构建包装器
|
void |
closeSessionWrapper(SESSION_WRAPPER sessionWrapper)
关闭会话并从会话管理器中移除
|
INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> |
getSessionListener()
获取会话事件监听器
|
boolean |
sendTo(String sessionId,
MESSAGE_TYPE message)
向目标客户端发送消息
|
close, contains, idleChecker, initialize, putSessionWrapper, register, registerSession, removeSessionWrapper, sessionCount, sessionWrapper, sessionWrappers, speedometer, speedTouchpublic NioSessionManager(IServerCfg serverCfg, INioCodec codec, INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> listener)
public NioSessionManager(IServerCfg serverCfg, INioCodec codec, INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> listener, long idleTimeInMillis)
protected SESSION_WRAPPER buildSessionWrapper(INioSession session, InetSocketAddress socketAddress)
AbstractSessionManagerbuildSessionWrapper in class AbstractSessionManager<SESSION_WRAPPER extends NioSessionWrapper,String,MESSAGE_TYPE>session - 会话对象socketAddress - 目标来源套接字地址protected IServer<?,?> buildServer(IServerCfg serverCfg, INioCodec codec)
AbstractSessionManagerbuildServer in class AbstractSessionManager<SESSION_WRAPPER extends NioSessionWrapper,String,MESSAGE_TYPE>serverCfg - 服务端配置codec - 编解码器public void closeSessionWrapper(SESSION_WRAPPER sessionWrapper)
ISessionManagercloseSessionWrapper in interface ISessionManager<SESSION_WRAPPER extends NioSessionWrapper,String,MESSAGE_TYPE>closeSessionWrapper in class AbstractSessionManager<SESSION_WRAPPER extends NioSessionWrapper,String,MESSAGE_TYPE>sessionWrapper - 会话包装器实例public INioSessionListener<SESSION_WRAPPER,MESSAGE_TYPE> getSessionListener()
ISessionManagerpublic boolean sendTo(String sessionId, MESSAGE_TYPE message) throws IOException
ISessionManagersessionId - 目标客户端会话唯一标识message - 消息对象IOException - 可能产生的异常Copyright © 2022. All rights reserved.