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

Reply via email to