[Swift-commit] r7882 - in trunk/src/org/griphyn/vdl: karajan/lib mapping/nodes

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu May 29 01:51:17 CDT 2014


Author: hategan
Date: 2014-05-29 01:51:16 -0500 (Thu, 29 May 2014)
New Revision: 7882

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/Mark.java
   trunk/src/org/griphyn/vdl/mapping/nodes/AbstractFutureArrayDataNode.java
Log:
properly set exceptions on dynamic arrays when an app fails

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Mark.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Mark.java	2014-05-29 06:38:03 UTC (rev 7881)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Mark.java	2014-05-29 06:51:16 UTC (rev 7882)
@@ -32,6 +32,7 @@
 import org.griphyn.vdl.mapping.DataDependentException;
 import org.griphyn.vdl.mapping.MappingDependentException;
 import org.griphyn.vdl.mapping.nodes.AbstractDataNode;
+import org.griphyn.vdl.mapping.nodes.AbstractFutureArrayDataNode;
 
 public class Mark extends SwiftFunction {
     private ArgRef<Channel<AbstractDataNode>> restarts;
@@ -48,18 +49,31 @@
         try {
             if (err.getValue(stack)) {
                 boolean mapping = this.mapping.getValue(stack);
+                
                 Channel<AbstractDataNode> files = this.restarts.getValue(stack);
                 for (AbstractDataNode dn : files) {
-                    Collection<DSHandle> leaves = dn.getLeaves();
-                    for (DSHandle leaf : leaves) {
-                        synchronized (leaf) {
-                            if (mapping) {
-                                leaf.setValue(new MappingDependentException(leaf, null));
+                    if (dn.getType().isArray() && !dn.isClosed()) {
+                        // a dynamic array
+                        AbstractFutureArrayDataNode fdn = (AbstractFutureArrayDataNode) dn;
+                        if (mapping) {
+                            fdn.setException(new MappingDependentException(dn, null));
+                        }
+                        else {
+                            fdn.setException(new DataDependentException(dn, null));
+                        }
+                    }
+                    else {
+                        Collection<DSHandle> leaves = dn.getLeaves();
+                        for (DSHandle leaf : leaves) {
+                            synchronized (leaf) {
+                                if (mapping) {
+                                    leaf.setValue(new MappingDependentException(leaf, null));
+                                }
+                                else {
+                                    leaf.setValue(new DataDependentException(leaf, null));
+                                }
+                                leaf.closeShallow();
                             }
-                            else {
-                                leaf.setValue(new DataDependentException(leaf, null));
-                            }
-                            leaf.closeShallow();
                         }
                     }
                 }

Modified: trunk/src/org/griphyn/vdl/mapping/nodes/AbstractFutureArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/nodes/AbstractFutureArrayDataNode.java	2014-05-29 06:38:03 UTC (rev 7881)
+++ trunk/src/org/griphyn/vdl/mapping/nodes/AbstractFutureArrayDataNode.java	2014-05-29 06:51:16 UTC (rev 7882)
@@ -229,4 +229,9 @@
     public int arraySize() {
         return handles.size();
     }
+    
+    public synchronized void setException(RuntimeException e) {
+        this.exception = e;
+        closeShallow();
+    }
 }




More information about the Swift-commit mailing list