|
From: <caw...@us...> - 2007-01-25 18:26:32
|
Revision: 1884
http://svn.sourceforge.net/rubyeclipse/?rev=1884&view=rev
Author: cawilliams
Date: 2007-01-25 10:26:24 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
fix concurrency issue by cloning array before returning it
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java 2007-01-25 16:54:46 UTC (rev 1883)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java 2007-01-25 18:26:24 UTC (rev 1884)
@@ -20,8 +20,8 @@
public class ExperimentalIndex implements IElementChangedListener {
private static ExperimentalIndex fgInstance;
- private static List<String> fgConstants;
- private static List<String> fgTypes;
+ private static ArrayList<String> fgConstants;
+ private static ArrayList<String> fgTypes;
private ExperimentalIndex() {
fgTypes = new ArrayList<String>();
@@ -33,13 +33,11 @@
}
public static List<String> getTypes() {
- // XXX We need to handle case where this gets invoked while index is updating (and we get a concurrent modification exception)!
- return Collections.unmodifiableList(fgTypes);
+ return Collections.unmodifiableList((ArrayList<String>)fgTypes.clone()); // clone to avoid concurrent modification when iterating
}
public static List<String> getConstants() {
-// XXX We need to handle case where this gets invoked while index is updating (and we get a concurrent modification exception)!
- return Collections.unmodifiableList(fgConstants);
+ return Collections.unmodifiableList((ArrayList<String>)fgConstants.clone()); // clone to avoid concurrent modification when iterating
}
private void processDelta(IRubyElementDelta delta) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|