[ 
https://issues.apache.org/jira/browse/DIRMINA-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lécharny resolved DIRMINA-1198.
----------------------------------------
    Resolution: Fixed

Applied in the coming version.

> Made the IoHandler interface generic
> ------------------------------------
>
>                 Key: DIRMINA-1198
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1198
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.2.8
>            Reporter: Emmanuel Lécharny
>            Priority: Minor
>             Fix For: 2.2.9
>
>
> It would be very convenient to make the IoHandler a generic class, like:
> {code:java}
> public interface IoHandler<T> {
> ...
>     void messageReceived(IoSession session, T message) throws Exception;
> ...
> {code}
> where the message has a type.
> That would make the usage convenient:
> {code:java}
> public class ChatProtocolHandler extends IoHandlerAdapter<String> {
> ...
>     @Override
>     public void messageSent(IoSession session, String message) {
>         System.out.println( message );
>     }
>     @Override
>     public void messageReceived(IoSession session, String message) {
>         Logger log = LoggerFactory.getLogger(ChatProtocolHandler.class);
>         log.info("received: " + message);
>         String[] result = message.split(" ", 2);
> ...
> {code}
> instead of:
> {code:java}
> public class ChatProtocolHandler extends IoHandlerAdapter {
> ...
>     @Override
>     public void messageSent(IoSession session, Object message) {
>         System.out.println( message );
>     }
>     @Override
>     public void messageReceived(IoSession session, Object message) {
>         Logger log = LoggerFactory.getLogger(ChatProtocolHandler.class);
>         log.info("received: " + message);
>         String theMessage = (String) message;
>         String[] result = theMessage.split(" ", 2);
> ...
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to