JAL-3878 Add methods to get and remove workers by their calc name.
[jalview.git] / src / jalview / api / AlignCalcManagerI2.java
index 756e402..36bcda2 100644 (file)
@@ -32,7 +32,13 @@ public interface AlignCalcManagerI2
    * {@ink Class#equals(Object)} rather than {@code instanceof}.
    */
   List<AlignCalcWorkerI> getWorkersOfClass(Class<? extends AlignCalcWorkerI> cls);
-  
+
+  /**
+   * Returns the list of all workers for the given name or an empty list
+   * if there are none.
+   */
+  List<AlignCalcWorkerI> getWorkersForName(String name);
+
   /**
    * Removes the worker from the scheduler. It does not cancel workers
    * already scheduled for execution.
@@ -45,6 +51,18 @@ public interface AlignCalcManagerI2
   void removeWorkerForAnnotation(AlignmentAnnotation annot);
   
   /**
+   * Alias of removeWorkerForAnnotation
+   */
+  default void removeWorkersForAnnotation(AlignmentAnnotation annot) {
+    removeWorkerForAnnotation(annot);
+  }
+
+  /**
+   * Removes all workers with matching name.
+   */
+  void removeWorkersForName(String name);
+
+  /**
    * Removes all workers of a given class. The classes are compared using
    * {@link Class#equals(Object)}. 
    */
@@ -111,4 +129,10 @@ public interface AlignCalcManagerI2
    * Remove previously registered worker listener.
    */
   void removeAlignCalcListener(AlignCalcListener listener);
+  
+  /**
+   * Stops the manager from running new jobs and cleans-up all
+   * resources such as threads and thread pools.
+   */
+  void shutdown();
 }