Author: mes
Date: 2011-01-04 16:40:31 -0800 (Tue, 04 Jan 2011)
New Revision: 23298
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTaskManager.java
core3/work-api/trunk/src/main/java/org/cytoscape/work/TaskManager.java
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
Log:
added an executeAndWait method to TaskManager to handle the blocking case
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTaskManager.java
===================================================================
---
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTaskManager.java
2011-01-05 00:11:24 UTC (rev 23297)
+++
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTaskManager.java
2011-01-05 00:40:31 UTC (rev 23298)
@@ -20,5 +20,13 @@
return tunableInterceptor.hasTunables(o);
}
- abstract public void execute(TaskFactory factory);
+ final public void execute(TaskFactory factory) {
+ execute(factory,false);
+ }
+
+ final public void executeAndWait(TaskFactory factory) {
+ execute(factory,true);
+ }
+
+ abstract protected void execute(TaskFactory factory, boolean wait);
}
Modified: core3/work-api/trunk/src/main/java/org/cytoscape/work/TaskManager.java
===================================================================
--- core3/work-api/trunk/src/main/java/org/cytoscape/work/TaskManager.java
2011-01-05 00:11:24 UTC (rev 23297)
+++ core3/work-api/trunk/src/main/java/org/cytoscape/work/TaskManager.java
2011-01-05 00:40:31 UTC (rev 23298)
@@ -2,26 +2,36 @@
/**
- * Executes a <code>Task</code>.
- *
- * @author Pasteur
+ * Executes the Tasks found in the TaskIterator provided by a TaskFactory.
*/
public interface TaskManager {
- /** Tests an object for having tunable annotations.
- *
- * @return true if "o" has tunable annotations and else false.
+ /**
+ * Tests an object for having tunable annotations.
+ * @return true if "o" has tunable annotations and else false.
*/
boolean hasTunables(final Object o);
/**
- * This method is called to execute a <code>Task</code>.
- *
+ * This method is called to execute the Tasks in a TaskIterator provided
+ * by a <code>TaskFactory</code>.
* This method returns once the <code>Task</code>s derived from the
<code>TaskIterator</code>
- * returned by the <code>TaskFactory</code>'s
<code>getTaskIterator()</code> method started execution.
- * It does not wait for the <code>Task</code>s to finish.
- *
- * @param factory the <code>TaskFactory</code> whose tasks returned
by its getTaskIterator()
- * method's iterator will be executed
+ * returned by the <code>TaskFactory</code>'s
<code>getTaskIterator()</code> method have
+ * started (but not necessarily completed) execution.
+ * It <i>does not wait</i> for the <code>Task</code>s to finish.
+ * @param factory The <code>TaskFactory</code> whose tasks returned by
its getTaskIterator()
+ * method's iterator will be executed
*/
void execute(TaskFactory factory);
+
+ /**
+ * This method is called to execute the Tasks in a TaskIterator provided
+ * by a <code>TaskFactory</code>.
+ * This method returns once the <code>Task</code>s derived from the
<code>TaskIterator</code>
+ * returned by the <code>TaskFactory</code>'s
<code>getTaskIterator()</code> method have
+ * started <b>and completed</b> execution. It <i>waits (potentially
forever)</i> for
+ * the <code>Task</code>s to finish.
+ * @param factory The <code>TaskFactory</code> whose tasks returned by
its getTaskIterator()
+ * method's iterator will be executed
+ */
+ void executeAndWait(TaskFactory factory);
}
Modified:
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
===================================================================
---
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2011-01-05 00:11:24 UTC (rev 23297)
+++
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2011-01-05 00:40:31 UTC (rev 23298)
@@ -45,7 +45,7 @@
return this.tunableInterceptor;
}
- public void execute(TaskFactory factory) {
+ protected void execute(TaskFactory factory, boolean wait) {
}
}
@@ -82,4 +82,4 @@
assertTrue("This object has annotated getter/setter methods!",
taskManager.hasTunables(new
HasAnnotatedSetterAndGetterMethods()));
}
-}
\ No newline at end of file
+}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.