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

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu Dec 15 18:12:04 CST 2011


Author: hategan
Date: 2011-12-15 18:12:04 -0600 (Thu, 15 Dec 2011)
New Revision: 5422

Modified:
   branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java
Log:
fixed bug 662

Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java
===================================================================
--- branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java	2011-12-15 20:13:42 UTC (rev 5421)
+++ branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java	2011-12-16 00:12:04 UTC (rev 5422)
@@ -21,11 +21,12 @@
 import org.globus.cog.karajan.workflow.futures.ListenerStackPair;
 import org.griphyn.vdl.mapping.ArrayDataNode;
 
-public class ArrayIndexFutureList implements FutureList, FutureWrapper {
+public class ArrayIndexFutureList implements FutureList, FutureWrapper {    
     private ArrayList<Object> keys;
     private Map<?, ?> values;
     private List<ListenerStackPair> listeners;
     private ArrayDataNode node;
+    private boolean purged;
 
     public ArrayIndexFutureList(ArrayDataNode node, Map<?, ?> values) {
         this.node = node;
@@ -50,11 +51,15 @@
     }
 
     public int available() {
-        return keys.size();
+        synchronized(node) {
+            return keys.size();
+        }
     }
 
     public void addKey(Object key) {
-        keys.add(key);
+        synchronized(node) {
+            keys.add(key);
+        }
         notifyListeners();
     }
 
@@ -67,10 +72,7 @@
     }
 
     public void close() {
-        synchronized(node) {
-            purge();
-        }
-        notifyListeners();
+        throw new UnsupportedOperationException("Not used here");
     }
 
     private void purge() {
@@ -78,11 +80,18 @@
         allkeys.removeAll(keys);
         // remaining keys must be added
         keys.addAll(allkeys);
+        purged = true;
     }
 
     public boolean isClosed() {
         synchronized(node) {
-            return node.isClosed();
+            boolean closed = node.isClosed();
+            if (closed && !purged) {
+                // this is done here because no explicit close() is 
+                // ever called on this object
+                purge();
+            }
+            return closed;
         }
     }
 




More information about the Swift-commit mailing list