Hi Trustin,
I don't think splitting MessageHandler into the two interfaces makes more sense
since, at least for me, it is simpler to write both sides in one class
as some codes could be duplicated if I split them.
So my question is (I could read the code but I feel like asking could be
faster ;-)

I suppose the one from MessageHandler is the one that would be executed, right ?

Since we must defined messageSent function in MessageHandler
(mandatory), second it is not mandatory to get it in DemuxingIoHandler,
third as you said only one will be called (the one from
MessageHandler ?), I would say that probably this function in
DemuxingIoHandler is no more necessary and probably confusing with the
one from MessageHandler.
Except if one can use DemuxingIoHandler with something totally different
from MessageHandler (?), I would suggest to remove this function (or mark
it as deprecated and pointing to the one in MessageHandler). WDYT ?

Frederic

Selon Trustin Lee <[EMAIL PROTECTED]>:

> Hi Frédéric,
>
> On Nov 22, 2007 3:23 AM, Frédéric Brégier <[EMAIL PROTECTED]> wrote:
> > Hy all, I am on the way to upgrade to last version of trunk...
> >
> > I have one question on DemuxingIoHandler in trunk version.
> > I used DemuxingIoHandler  which enables messageSent function to
> > be overload ("Invoked when a message written by IoSession.write(Object) is
> sent out.")
> >
> > I extend MessageHandler for my own message but now it implies the
> messageSent function (mandatory) too.
> > ("Invoked when the specific type of message is received from the specified
> session."
> > Of course here the manual from API has en error since it is obviously "is
> sent out" and not "is received")
>
> Thanks for pointing out the JavaDoc error.  I've just fixed it.
>
> > But why those two functions ? Is one call after the other or just one only
> (and if so, which one) ?
>
> It depends on situation but only one will be used and the other will
> be left as blank method for most cases.  Thinking of why... well, I
> was somewhat crazy about creating more interfaces (i.e. replacing
> MessageHandler with ReceivedMessageHandler and SentMessageHandler).
> I'm not actually sure if it was a right decision.  Please let me know
> if splitting MessageHandler into the two interfaces makes more sense.
>
> Thanks,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>


Reply via email to