Method Summary |
|
CloseFuture | close() Closes this session immediately. |
CloseFuture | close(boolean immediately) Closes this session immediately or after all queued write requests
are flushed. |
CloseFuture | closeOnFlush() Closes this session after all queued write requests are flushed.
This operation is asynchronous. |
boolean | containsAttribute(Object key) Returns true if this session contains the attribute with
the specified key. |
Object | getAttachment() Returns an attachment of this session. |
Object | getAttribute(Object key) Returns the value of the user-defined attribute of this session. |
Object | getAttribute(Object key, Object defaultValue) Returns the value of user defined attribute associated with the
specified key. |
Set<Object> | getAttributeKeys() Returns the set of keys of all user-defined attributes. |
int | getBothIdleCount() Returns the number of the fired continuous sessionIdle events
for
IdleStatus.BOTH_IDLE . |
CloseFuture | getCloseFuture() Returns the
CloseFuture of this session. |
IoSessionConfig | getConfig() Returns the configuration of this session. |
long | getCreationTime() Returns the time in millis when this session is created. |
IoFilterChain | getFilterChain() Returns the filter chain that only affects this session. |
IoHandler | getHandler() Returns the
IoHandler which handles this session. |
long | getId() Returns a unique identifier of this session. |
int | getIdleCount(IdleStatus status) Returns the number of the fired continuous sessionIdle events
for the specified
IdleStatus .
If sessionIdle event is fired first after some time after I/O,
idleCount becomes 1. |
long | getLastBothIdleTime() Returns the time in milliseconds when the last sessionIdle event
is fired for
IdleStatus.BOTH_IDLE . |
long | getLastIdleTime(IdleStatus status) Returns the time in milliseconds 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 | getLastReaderIdleTime() Returns the time in milliseconds when the last sessionIdle event
is fired for
IdleStatus.READER_IDLE . |
long | getLastWriteTime() Returns the time in millis when write operation occurred lastly. |
long | getLastWriterIdleTime() Returns the time in milliseconds when the last sessionIdle event
is fired for
IdleStatus.WRITER_IDLE . |
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. |
double | getReadBytesThroughput() Returns the number of read bytes per second. |
long | getReadMessages() Returns the total number of messages which were read and decoded from this session. |
double | getReadMessagesThroughput() Returns the number of read messages per second. |
int | getReaderIdleCount() Returns the number of the fired continuous sessionIdle events
for
IdleStatus.READER_IDLE . |
SocketAddress | getRemoteAddress() Returns the socket address of remote peer. |
long | getScheduledWriteBytes() Returns the number of bytes which are scheduled to be written to this
session. |
int | getScheduledWriteMessages() Returns the number of messages which are scheduled to be written to this session. |
IoService | getService() Returns the
IoService which provides I/O service to this session. |
SocketAddress | getServiceAddress() Returns the socket address of the
IoService listens to to manage
this session. |
TrafficMask | getTrafficMask() Returns the current
TrafficMask of this session. |
TransportMetadata | getTransportMetadata() Returns the
TransportMetadata that this session runs on. |
int | getWriterIdleCount() Returns the number of the fired continuous sessionIdle events
for
IdleStatus.WRITER_IDLE . |
long | getWrittenBytes() Returns the total number of bytes which were written to this session. |
double | getWrittenBytesThroughput() Returns the number of written bytes per second. |
long | getWrittenMessages() Returns the total number of messages which were written and encoded by this session. |
double | getWrittenMessagesThroughput() Returns the number of written messages per second. |
boolean | isClosing() Returns true if and only if this session is being closed
(but not disconnected yet) or is closed. |
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 . |
ReadFuture | read() Returns a
ReadFuture which is notified when a new message is
received, the connection is closed or an exception is caught. |
Object | removeAttribute(Object key) Removes a user-defined attribute with the specified key.
The old value of the attribute. |
boolean | removeAttribute(Object key, Object value) Removes a user defined attribute with the specified key if the current
attribute value is equal to the specified value. |
boolean | replaceAttribute(Object key, Object oldValue, Object newValue) Replaces a user defined attribute with the specified key if the
value of the attribute is equals to the specified old value. |
void | resumeRead() A shortcut method for
IoSession.setTrafficMask(TrafficMask) that
resumes read operations for this session. |
void | resumeWrite() A shortcut method for
IoSession.setTrafficMask(TrafficMask) that
resumes write operations for this session. |
Object | setAttachment(Object attachment) Sets an attachment of this session.
This method is identical with setAttribute( "", attachment ).
Old attachment. |
Object | setAttribute(Object key, Object value) Sets a user-defined attribute.
Parameters: key - the key of the attribute Parameters: value - the value of the attribute The old value of the attribute. |
Object | setAttribute(Object key) Sets a user defined attribute without a value. |
Object | setAttributeIfAbsent(Object key, Object value) Sets a user defined attribute if the attribute with the specified key
is not set yet. |
Object | setAttributeIfAbsent(Object key) Sets a user defined attribute without a value if the attribute with
the specified key is not set yet. |
void | setTrafficMask(TrafficMask trafficMask) Sets the
TrafficMask of this session which will result
the parent
IoService to start to control the traffic
of this session immediately. |
void | suspendRead() A shortcut method for
IoSession.setTrafficMask(TrafficMask) that
suspends read operations for this session. |
void | suspendWrite() A shortcut method for
IoSession.setTrafficMask(TrafficMask) that
suspends write operations for this session. |
WriteFuture | write(Object message) Writes the specified message to remote peer. |
WriteFuture | write(Object message, SocketAddress destination) (Optional) Writes the specified message to the specified destination.
This operation is asynchronous;
IoHandler.messageSent(IoSessionObject) will be invoked when the message is actually sent to remote peer. |