You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Hardik Kubavat <ha...@primavera-software.com> on 2013/12/30 12:56:32 UTC

Multiple ProtocolCodecFactory not working

Hii

acceptor.getFilterChain().addLast("Codec",new ProtocolCodecFilter(new 
DecoderCodecFactory(new ProtocolDecoder())));
acceptor.getFilterChain().addLast("Codec2",new ProtocolCodecFilter(new 
DecoderCodecFactory(new ProtocolDecoder2())));


public class DecoderCodecFactory implements ProtocolCodecFactory{
     private CumulativeProtocolDecoder protocolDecoder = null;

     public DecoderCodecFactory(CumulativeProtocolDecoder protocolDecoder) {
         this.protocolDecoder = protocolDecoder;
     }


     @Override
     public ProtocolEncoder getEncoder(IoSession is) throws Exception {
         throw new UnsupportedOperationException("Not supported yet.");
     }

     @Override
     public ProtocolDecoder getDecoder(IoSession is) throws Exception {
         return protocolDecoder;
     }

}
The second ProtocolDecoder is not executing.

Re: Multiple ProtocolCodecFactory not working

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 12/30/13 12:56 PM, Hardik Kubavat a écrit :
> Hii
>
> acceptor.getFilterChain().addLast("Codec",new ProtocolCodecFilter(new
> DecoderCodecFactory(new ProtocolDecoder())));
> acceptor.getFilterChain().addLast("Codec2",new ProtocolCodecFilter(new
> DecoderCodecFactory(new ProtocolDecoder2())));
>
>
> public class DecoderCodecFactory implements ProtocolCodecFactory{
>     private CumulativeProtocolDecoder protocolDecoder = null;
>
>     public DecoderCodecFactory(CumulativeProtocolDecoder
> protocolDecoder) {
>         this.protocolDecoder = protocolDecoder;
>     }
>
>
>     @Override
>     public ProtocolEncoder getEncoder(IoSession is) throws Exception {
>         throw new UnsupportedOperationException("Not supported yet.");
>     }
>
>     @Override
>     public ProtocolDecoder getDecoder(IoSession is) throws Exception {
>         return protocolDecoder;
>     }
>
> }
> The second ProtocolDecoder is not executing.
What is the output of your first decoder ? If it's not producing
IoBuffer, the second decoder won't kick in.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Multiple port to Same IoAcceptor

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 1/31/14 11:17 AM, Hardik Kubavat a écrit :
> Hi
>
> Is it good practice to bind multiple port in one IoAcceptor or create
> object of different IoAcceptor for each port?
> Currently I am working only on one type of message

If you are dealing with one single protocol, then there is no reason to
use more than one IoAcceptor. In general, what I do is to use one
IoAcceptor per protocol Im managing (for instance, in ApacheDS, I have 5
different IoAcceptors - one for LDAP, one for Kerberos, one for NTP, one
for DNS and one for DHCP).

Each IoAcceptor will default to nbCore+1 threads, which is ok on my dual
core computer (I then have 15 threads used by the IoAcceptors).


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Multiple port to Same IoAcceptor

Posted by Hardik Kubavat <ha...@primavera-software.com>.
Hi

Is it good practice to bind multiple port in one IoAcceptor or create 
object of different IoAcceptor for each port?
Currently I am working only on one type of message