public class NioSessionWrapper extends AbstractSessionWrapper<INioSession,String>
| Constructor and Description |
|---|
NioSessionWrapper(INioSession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String attrKey,
Object attrValue)
向当前会话添加属性
|
<T> T |
getAttribute(String attrKey)
获取指定attrKey对应的属性并转换为目标类型
|
Map<String,Object> |
getAttributes()
获取当前会话属性映射
|
String |
getId()
获取当前会话标识符
|
long |
getLastTouchTime()
获取最后心跳时间(毫秒)
|
INioSession |
getSession()
获取会话对象
|
String |
toString() |
void |
touch()
更新会话活动状态(触发心跳, 通知会话包装器更新心跳时间))
|
public NioSessionWrapper(INioSession session)
public String getId()
ISessionWrapperpublic INioSession getSession()
ISessionWrapperpublic Map<String,Object> getAttributes()
ISessionWrapperpublic <T> T getAttribute(String attrKey)
ISessionWrapperT - 目标类型attrKey - 属性键名public void addAttribute(String attrKey, Object attrValue)
ISessionWrapperattrKey - 属性键名attrValue - 属性值public void touch()
ISessionWrapperpublic long getLastTouchTime()
ISessionWrapperCopyright © 2022. All rights reserved.