hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jakarta-httpclient Wiki] Update of "HttpCoreNioApi" by OlegKalnichevski
Date Thu, 31 Aug 2006 13:31:49 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-httpclient Wiki" for change
notification.

The following page has been changed by OlegKalnichevski:
http://wiki.apache.org/jakarta-httpclient/HttpCoreNioApi

New page:
= HttpCore NIO API =

HttpCore NIO is based on the I/O Reactor pattern as described by Doug Lea. 

== Main components ==

=== IOReactor ===

IOReactor represents an I/O multiplexer capable of accepting incoming connection, establishing
outgoing connection, 
and dispatching read/write notifications. IOReactor maintains a set of active sessions and
also manages closed sessions. 
IOReactor uses IOEventDispatch in order to communicate with various input consumers and output
producers.

IOReactor encapsulates java.nio.channel.Selector

=== IOSession ===

IOSession contains a socket channel and maintains a conversational state with the opposite
side of the connection. 
IOSession usually maintains references to corresponding input consumer and output producer
and optionally to a protocol 
processor / worker thread.

IOSession encapsulates java.nio.channel.SelectionKey

=== IOEventDispatch ===

IOEventDispatch is a callback interface intended to propagate I/O events to various protocol
processors. IOEventDispatch 
reflects the life cycle of an IOSession. Through IOEventDispatch IOReactor fires events signaling
a creation of a new 
session, some input/output activity for an active session or completion of a session.

IOEventDispatch serves as a link between the I/O multiplexer and protocol processors and is
meant to be developed for 
each specific type of application

=== IOConsumer ===

IOConsumer represents any arbitrary process interested in consuming incoming data. IOConsumer
calls IOSession to signal
its interest in receiving data. IOEventDispatch calls IOConsumer to signal availability of
input data in the session's socket 
channel. 

IOConsumer maintains a reference to java.nio.channel.ByteChannel

=== IOProducer ===

IOProducer represents any arbitrary process intended to generate outgoing data. IOConsumer
calls IOSession to signal its 
interest in sending out data. IOEventDispatch calls IOProducer in order to signal readiness
of the session's socket channel 
to accept output data.

IOProducer maintains a reference to java.nio.channel.ByteChannel

== Examples ==


== HttpCore NIO vs MINA ==

In many ways HttpCore NIO is very similar to MINA. MINA API represents quite elegant and natural
way of dealing with 
non-blocking I/O and anyone developing a event-driven I/O transport is bound to come up with
a similar interface. There are 
several significant differences as well. HttpCore NIO reactor is minimalistic, bare-bone I/O
multiplexer. HttpCore NIO does 
not and will not provide any buffering or threading primitives. It is meant to serve as an
efficient asynchronous I/O transport 
for HttpCore and nothing else. Input/output buffering is meant to be implemented by data receiver
/ data transmitter 
respectively and development of threading primitives is entirely out of HttpCore scope.

If you are interested in supporting multiple protocols on top of a robust, flexible and well
supported I/O transport mechanism 
'''please use MINA'''. HttpCore runs perfectly well on top of MINA.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message