public interface Session
Modifier and Type | Interface and Description |
---|---|
static class |
Session.SessionStatus |
Modifier and Type | Method and Description |
---|---|
void |
clearAttributes()
Clear attributes
|
void |
close()
Close session
|
void |
flush()
Flush the write queue,this method may be no effect if OP_WRITE is running.
|
Object |
getAttribute(String key)
Return attribute associated with key
|
CodecFactory.Decoder |
getDecoder()
Return current decoder
|
CodecFactory.Encoder |
getEncoder()
Return current encoder
|
Handler |
getHandler() |
long |
getLastOperationTimeStamp()
Return last operation timestamp,operation include read,write,idle
|
InetAddress |
getLocalAddress() |
ByteOrder |
getReadBufferByteOrder()
Return the session read buffer's byte order,big end or little end.
|
InetSocketAddress |
getRemoteSocketAddress()
Return the remote end's InetSocketAddress
|
long |
getScheduleWritenBytes()
Return the bytes in write queue,there bytes is in memory.Use this method to controll writing
speed.
|
long |
getSessionIdleTimeout() |
long |
getSessionTimeout() |
boolean |
isClosed()
Check if session is closed
|
boolean |
isExpired()
Return true if session is expired,session is expired beacause you set the sessionTimeout,if
since session's last operation form now is over this vlaue,isExpired return true,and
Handler.onExpired() will be invoked.
|
boolean |
isHandleReadWriteConcurrently()
Return true if allow handling read and write concurrently,default is true.
|
boolean |
isIdle()
Check if session is idle
|
boolean |
isLoopbackConnection()
return true if it is a loopback connection
|
boolean |
isUseBlockingRead()
Return true if using blocking read
|
boolean |
isUseBlockingWrite()
Return true if using blocking write
|
void |
removeAttribute(String key)
Remove attribute
|
void |
setAttribute(String key,
Object value)
Set a attribute attched with this session
|
Object |
setAttributeIfAbsent(String key,
Object value) |
void |
setDecoder(CodecFactory.Decoder decoder) |
void |
setEncoder(CodecFactory.Encoder encoder)
Set encoder
|
void |
setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently) |
void |
setReadBufferByteOrder(ByteOrder readBufferByteOrder) |
void |
setSessionIdleTimeout(long sessionIdleTimeout) |
void |
setSessionTimeout(long sessionTimeout) |
void |
setUseBlockingRead(boolean useBlockingRead) |
void |
setUseBlockingWrite(boolean useBlockingWrite)
Set if using blocking write
|
void |
start()
Start session
|
void |
write(Object packet)
Write a message,if you don't care when the message is written
|
void start()
void write(Object packet)
packet
- boolean isClosed()
void close()
InetSocketAddress getRemoteSocketAddress()
InetAddress getLocalAddress()
boolean isUseBlockingWrite()
void setUseBlockingWrite(boolean useBlockingWrite)
useBlockingWrite
- boolean isUseBlockingRead()
void setUseBlockingRead(boolean useBlockingRead)
void flush()
boolean isExpired()
boolean isIdle()
CodecFactory.Encoder getEncoder()
void setEncoder(CodecFactory.Encoder encoder)
encoder
- CodecFactory.Decoder getDecoder()
void setDecoder(CodecFactory.Decoder decoder)
boolean isHandleReadWriteConcurrently()
void setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
ByteOrder getReadBufferByteOrder()
void setReadBufferByteOrder(ByteOrder readBufferByteOrder)
void setAttribute(String key, Object value)
key
- value
- void removeAttribute(String key)
key
- Object getAttribute(String key)
key
- void clearAttributes()
long getScheduleWritenBytes()
long getLastOperationTimeStamp()
boolean isLoopbackConnection()
long getSessionIdleTimeout()
void setSessionIdleTimeout(long sessionIdleTimeout)
long getSessionTimeout()
void setSessionTimeout(long sessionTimeout)
Handler getHandler()
Copyright © 2021. All rights reserved.