mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@gmail.com>
Subject MINA 3.0 Acceptor/Processor
Date Thu, 31 May 2012 18:55:51 GMT
Hi,
In mina 2 the event loops are composed of Acceptor/Connector (for
accepting/connecting TCP sessions) and IoProcessor for handling
session read and write events. For each service you need at least one
Acceptor/connector and one IoProcessor, so at least two threads. For a
simple TCP base asynchronous proxy it sould be doable with one thread.

The IoProcessor for TCP and for UDP are totally differents, the TCP
one select TCP client sockets the UDP one handle read write event
passed by the Acceptor because you have only one socket in a UDP
server.

Ayway this logic make the code uber complicated, what I propose :

Two technical event loop construction :
A SelectorProcessor, his work is to select SelectableChannel for IO
event (read, write, accept) and push events to listeners (e.g.
TcpServer for accept events, UdpServer for read events on new
sessions)
A EventProcessor, his work is to process read/write events coming from
SelectorProcessor using session chains with one thread event.

So we can wired SelectorProcessor and EventProcessor like we want,
from just one SelectorProcessor for a one thread logic for quick
server, to multiple SelectorProcessor pushing event to multiple
EventProcessors.

I think it'll make the code really simpler, testable with mock and
more modulable.

Julien

Mime
View raw message