lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-2779) Use ConcurrentHashMap in RAMDirectory
Date Tue, 30 Nov 2010 04:38:11 GMT


Shai Erera commented on LUCENE-2779:

I didn't add a CHANGES entry because I consider it an internal change. And as a user, I wouldn't
know what to do w/ an entry that says "RAMDirectory now uses CHM".

bq. I don't believe cloning the keySet() will make it more "snapshotty".

Cloning the keySet() will be exactly the 'snapshotty' behavior we're looking for. Before I
made the change, you could call listAll(), lock RAMDir, return the array and before/after
that files could be added/removed. W/ the clone, we'll get the same behavior - files can be
added/removed before the clone, clone would reflect those changes, whatever happens after
the clone is invisible to the iterator - hence why I consider it snapshotty.

> 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