diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/threads/VitroBackgroundThread.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/threads/VitroBackgroundThread.java index bebd50ec0..8f5fd3908 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/threads/VitroBackgroundThread.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/threads/VitroBackgroundThread.java @@ -23,6 +23,9 @@ public class VitroBackgroundThread extends Thread { private static final ConcurrentLinkedQueue> allThreads = new ConcurrentLinkedQueue>(); + /** + * Get a list of all VitroBackgroundThreads that have not been garbage-collected. + */ public static List getThreads() { List list = new ArrayList(); for (WeakReference ref : allThreads) { @@ -34,6 +37,19 @@ public class VitroBackgroundThread extends Thread { return list; } + /** + * Get a list of all VitroBackgroundThreads that have not died. + */ + public static List getLivingThreads() { + List list = new ArrayList(); + for (VitroBackgroundThread t : getThreads()) { + if (t.isAlive()) { + list.add(t); + } + } + return list; + } + public enum WorkLevel { IDLE, WORKING }