You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by ji...@apache.org on 2004/02/19 08:16:52 UTC

[jira] Closed: (DIR-12) Direct NIO ByteBuffer does not produce correct hashCodes

Message:

   The following issue has been closed.

   Resolver: Alex Karasulu
       Date: Wed, 18 Feb 2004 11:15 PM

Turns out this is the actual behavoir Buffers are supposed to have.  Yeah I was totally spooked by this one and feel stupid for it.  Here's what the hashCode documentations says for it:

The hash code of a byte buffer depends only upon its remaining elements; that is, upon the elements from position() up to, and including, the element at limit() - 1. 

Because buffer hash codes are content-dependent, it is inadvisable to use buffers as keys in hash maps or similar data structures unless it is known that their contents will not change. 

So there ya go - the lookup of buffers now needs to change in the buffer pool.  This specific problem also makes the need for a custom buffer pool implementation all that much more legitamate instead of basing it on another pooling implementation that might not consider these factors.

---------------------------------------------------------------------
View the issue:
  http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=DIR-12

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DIR-12
    Summary: Direct NIO ByteBuffer does not produce correct hashCodes
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: WON'T FIX

    Project: Directory
 Components: 
             Eve

   Assignee: Alex Karasulu
   Reporter: Alex Karasulu

    Created: Wed, 18 Feb 2004 10:28 PM
    Updated: Wed, 18 Feb 2004 11:15 PM
    Due:     Thu, 19 Feb 2004 12:00 AM

Description:
We need to basically find a work around for dealing with this issue in the BufferPool component.  I'll add this today.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira