[Swift-commit] r5450 - branches/release-0.93/src/org/griphyn/vdl/karajan

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Tue Dec 20 15:17:20 CST 2011


Author: hategan
Date: 2011-12-20 15:17:20 -0600 (Tue, 20 Dec 2011)
New Revision: 5450

Modified:
   branches/release-0.93/src/org/griphyn/vdl/karajan/FutureTracker.java
   branches/release-0.93/src/org/griphyn/vdl/karajan/Monitor.java
Log:
avoid concurrent modification exceptions when dumping open variables

Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/FutureTracker.java
===================================================================
--- branches/release-0.93/src/org/griphyn/vdl/karajan/FutureTracker.java	2011-12-20 19:33:29 UTC (rev 5449)
+++ branches/release-0.93/src/org/griphyn/vdl/karajan/FutureTracker.java	2011-12-20 21:17:20 UTC (rev 5450)
@@ -46,4 +46,8 @@
     public Map<DSHandle, Future> getMap() {
         return futures;
     }
+    
+    public synchronized Map<DSHandle, Future> getMapSafe() {
+        return new HashMap<DSHandle, Future>(futures);
+    }
 }

Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/Monitor.java
===================================================================
--- branches/release-0.93/src/org/griphyn/vdl/karajan/Monitor.java	2011-12-20 19:33:29 UTC (rev 5449)
+++ branches/release-0.93/src/org/griphyn/vdl/karajan/Monitor.java	2011-12-20 21:17:20 UTC (rev 5450)
@@ -200,7 +200,7 @@
 
 	public static void dumpVariables(PrintStream ps) {
 		ps.println("\nRegistered futures:");
-		Map<DSHandle, Future> map = FutureTracker.get().getMap();
+		Map<DSHandle, Future> map = FutureTracker.get().getMapSafe();
 		synchronized (map) {
 			for (Map.Entry<DSHandle, Future> en : map.entrySet()) {
 				Future f = en.getValue();




More information about the Swift-commit mailing list