[Swift-commit] cog r3497

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Oct 29 10:41:11 CDT 2012


------------------------------------------------------------------------
r3497 | davidkelly999 | 2012-10-29 10:37:48 -0500 (Mon, 29 Oct 2012) | 2 lines

Bug #859 fix for 0.94 branch

------------------------------------------------------------------------
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 3496)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java	(working copy)
@@ -256,54 +256,57 @@
     }
 
     public void shutdown(boolean now) {
+        List<Cpu> cpusToShutDown;
         synchronized (cpus) {
             if (shutdown) {
                 return;
             }
-            logger.info("Shutting down block " + this);
-            bqp.getRLogger().log("BLOCK_SHUTDOWN id=" + getId());
             shutdown = true;
-            long busyTotal = 0;
-            long idleTotal = 0;
-            int count = 0;
-            if (running) {
-                for (Cpu cpu : cpus) {
-                    idleTotal = cpu.idleTime;
-                    busyTotal = cpu.busyTime;
-                    if (!failed) {
-                        cpu.shutdown();
-                    }
-                    count++;
+            cpusToShutDown = new ArrayList<Cpu>(cpus);
+            cpus.clear();
+        }
+        logger.info("Shutting down block " + this);
+        bqp.getRLogger().log("BLOCK_SHUTDOWN id=" + getId());
+        
+        long busyTotal = 0;
+        long idleTotal = 0;
+        int count = 0;
+        if (running) {
+            for (Cpu cpu : cpusToShutDown) {
+                idleTotal = cpu.idleTime;
+                busyTotal = cpu.busyTime;
+                if (!failed) {
+                    cpu.shutdown();
                 }
-				if (!failed) {
-					if (count < workers || now) {
-					    if (logger.isInfoEnabled()) {
-					        logger.info("Adding short shutdown watchdog: count = " + 
-					            count + ", workers = " + workers + ", now = " + now);
-					    }
-	                    addForcedShutdownWatchdog(100);
-    	            }
-					else {
-					    if (logger.isInfoEnabled()) {
-					        logger.info("Adding normal shutdown watchdog");
-					    }
-	   					addForcedShutdownWatchdog(SHUTDOWN_WATCHDOG_DELAY);
-					}
+                count++;
+            }
+			if (!failed) {
+				if (count < workers || now) {
+				    if (logger.isInfoEnabled()) {
+				        logger.info("Adding short shutdown watchdog: count = " + 
+				            count + ", workers = " + workers + ", now = " + now);
+				    }
+                    addForcedShutdownWatchdog(100);
+	            }
+				else {
+				    if (logger.isInfoEnabled()) {
+				        logger.info("Adding normal shutdown watchdog");
+				    }
+   					addForcedShutdownWatchdog(SHUTDOWN_WATCHDOG_DELAY);
 				}
+			}
 
-                if (idleTotal > 0) {
-                    double u = (busyTotal * 10000) / (busyTotal + idleTotal);
-                    u /= 100;
-                    logger.info("Average utilization: " + u + "%");
-                    bqp.getRLogger().log("BLOCK_UTILIZATION id=" + getId() + ", u=" + u);
-                }
+            if (idleTotal > 0) {
+                double u = (busyTotal * 10000) / (busyTotal + idleTotal);
+                u /= 100;
+                logger.info("Average utilization: " + u + "%");
+                bqp.getRLogger().log("BLOCK_UTILIZATION id=" + getId() + ", u=" + u);
             }
-            else {
-                logger.info("Block " + this + " not running. Cancelling job.");
-                forceShutdown();
-            }
-            cpus.clear();
         }
+        else {
+            logger.info("Block " + this + " not running. Cancelling job.");
+            forceShutdown();
+        }
     }
 
     private void addForcedShutdownWatchdog(long delay) {



More information about the Swift-commit mailing list