lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <>
Subject [jira] Commented: (LUCENE-2779) Use ConcurrentHashMap in RAMDirectory
Date Tue, 30 Nov 2010 14:48:13 GMT


Yonik Seeley commented on LUCENE-2779:

OK, a few points on the latest patch:
- cloning the map does not change the "lie" (i.e. it's still not a point-in-time snapshot)...
the constructor for the new set must iterate over the items also, so consistency is not increased.
 You've just changed where the iteration happens.  You can see this by trying out my test
program, and making the following change:
      Object[] vals = map.keySet().toArray(new Integer[0]);
      Object[] vals = new HashSet<String>(map.keySet()).toArray(new Integer[0]);
- toArray() or toArray(T[]) should be safe to call on ConcurrentHashMap.keySet().  It works
fine on my JVM (Oracle Java6)
  What JVM are you using?

> Use ConcurrentHashMap in RAMDirectory
> -------------------------------------
>                 Key: LUCENE-2779
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Minor
>             Fix For: 3.1, 4.0
>         Attachments: LUCENE-2779-backwardsfix.patch, LUCENE-2779.patch, LUCENE-2779.patch,
> RAMDirectory synchronizes on its instance in many places to protect access to map of
RAMFiles, in addition to updating the sizeInBytes member. In many places the sync is done
for 'read' purposes, while only in few places we need 'write' access. This looks like a perfect
use case for ConcurrentHashMap
> Also, syncing around sizeInBytes is unnecessary IMO, since it's an AtomicLong ...
> I'll post a patch shortly.

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message