[ 
https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980395#action_12980395
 ] 

Sergey Ishchenko commented on DIRMINA-815:
------------------------------------------

I've also encountered this issue. It occures if an implementation of 
ProtocolCodecFactory returns new instances of encoder/decoder on each call to 
getDecoder/getEncoder:
public class PhysicalLayerProtocolCodecFactory implements ProtocolCodecFactory {

        @Override
        public ProtocolDecoder getDecoder(IoSession session) throws Exception {
                return new PhysicalLayerDecoder();
        }

        @Override
        public ProtocolEncoder getEncoder(IoSession session) throws Exception {
                return new PhysicalLayerEncoder();
        }
}

I had to use this workaround:
public class PhysicalLayerProtocolCodecFactory implements ProtocolCodecFactory {
        private final PhysicalLayerDecoder decoder;
        private final PhysicalLayerEncoder encoder;
        
        public PhysicalLayerProtocolCodecFactory() {
                this.decoder = new PhysicalLayerDecoder();
                this.encoder = new PhysicalLayerEncoder();
        }

        @Override
        public ProtocolDecoder getDecoder(IoSession session) throws Exception {
                return this.decoder;
        }

        @Override
        public ProtocolEncoder getEncoder(IoSession session) throws Exception {
                return this.encoder;
        }
}

> CumulativeProtocolDecoder.decode(...) does not find previous buffer
> -------------------------------------------------------------------
>
>                 Key: DIRMINA-815
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-815
>             Project: MINA
>          Issue Type: Bug
>         Environment: any
>            Reporter: Siro Mateos
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> CumulativeProtocolDecoder does not find previous input buffer stored in 
> 'session.attributes' (see 'CumulativeProtocolDecoder.java', line 136), 
> probably because 'attributes' uses a ConcurrentHashMap, and class 
> AttributeKey does NOT implement hashCode(), rendering 
> CumulativeProtocolDecoder useless.

-- 
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