mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todor Boev <t_b...@prosyst.bg>
Subject Why not ReadFuture?
Date Tue, 08 May 2007 10:21:35 GMT
Hello all,
My question is why is the reading style from an IoSession different from 
the writing style? The obvious way seems to be:

interface IoSession {
    ....  
    ReadFuture read();
    WriteFuture write(Object message);
    ....
}

Where:

interface ReadFuture extends IoFuture {
    Object getMessage();
}

So when I want to read I do:

session.read().addListener(<some handler>);

This is wonderfully symmetric to:

session.write(<the message>).addListener(<some handler>);

In this way the Proactor I/O style is maintained for all I/O rather than 
just for accept, connect, close and write with read being somewhat 
different.
I take it it was a deliberate choice to use a different style for the 
reading and I'm curious what drove your design. I scanned the mailing 
list for a similar question but did not find any (forgive me if I missed 
it).

Cheers,
Todor Boev

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message