public abstract class AioSession<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static byte |
SESSION_STATUS_CLOSED
Session状态:已关闭
|
protected static byte |
SESSION_STATUS_CLOSING
Session状态:关闭中
|
protected static byte |
SESSION_STATUS_ENABLED
Session状态:正常
|
protected byte |
status
会话当前状态
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
强制关闭当前AIOSession
|
abstract void |
close(boolean immediate)
是否立即关闭会话
|
<T> T |
getAttachment()
获取附件对象
|
InputStream |
getInputStream()
获得数据输入流对象
|
InputStream |
getInputStream(int length)
获取已知长度的InputStream
|
abstract InetSocketAddress |
getLocalAddress() |
abstract InetSocketAddress |
getRemoteAddress() |
String |
getSessionID()
获取当前Session的唯一标识
|
boolean |
isInvalid()
当前会话是否已失效
|
<T> void |
setAttachment(T attachment)
存放附件,支持任意类型
|
abstract WriteBuffer |
writeBuffer() |
protected static final byte SESSION_STATUS_CLOSED
protected static final byte SESSION_STATUS_CLOSING
protected static final byte SESSION_STATUS_ENABLED
protected byte status
public abstract WriteBuffer writeBuffer()
public final void close()
若此时还存留待输出的数据,则会导致该部分数据丢失
public abstract void close(boolean immediate)
immediate - true:立即关闭,false:响应消息发送完后关闭public String getSessionID()
public boolean isInvalid()
public final <T> T getAttachment()
T - 对象public final <T> void setAttachment(T attachment)
T - 对象attachment - 附件public abstract InetSocketAddress getLocalAddress() throws IOException
IOExceptionpublic abstract InetSocketAddress getRemoteAddress() throws IOException
IOExceptionpublic InputStream getInputStream() throws IOException
faster模式下调用该方法会触发UnsupportedOperationException异常
MessageProcessor采用异步处理消息的方式时,调用该方法可能会出现异常
IOException - 异常public InputStream getInputStream(int length) throws IOException
length - InputStream长度IOException - 异常Copyright © 2020. All rights reserved.