org.apache.http.nio.reactor.IOSession |
Known Indirect Subclasses |
IOSession interface represents a sequence of logically related data exchanges between two end points.
The channel associated with implementations of this interface can be used to read data from and write data to the session.
I/O sessions are not bound to an execution thread, therefore one cannot use the context of the thread to store a session's state. All details about a particular session must be stored within the session itself, usually using execution context associated with it.
Implementations of this interface are expected to be threading safe.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACTIVE | ||||||||||
String | ATTACHMENT_KEY | Name of the context attribute key, which can be used to obtain the session attachment object. | |||||||||
int | CLOSED | ||||||||||
int | CLOSING |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the underlying I/O channel associated with this session.
| |||||||||||
Clears interest in a particular I/O event type by updating the event
mask associated with the session.
| |||||||||||
Terminates the session gracefully and closes the underlying I/O channel.
| |||||||||||
Returns the value of the attribute with the given name.
| |||||||||||
Returns mask of I/O evens this session declared interest in.
| |||||||||||
Returns local address.
| |||||||||||
Returns address of the remote peer.
| |||||||||||
Returns value of the socket timeout in milliseconds.
| |||||||||||
Returns status of the session:
| |||||||||||
Determines if the input buffer associated with the session contains data.
| |||||||||||
Determines if the output buffer associated with the session contains
data.
| |||||||||||
Determines if the session has been terminated.
| |||||||||||
Removes attribute with the given name.
| |||||||||||
This method can be used to associate a particular object with the
session by the given attribute name.
| |||||||||||
Quite often I/O sessions need to maintain internal I/O buffers in order
to transform input / output data prior to returning it to the consumer or
writing it to the underlying channel.
| |||||||||||
Declares interest in a particular I/O event type by updating the event
mask associated with the session.
| |||||||||||
Declares interest in I/O event notifications by setting the event mask
associated with the session
| |||||||||||
Sets value of the socket timeout in milliseconds.
| |||||||||||
Terminates the session by shutting down the underlying I/O channel.
|
Name of the context attribute key, which can be used to obtain the session attachment object.
Returns the underlying I/O channel associated with this session.
Clears interest in a particular I/O event type by updating the event mask associated with the session.
op | I/O event type. |
---|
Terminates the session gracefully and closes the underlying I/O channel. This method ensures that session termination handshake, such as the one used by the SSL/TLS protocol, is correctly carried out.
Returns the value of the attribute with the given name. The value can be
null
if not set.
The value of the session attachment object can be obtained using
ATTACHMENT_KEY
name.
name | name of the attribute. |
---|
Returns mask of I/O evens this session declared interest in.
Returns address of the remote peer.
Returns value of the socket timeout in milliseconds. The value of
0
signifies the session cannot time out.
Determines if the input buffer associated with the session contains data.
true
if the session input buffer contains data,
false
otherwise.
Determines if the output buffer associated with the session contains data.
true
if the session output buffer contains data,
false
otherwise.
Determines if the session has been terminated.
true
if the session has been terminated,
false
otherwise.
Removes attribute with the given name.
name | name of the attribute to be removed. |
---|
This method can be used to associate a particular object with the session by the given attribute name.
I/O sessions are not bound to an execution thread, therefore one cannot use the context of the thread to store a session's state. All details about a particular session must be stored within the session itself.
name | name of the attribute. |
---|---|
obj | value of the attribute. |
Quite often I/O sessions need to maintain internal I/O buffers in order to transform input / output data prior to returning it to the consumer or writing it to the underlying channel. Memory management in HttpCore NIO is based on the fundamental principle that the data consumer can read only as much input data as it can process without having to allocate more memory. That means, quite often some input data may remain unread in one of the internal or external session buffers. The I/O reactor can query the status of these session buffers, and make sure the consumer gets notified correctly as more data gets stored in one of the session buffers, thus allowing the consumer to read the remaining data once it is able to process it
I/O sessions can be made aware of the status of external session buffers
using the SessionBufferStatus
interface.
Declares interest in a particular I/O event type by updating the event mask associated with the session.
op | I/O event type. |
---|
Declares interest in I/O event notifications by setting the event mask associated with the session
ops | new I/O event mask. |
---|
Sets value of the socket timeout in milliseconds. The value of
0
signifies the session cannot time out.
timeout | socket timeout. |
---|
Terminates the session by shutting down the underlying I/O channel.