|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Session
A handle which represents connection between two endpoints regardless of transport types.
Session provides user-defined attributes. User-defined attributes are application-specific data which is associated with a session. It often contains objects that represents the state of a higher-level protocol and becomes a way to exchange data between filters and handlers.
Method Summary | |
---|---|
void |
close()
Closes this session immediately. |
void |
close(boolean wait)
Closes this session immediately. |
Object |
getAttachment()
Returns an attachment of this session. |
Object |
getAttribute(String key)
Returns the value of user-defined attribute of this session. |
Set |
getAttributeKeys()
Returns the set of keys of all user-defined attributes. |
SessionConfig |
getConfig()
Returns the configuration of this session. |
long |
getCreationTime()
Returns the time in millis when this session is created. |
int |
getIdleCount(IdleStatus status)
Returns the number of the fired continuous sessionIdle events for the specified IdleStatus . |
long |
getLastIdleTime(IdleStatus status)
Returns the time in millis when the last sessionIdle event is fired for the specified IdleStatus . |
long |
getLastIoTime()
Returns the time in millis when I/O occurred lastly. |
long |
getLastReadTime()
Returns the time in millis when read operation occurred lastly. |
long |
getLastWriteTime()
Returns the time in millis when write operation occurred lastly. |
SocketAddress |
getLocalAddress()
Returns the socket address of local machine which is associated with this session. |
long |
getReadBytes()
Returns the total number of bytes which were read from this session. |
SocketAddress |
getRemoteAddress()
Returns the socket address of remote peer. |
int |
getScheduledWriteRequests()
Returns the number of write requests which are scheduled to be written to this session. |
TransportType |
getTransportType()
Returns transport type of this session. |
long |
getWrittenBytes()
Returns the total number of bytes which were written to this session. |
long |
getWrittenWriteRequests()
Returns the total number of write requests which were written to this session. |
boolean |
isConnected()
Returns true if this session is connected with remote peer. |
boolean |
isIdle(IdleStatus status)
Returns true if this session is idle for the specified
IdleStatus . |
Object |
removeAttribute(String key)
Removes a user-defined attribute with the specified key. |
Object |
setAttachment(Object attachment)
Sets an attachment of this session. |
Object |
setAttribute(String key,
Object value)
Sets a user-defined attribute. |
Method Detail |
---|
void close()
void close(boolean wait)
wait
- true if you want to wait until closing process is
complete.Object getAttachment()
Object setAttachment(Object attachment)
Object getAttribute(String key)
key
- the key of the attribute
Object setAttribute(String key, Object value)
key
- the key of the attributevalue
- the value of the attribute
Object removeAttribute(String key)
Set getAttributeKeys()
TransportType getTransportType()
boolean isConnected()
true
if this session is connected with remote peer.
SessionConfig getConfig()
SocketAddress getRemoteAddress()
SocketAddress getLocalAddress()
long getReadBytes()
long getWrittenBytes()
long getWrittenWriteRequests()
int getScheduledWriteRequests()
long getCreationTime()
long getLastIoTime()
long getLastReadTime()
long getLastWriteTime()
boolean isIdle(IdleStatus status)
true
if this session is idle for the specified
IdleStatus
.
int getIdleCount(IdleStatus status)
IdleStatus
.
If sessionIdle event is fired first after some time after I/O, idleCount becomes 1. idleCount resets to 0 if any I/O occurs again, otherwise it increases to 2 and so on if sessionIdle event is fired again without any I/O between two (or more) sessionIdle events.
long getLastIdleTime(IdleStatus status)
IdleStatus
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |