Zhang Yuan wrote:
> Dear All:
>
> I have a question about the event driven design of mina. In mina's
> IoFilters,there are many handlers
> to take care of event such as close,sent or received.
>
> But why not just define a class called SessionIoEvent, which has many
> subclasses-such as ExceptionEvent,
> MessagEvent and so on- to represent all these IO events? It looks this
> design will simplify the interfaces
> of IoFilter into just a single method like
> "handlerEvent(SessionIoEvent eve)". Also, it will make
> DefaultIoFilterChain easy to be implemeted - it will save
> "CallNext***" method to just one method.
>
> What are the reasons to make mina's current design not to have an
> explicit SessionIOEvent class?
> Please give my some hints, thanks a lot:-)
Hmmm, let me put a guess : poor initial design ?

We have a IoEvent class, which contains an IoEventType. Something that
would have been a perfect candidate for subclassing, most probably...

Now, from the handling PoV, that does change a lot of things. I find it
more convenient to have a handleMessageReceived() method than a handle(
MessageReceivedEvent event ), but it may be just me. The number of
events is not infinite.

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to