I have not see DemuxingIoHandler implementation.
I tried a generics version solution, but there is no way to get a clean
solution by using java generics.
codes like follows:
interface Decoder<T> {
T decode(E input);
}

handler = new IoHandler<T>{
public void onMessageReceived(session, T message){
}
}
connect(address, ..., handler);//there must be a parameter type pass
through,
//otherwise there  must be many CW(arning)s if using Decoder<?> or
//IoHandler<?>, so feel not good, isnt is?

It's a simle case, but if Decoder<T>s is organized by heirarchy or chain, it
would be a another desaster:P)

I'm doing  meditation:)(a WORK or JOB of india like people, if you know it,
you can capature and see why india not go advancing:) just personal opion)

Maybe it's a not bad option that obseleting interface and using annotation.

Ok, I would check it out DemuxingIoHandler.

Regards.

2007/6/13, Trustin Lee (JIRA) <[EMAIL PROTECTED]>:


    [
https://issues.apache.org/jira/browse/DIRMINA-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504105]

Trustin Lee commented on DIRMINA-372:
-------------------------------------

I agree with Mark because DemuxingIoHandler already provides such a
functionality.  Adding an ExceptionHandler sounds very useful, so it will be
taken care in a separate issue.

DispatchingIoHandler is also a cool idea although it overlaps with
DemuxingIoHandler.  Once done right, we could deprecate
DemuxingIoHandler.  Otherwise, we could make this feature built-in so all
IoHandler implementations get the benefit.  I guess the overhead will be
minimal.  WDYT?

public class MyHandler implements IoHandler {
    public void messageReceived(IoSession session, MyMessage message) {
        // invoked when the received message is MyMessage.
    }

    public void messageReceived(IoSession session, Object message) {
        // invoked for all other type of messages,
    }
}

> Generics support for IoHandler
> ------------------------------
>
>                 Key: DIRMINA-372
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-372
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 1.1.0
>            Reporter: Eero Nevalainen
>            Priority: Minor
>             Fix For: 1.1.1, 2.0.0-M1
>
>
> It would be nice to have generics support for IoHandler so that
messageReceived and messageSent would be called with the appropriate generic
types.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.




--
向秦贤

Reply via email to