You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Siro Mateos (JIRA)" <ji...@apache.org> on 2011/01/11 17:27:47 UTC

[jira] Created: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

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


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.


[jira] [Resolved] (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRMINA-815.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.3
         Assignee: Emmanuel Lecharny

Fixed with : 
http://svn.apache.org/viewvc?rev=1090594&view=rev


> 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
>            Assignee: Emmanuel Lecharny
>             Fix For: 2.0.3
>
>         Attachments: AttributeKey.patch
>
>   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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-815:
--------------------------------------

    Affects Version/s: 2.0.2
    
> CumulativeProtocolDecoder.decode(...) does not find previous buffer
> -------------------------------------------------------------------
>
>                 Key: DIRMINA-815
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-815
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>         Environment: any
>            Reporter: Siro Mateos
>            Assignee: Emmanuel Lecharny
>             Fix For: 2.0.3
>
>         Attachments: AttributeKey.patch
>
>   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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980457#action_12980457 ] 

Emmanuel Lecharny commented on DIRMINA-815:
-------------------------------------------

In any case, if a new encoder and decoder are not created for every single request, as Serguey is pointing out, then the CummulativeProtocolDecoder should work, no matter if we have a hashCode() method or not.

However, it's a bad thing not to have such a method. It will be added (ad the equals method that comes along)

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


[jira] Commented: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Siro Mateos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980332#action_12980332 ] 

Siro Mateos commented on DIRMINA-815:
-------------------------------------

I'm testing version 2.0.1. Eclipse's automatic implementation of equals() and hashCode() for class AttributeKey seems to work fine.


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


[jira] Updated: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Sergey Ishchenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Ishchenko updated DIRMINA-815:
-------------------------------------

    Attachment: AttributeKey.patch

I've added equals and hashCode methods to AttributeKey. But I had to remove object address addition to private name field. Wouldn't that be a problem in other use cases of AttributeKey?
Anyway, please take a look at patch and give some feedback.

> 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
>         Attachments: AttributeKey.patch
>
>   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.


[jira] Commented: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980181#action_12980181 ] 

Emmanuel Lecharny commented on DIRMINA-815:
-------------------------------------------

I would not be as vocal as you are, because every java class inherit from Object, which has a hashCode() method implemented, but basically, you are right : this is a smell, and the AttributeKey class *must* have a hashcode() *and* an equals() method.

Which version are you testing ?

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


[jira] Commented: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Sergey Ishchenko (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] [Closed] (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRMINA-815.
-------------------------------------

    
> CumulativeProtocolDecoder.decode(...) does not find previous buffer
> -------------------------------------------------------------------
>
>                 Key: DIRMINA-815
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-815
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>         Environment: any
>            Reporter: Siro Mateos
>            Assignee: Emmanuel Lecharny
>             Fix For: 2.0.3
>
>         Attachments: AttributeKey.patch
>
>   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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-815) CumulativeProtocolDecoder.decode(...) does not find previous buffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980681#action_12980681 ] 

Emmanuel Lecharny commented on DIRMINA-815:
-------------------------------------------

We can keep the hashcode in the name this way :
this.name = source.getName() + '.' + name + '@' + Integer.toHexString(super.hashCode());

Also the hashcode method could be simpler : 

	@Override
	public int hashCode() {
                return name.hashCode());
	}



> 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
>         Attachments: AttributeKey.patch
>
>   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.