X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=0e3bb9e923077371053715aa0e677adfa0914453;hb=bea1d9b563d2fea018de3dbde9112dd59149126e;hp=5ad956f6452382f8a7b0537f47d235949e0982cd;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 5ad956f..0e3bb9e 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -74,6 +74,9 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; /** * base class holding visualization and analysis attributes and common logic for @@ -995,6 +998,20 @@ public abstract class AlignmentViewport return false; } + private ScheduledExecutorService serviceExecutor = Executors.newSingleThreadScheduledExecutor(); + + /** + * Get a default scheduled executor service which can be used by + * services and calculators to run parallel jobs associated with this + * viewport. + * + * @return default service executor of that viewport + */ + public ScheduledExecutorService getServiceExecutor() + { + return serviceExecutor; + } + public void setAlignment(AlignmentI align) { this.alignment = align; @@ -1024,11 +1041,14 @@ public abstract class AlignmentViewport gapcounts = null; calculator.shutdown(); calculator = null; + serviceExecutor.shutdown(); + serviceExecutor = null; residueShading = null; // may hold a reference to Consensus changeSupport = null; ranges = null; currentTree = null; selectionGroup = null; + colSel = null; setAlignment(null); }