JAL-1115 - synchronized access to group list
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Jun 2012 11:28:38 +0000 (12:28 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Jun 2012 14:02:05 +0000 (15:02 +0100)
src/jalview/ws/rest/params/SeqGroupIndexVector.java

index 1af0440..2c6d78a 100644 (file)
@@ -92,7 +92,10 @@ public class SeqGroupIndexVector extends InputType implements
     // blocks
     ArrayList<int[]> gl = new ArrayList<int[]>();
     int p = 0;
-    for (SequenceGroup sg : (Vector<SequenceGroup>) al.getGroups())
+    List<SequenceGroup> sgs;
+    synchronized (sgs=al.getGroups())
+    {
+    for (SequenceGroup sg : sgs)
     {
       if (sg.getSize() < minsize)
       {
@@ -123,6 +126,7 @@ public class SeqGroupIndexVector extends InputType implements
         gl.add(se);
       }
     }
+    }
     // are there any more sequences ungrouped that should be added as a single
     // remaining group ? - these might be at the start or the end
     if (gl.size() > 0)