[Swift-commit] r2402 - trunk/src/org/griphyn/vdl/karajan/lib

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Jan 7 14:05:12 CST 2009


Author: benc
Date: 2009-01-07 14:05:11 -0600 (Wed, 07 Jan 2009)
New Revision: 2402

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/GetFieldValue.java
Log:
lock in GetFieldValue

Modified: trunk/src/org/griphyn/vdl/karajan/lib/GetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/GetFieldValue.java	2009-01-07 19:45:22 UTC (rev 2401)
+++ trunk/src/org/griphyn/vdl/karajan/lib/GetFieldValue.java	2009-01-07 20:05:11 UTC (rev 2402)
@@ -32,25 +32,26 @@
 			return var1;
 		}
 		DSHandle var = (DSHandle) var1;
-		try {
-			Path path = parsePath(OA_PATH.getValue(stack), stack);
-			if (path.hasWildcards()) {
-				try {
-					return var.getFields(path).toArray();
+		DSHandle root = var.getRoot();
+		synchronized(root) {
+			try {
+				Path path = parsePath(OA_PATH.getValue(stack), stack);
+				if (path.hasWildcards()) {
+					try {
+						return var.getFields(path).toArray();
+					}
+					catch (HandleOpenException e) {
+						if (logger.isDebugEnabled()) {
+							logger.debug("Waiting for var=" + var + " path=" + path);
+						}
+						throw new FutureNotYetAvailable(addFutureListener(stack, e.getSource()));
+					}
 				}
-				catch (HandleOpenException e) {
-					if (logger.isDebugEnabled()) {
-						logger.debug("Waiting for var=" + var + " path=" + path);
+				else {
+					var = var.getField(path);
+					if (var.getType().isArray()) {
+						throw new RuntimeException("Getting value for array "+var+" which is not permitted.");
 					}
-					throw new FutureNotYetAvailable(addFutureListener(stack, e.getSource()));
-				}
-			}
-			else {
-				var = var.getField(path);
-				if (var.getType().isArray()) {
-					throw new RuntimeException("Getting value for array "+var+" which is not permitted.");
-				}
-				synchronized (var) {
 					if (!var.isClosed()) {
 						if (logger.isDebugEnabled()) {
 							logger.debug("Waiting for " + var);
@@ -62,10 +63,9 @@
 					}
 				}
 			}
+			catch (InvalidPathException e) {
+				throw new ExecutionException(e);
+			}
 		}
-		catch (InvalidPathException e) {
-			throw new ExecutionException(e);
-		}
 	}
-
 }




More information about the Swift-commit mailing list