org.schmant.run
Class TaskExecutorStatus

java.lang.Object
  extended by org.schmant.run.TaskExecutorStatus

public class TaskExecutorStatus
extends Object

This object represents the current status of a TaskExecutor. It keeps track of the current number of waiting tasks and the current number of running tasks in the executor. It also keeps track of all failed tasks.

Each time a task reports that it is is done via setDone() (which it does even if it fails), this class calls Object.notifyAll() to wake up all threads waiting for the object's monitor. This is used by TaskExecutor.waitFor().

The methods of this class are protected by the intrinsic lock (synchronized).

Scripts don't have to care about this.

Since:
0.5
Author:
Karl Gustafsson
See Also:
TaskExecutor

Constructor Summary
TaskExecutorStatus()
           
 
Method Summary
 void addWaiting()
          Tell the status object that a new task is waiting.
 void flagForError(TaskRunnable t, Throwable reason)
          Flag that there have been build errors.
 Map<TaskRunnable,Throwable> getFailedTasks()
          Get a map of failed tasks.
 boolean hasErrors()
          Have there been build errors?
 boolean isDone()
           
 void setDone()
          Tell the status object that a task is now done.
 void setRunning()
          Tell the status object that a task is now running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskExecutorStatus

public TaskExecutorStatus()
Method Detail

isDone

public boolean isDone()

flagForError

public void flagForError(TaskRunnable t,
                         Throwable reason)
Flag that there have been build errors.


hasErrors

public boolean hasErrors()
Have there been build errors?

Returns:
true if there have been build errors.

getFailedTasks

public Map<TaskRunnable,Throwable> getFailedTasks()
Get a map of failed tasks.

Returns:
The failed tasks.

addWaiting

public void addWaiting()
Tell the status object that a new task is waiting.


setRunning

public void setRunning()
Tell the status object that a task is now running.


setDone

public void setDone()
Tell the status object that a task is now done.