[Swift-commit] r3273 - trunk/src/org/griphyn/vdl/mapping

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Apr 5 22:26:43 CDT 2010


Author: hategan
Date: 2010-04-05 22:26:43 -0500 (Mon, 05 Apr 2010)
New Revision: 3273

Modified:
   trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
Log:
make dependence on future mapper params direct

Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2010-04-05 19:18:25 UTC (rev 3272)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2010-04-06 03:26:43 UTC (rev 3273)
@@ -9,9 +9,10 @@
 
 public class RootArrayDataNode extends ArrayDataNode implements DSHandleListener {
 
-	private boolean initialized=false;
+	private boolean initialized = false;
 	private Mapper mapper;
 	private Map params;
+	private DSHandle waitingMapperParam;
 
 	/**
 	 * Instantiate a root array data node with specified type.
@@ -23,9 +24,10 @@
 
 	public void init(Map params) {
 		this.params = params;
-		if(this.params == null) {
+		if (this.params == null) {
 			initialized();
-		} else {
+		} 
+		else {
 			innerInit();
 		}
 	}
@@ -35,9 +37,9 @@
 		while(i.hasNext()) {
 			Map.Entry entry = (Map.Entry) i.next();
 			Object v = entry.getValue();
-			if(v instanceof DSHandle && !( (DSHandle)v).isClosed()) {
-				DSHandle dh = (DSHandle)v;
-				dh.addListener(this);
+			if (v instanceof DSHandle && !((DSHandle) v).isClosed()) {
+				waitingMapperParam = (DSHandle) v;
+				waitingMapperParam.addListener(this);
 				return;
 			}
 		}
@@ -93,25 +95,26 @@
 		return null;
 	}
 
-	public Mapper getMapper() {
-		if(initialized) {
+	public synchronized Mapper getMapper() {
+		if (initialized) {
 			return mapper;
-		} else {
-			throw new VDL2FutureException(this);
 		}
+		else {
+		    assert(waitingMapperParam != null);
+		    throw new VDL2FutureException(waitingMapperParam);
+		}
 	}
 
 	public boolean isArray() {
 		return true;
 	}
 
-        public void setValue(Object value) {
-                super.setValue(value);
-                initialized();
-        }
+    public void setValue(Object value) {
+        super.setValue(value);
+        initialized();
+    }
 
-        private void initialized() {
-                initialized=true;
-        }
-
+    private void initialized() {
+        initialized = true;
+    }
 }




More information about the Swift-commit mailing list