[ 
https://issues.apache.org/jira/browse/LUCENE-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965086#action_12965086
 ] 

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: https://issues.apache.org/jira/browse/LUCENE-2779
>             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, TestCHM.java
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to