[Swift-commit] cog r3643
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Mon Mar 18 03:15:08 CDT 2013
------------------------------------------------------------------------
r3643 | hategan | 2013-03-18 03:14:23 -0500 (Mon, 18 Mar 2013) | 1 line
added method to determine if there are any tasks running
------------------------------------------------------------------------
Index: modules/karajan/src/org/globus/cog/karajan/workflow/events/EventBus.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/events/EventBus.java (revision 3642)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/events/EventBus.java (working copy)
@@ -10,10 +10,9 @@
*/
package org.globus.cog.karajan.workflow.events;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.globus.cog.karajan.stack.VariableStack;
@@ -48,10 +47,12 @@
private static final EventBus bus = new EventBus();
public volatile static long eventCount;
- private final ExecutorService es;
+ private final ThreadPoolExecutor es;
public EventBus() {
- es = Executors.newFixedThreadPool(DEFAULT_WORKER_COUNT);
+ es = new ThreadPoolExecutor(DEFAULT_WORKER_COUNT, DEFAULT_WORKER_COUNT,
+ 0L, TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<Runnable>());
}
private void _post(FlowElement target, VariableStack stack) {
@@ -72,6 +73,10 @@
bus._post(target, stack);
}
+ public boolean isAnythingRunning() {
+ return es.getActiveCount() != 0;
+ }
+
public static void post(Runnable r) {
eventCount++;
bus._post(r);
More information about the Swift-commit
mailing list