[Swift-commit] cog r3509

swift at ci.uchicago.edu swift at ci.uchicago.edu
Sun Nov 11 20:05:05 CST 2012


------------------------------------------------------------------------
r3509 | hategan | 2012-11-11 20:00:57 -0600 (Sun, 11 Nov 2012) | 1 line

make sure empty sub-lists in SortedJobSet are removed since the iterator assumes that
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/SortedJobSet.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/SortedJobSet.java	(revision 3508)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/SortedJobSet.java	(working copy)
@@ -103,6 +103,12 @@
     public void remove(Job job) {
         LinkedList<Job> l = sm.get(job.getMaxWallTime());
         l.remove(job);
+        // the iterator assumes that a if a list for a key exists
+        // then it must have at least one element, so make sure
+        // that empty lists are not kept
+        if (l.isEmpty()) {
+            sm.remove(job.getMaxWallTime());
+        }
         size--;
     }
 
@@ -131,8 +137,7 @@
         return null;
     }
 
-    Job removeOne(TimeInterval key, List<Job> jobs, int cpus)
-    {
+    private Job removeOne(TimeInterval key, List<Job> jobs, int cpus) {
         Job result = null;
         for (Iterator<Job> it = jobs.iterator(); it.hasNext(); ) {
             Job job = it.next();



More information about the Swift-commit mailing list