diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/Scheduler.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/Scheduler.java index bc9a5b448..a37920097 100644 --- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/Scheduler.java +++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/Scheduler.java @@ -109,4 +109,14 @@ public interface Scheduler extends ExecutionListener { */ public void setExecutor(Executor executor); - void invokeAndWait(Runnable doRun) throws InterruptedException;} + /** + * Invokes the runnable and waits for it to finish. + *

+ * Note: This method is strongly implementation-based so it is advised to check with the documentation + * specific for each Scheduler implementation. + * + * @param doRun the runnable to invoke. + * @throws InterruptedException if the invocation was interrupted. + */ + void invokeAndWait(Runnable doRun) throws InterruptedException; +} diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/SingleThreadedScheduler.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/SingleThreadedScheduler.java index c4c2430e2..a471844e4 100644 --- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/SingleThreadedScheduler.java +++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/SingleThreadedScheduler.java @@ -255,13 +255,14 @@ public void setExecutor(Executor executor) { /** - * This function is an updated addTask for one-time execution tasks. - * Not only it adds the task to the task list but also attaches a runnable - * instance to it and calling wait() on the task, which sets it to sleep - * until woken up by anyone calling notify() on same monitor. + * This method instantiates a special kind of task of type + * {@link cz.cuni.mff.d3s.deeco.scheduler.InvokeAndWaitTask InvokeAndWaitTask} + * attaching a runnable and a scheduler, in whose context the runnable will run, to it. + * After executing the task(which will invoke the runnable) and adding it to the list of the tasks + * it waits, until awaken by someone's notification sharing a monitor with that task. * - * @param doRun the runnable instance - * @throws InterruptedException + * @param doRun the runnable instance + * @throws InterruptedException when the invocation is interrupted */ public void invokeAndWait(Runnable doRun) throws InterruptedException { InvokeAndWaitTask task = new InvokeAndWaitTask(this, doRun);