You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Roger Kapsi (JIRA)" <ji...@apache.org> on 2008/02/20 16:59:45 UTC

[jira] Created: (DIRMINA-534) AbstractIoSession's getId()

AbstractIoSession's getId()
---------------------------

                 Key: DIRMINA-534
                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
             Project: MINA
          Issue Type: Improvement
    Affects Versions: 2.0.0-M2
            Reporter: Roger Kapsi
            Priority: Minor


I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Resolved: (DIRMINA-534) AbstractIoSession's getId()

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

Trustin Lee resolved DIRMINA-534.
---------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 2.0.0-M2)
         Assignee: Trustin Lee

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Assignee: Trustin Lee
>            Priority: Minor
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Commented: (DIRMINA-534) AbstractIoSession's getId()

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576844#action_12576844 ] 

Mark Webb commented on DIRMINA-534:
-----------------------------------

Should this issue be closed then and not fixed?

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Priority: Minor
>             Fix For: 2.0.0-M2
>
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Closed: (DIRMINA-534) AbstractIoSession's getId()

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

Emmanuel Lecharny closed DIRMINA-534.
-------------------------------------


> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Assignee: Trustin Lee
>            Priority: Minor
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Commented: (DIRMINA-534) AbstractIoSession's getId()

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576118#action_12576118 ] 

Trustin Lee commented on DIRMINA-534:
-------------------------------------

The reason I overrided hashCode() and equals() and made them final is to prevent a user (or a developer) from overriding them and changing its meaning in MINA.  Making equals() and hashCode() to behave just like Object does is important for MINA core because we store IoSessions in various data structures such as ConcurrentHashMap and ConcurrentHashSet.  If someone overrides hashCode() and equals() method, the internal state of MINA can be broken.

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Priority: Minor
>             Fix For: 2.0.0-M2
>
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Commented: (DIRMINA-534) AbstractIoSession's getId()

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577281#action_12577281 ] 

Trustin Lee commented on DIRMINA-534:
-------------------------------------

IMHO, yep. :)

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Priority: Minor
>             Fix For: 2.0.0-M2
>
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Commented: (DIRMINA-534) AbstractIoSession's getId()

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576023#action_12576023 ] 

Mark Webb commented on DIRMINA-534:
-----------------------------------

I would have to agree with Roger's logic.  Looking at the Javadoc for the System.identityHashCode(Object) :

"Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). The hash code for the null reference is zero."

I am not sure that it bothers anything by the AbstractIoSession overriding equals() and hashCode() though...

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Priority: Minor
>             Fix For: 2.0.0-M2
>
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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


[jira] Updated: (DIRMINA-534) AbstractIoSession's getId()

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

Mike Heath updated DIRMINA-534:
-------------------------------

    Fix Version/s: 2.0.0-M2

> AbstractIoSession's getId()
> ---------------------------
>
>                 Key: DIRMINA-534
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-534
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M2
>            Reporter: Roger Kapsi
>            Priority: Minor
>             Fix For: 2.0.0-M2
>
>
> I would use System.identityHashCode(this) instead of hashCode() in AbstractIoSession.getId() and you'd have to no longer override equals & hashCode() (I assume that's the reason why both methods are overridden & final).

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