[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[imp-commit] r22916 - trunk/org.eclipse.imp.pdb/src/org/eclipse/imp/pdb/indexing

Author: rfuhrer
Date: 2011-03-31 15:05:40 -0400 (Thu, 31 Mar 2011)
New Revision: 22916

The "working copy set" is now copied before handing it to a fact generator, to make sure that no concurrent mod exceptions arise when the client is still processing a previous change when a new change arrives and the Indexer needs to update the working copy set.

Modified: trunk/org.eclipse.imp.pdb/src/org/eclipse/imp/pdb/indexing/Indexer.java
--- trunk/org.eclipse.imp.pdb/src/org/eclipse/imp/pdb/indexing/Indexer.java	2011-03-25 14:26:16 UTC (rev 22915)
+++ trunk/org.eclipse.imp.pdb/src/org/eclipse/imp/pdb/indexing/Indexer.java	2011-03-31 19:05:40 UTC (rev 22916)
@@ -632,8 +632,13 @@
                 IResource res= workItem.fResource;
                 IFactKey key= indexer.fKey;
                 IFactGenerator generator= indexer.fGenerator;
-                Map<IResource, IndexedDocumentDescriptor> workingCopySet= Collections.unmodifiableMap(fDocumentMap);
+                Map<IResource, IndexedDocumentDescriptor> workingCopySet= new HashMap<IResource, IndexedDocumentDescriptor>();
+                // Make a copy of the document/resource map to avoid concurrent mod exceptions
+                // if another document/resource change comes along while some client is still
+                // processing previous changes.
+                workingCopySet.putAll(fDocumentMap);
                 // BUG If a generator is registered to produce two fact types, it will
                 // get invoked once for each type, even if it computes both in one pass.
                 if (workItem.fDocument != null) {