[Swift-commit] cog r4036

swift at ci.uchicago.edu swift at ci.uchicago.edu
Fri Jul 25 10:20:03 CDT 2014


------------------------------------------------------------------------
r4036 | timgarmstrong | 2014-07-25 10:17:32 -0500 (Fri, 25 Jul 2014) | 1 line

Workaround for double starting of PassiveQueueProcessorThread.
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java	(revision 4035)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java	(working copy)
@@ -20,8 +20,11 @@
 import org.globus.cog.coaster.channels.CoasterChannel;
 
 public class PassiveQueueProcessor extends BlockQueueProcessor {
+
+    private boolean started = false;
+
     private final URI callbackURI;
-    
+
     private int currentWorkers;
 
     public PassiveQueueProcessor(LocalTCPService localService, URI callbackURI) {
@@ -55,18 +58,18 @@
     protected void removeIdleBlocks() {
         // no removing of idle blocks here
     }
-    
+
     @Override
     public String registrationReceived(String blockID, String workerID, String workerHostname,
             CoasterChannel channel, Map<String, String> options) {
-        
+
         String r = getBlock(blockID).workerStarted(workerID, workerHostname, channel, options);
-        
+
         if (clientIsConnected()) {
             ResourceUpdateCommand wsc;
             synchronized(this) {
                 currentWorkers++;
-                wsc = new ResourceUpdateCommand("job-capacity", 
+                wsc = new ResourceUpdateCommand("job-capacity",
                     String.valueOf(currentWorkers * getSettings().getJobsPerNode()));
             }
             try {
@@ -76,7 +79,7 @@
                 logger.info("Failed to send worker status update to client", e);
             }
         }
-        
+
         return r;
     }
 
@@ -102,7 +105,7 @@
         ResourceUpdateCommand wsc;
         synchronized(this) {
             currentWorkers--;
-            wsc = new ResourceUpdateCommand("job-capacity", 
+            wsc = new ResourceUpdateCommand("job-capacity",
                 String.valueOf(node.getConcurrency()));
             if (node.getBlock().getNodes().isEmpty()) {
                 getBlocks().remove(node.getBlock().getId());
@@ -117,4 +120,13 @@
             logger.warn("Failed to send worker status update to client", e);
         }
     }
+
+    @Override
+    public synchronized void start() {
+        // TODO: workaround for double start problem. Unsure if final solution.
+        if (!this.started) {
+            super.start();
+            this.started = true;
+        }
+    }
 }



More information about the Swift-commit mailing list