|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.TaskManager.Job
public static class TaskManager.Job
Represents a job that consists of the execution of a number of tasks.
It is not possible to create an object of this class directly. Objects
of type TaskManager.Job are returned by TaskManager.executeAsync(Collection)
and TaskManager.createJob()
. The tasks that are part of a job will
be exectued by the TaskManager that created the job, using the pool of
threads in that TaskManager. A job can start executing as soon as it has
been created and the first task has been added.
TaskManager
Method Summary | |
---|---|
void |
add(java.lang.Runnable task)
Add a task to this job. |
boolean |
await(int timeoutMilliseconds)
Waits either a specified amount of time or indefinitely for this job to finish. |
void |
cancel()
Cancel the job. |
void |
close()
"Close" this job, making it possible for the job to complete. |
int |
failedTaskCount()
Returns the number of tasks in this job that have been terminated because of an exception. |
java.lang.Runnable[] |
failedTasks()
Returns an array that contains tasks from this job that have terminated because of an Error or Exception. |
int |
finishedTaskCount()
Returns the number of tasks in this job that have been completed successfully. |
java.lang.Runnable[] |
finishedTasks()
Returns an array that contains tasks from this job that have completed successfully. |
double |
fractionDone()
Tells the fraction of tasks that have been added to this job that have been completed. |
boolean |
isCanceled()
Tells whether hte job has been canceled. |
boolean |
isFinished()
Tells whether the job is finished. |
int |
totalTaskCount()
Returns the number of tasks that have been added to this job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void add(java.lang.Runnable task)
close()
.
task
- the task that is to be added to this job. A null value is ignored.
java.lang.IllegalStateException
- if the job has already been closed.public void close()
TaskManager.executeAsync(Collection)
is already closed when it is returned by
that method. A job that was created using TaskManager.createJob()
must
be closed, or it will be impossible for that job to finish; the job should be closed
by calling this method after all the tasks that are part of the job have been added.
public double fractionDone()
public int finishedTaskCount()
public int failedTaskCount()
public int totalTaskCount()
public void cancel()
public boolean isFinished()
public boolean isCanceled()
cancel()
.
public java.lang.Runnable[] finishedTasks()
public java.lang.Runnable[] failedTasks()
public boolean await(int timeoutMilliseconds)
timeoutMilliseconds
- the maximum time to wait for the job to finish. A value
of 0 (or less) means to wait as long as it takes for the job to finish.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |