[Swift-commit] cog r3484

swift at ci.uchicago.edu swift at ci.uchicago.edu
Sun Oct 14 22:35:14 CDT 2012


------------------------------------------------------------------------
r3484 | hategan | 2012-10-14 22:30:22 -0500 (Sun, 14 Oct 2012) | 1 line

fixed two deadlocks
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Cpu.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Cpu.java	(revision 3483)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Cpu.java	(working copy)
@@ -242,13 +242,7 @@
     }
 
     private boolean checkSuspended(Block block) {
-        if (block.isSuspended()) {
-            block.shutdownIfEmpty(this);
-            return true;
-        }
-        else {
-            return false;
-        }
+    	return block.isSuspended();
     }
 
     protected void submit(Job job) {
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java	(revision 3483)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java	(working copy)
@@ -116,20 +116,22 @@
         }
         else if (running) {
             Time last = getStartTime();
+            List<Cpu> active = new ArrayList<Cpu>();
             synchronized (cpus) {
-                for (Cpu cpu: cpus) {
-                    if (cpu.getTimeLast().isGreaterThan(last)) {
-                        last = cpu.getTimeLast();
-                    }
+            	active.addAll(cpus);
+            }
+            for (Cpu cpu: active) {
+                if (cpu.getTimeLast().isGreaterThan(last)) {
+                    last = cpu.getTimeLast();
                 }
-                if (cpus.isEmpty()) {
-                    // prevent block from being done when startup of workers is
-                    // really really slow,
-                    // like as on the BGP where it takes a couple of minutes to
-                    // initialize a partition
-                    last = Time.now();
-                }
             }
+            if (active.isEmpty()) {
+                // prevent block from being done when startup of workers is
+                // really really slow,
+                // like as on the BGP where it takes a couple of minutes to
+                // initialize a partition
+                last = Time.now();
+            }
             Time deadline = Time.min(starttime.add(walltime),
                         last.add(bqp.getSettings().getMaxWorkerIdleTime()));
             setDeadline(deadline);



More information about the Swift-commit mailing list