|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TaskContainer
Container object for tasks.
Note that a task container must be able to contain any task, so it has
no generic parameters for task result type or task object type. The
consequence of this is that these types are unknown. So, a task
pulled from a container has type Task<?,?>
, and its
getObject()
an Task.getResult()
methods return a Object
.
Field Summary | |
---|---|
static String |
TASKCONTAINER_STATE
Metric name: fires on state changes of any task in the container, and has the value of that task's object identifier. |
Fields inherited from interface org.ogf.saga.SagaObject |
---|
NO_WAIT, WAIT_FOREVER |
Method Summary | |
---|---|
void |
add(Task<?,?> task)
Adds a task to the task container. |
void |
cancel()
Cancels all the asynchronous operations in the container. |
void |
cancel(float timeoutInSeconds)
Cancels all the asynchronous operations in the container. |
State[] |
getStates()
Gets the states of all tasks in the task container. |
Task<?,?> |
getTask(String id)
Gets a single task from the task container. |
Task<?,?>[] |
getTasks()
Gets the tasks in this task container. |
void |
remove(Task<?,?> task)
Removes the specified task from this container. |
void |
run()
Starts all asynchronous operations in the container. |
int |
size()
Returns the number of tasks in this task container. |
Task<?,?> |
waitFor()
Waits for all tasks to end up in a final state. |
Task<?,?> |
waitFor(float timeoutInSeconds)
Waits for all tasks to end up in a final state. |
Task<?,?> |
waitFor(float timeoutInSeconds,
WaitMode mode)
Waits for one or more of the tasks to end up in a final state. |
Task<?,?> |
waitFor(WaitMode mode)
Waits for one or more of the tasks to end up in a final state. |
Methods inherited from interface org.ogf.saga.SagaObject |
---|
clone, getId, getSession |
Methods inherited from interface org.ogf.saga.monitoring.Monitorable |
---|
addCallback, getMetric, listMetrics, removeCallback |
Field Detail |
---|
static final String TASKCONTAINER_STATE
Method Detail |
---|
void add(Task<?,?> task) throws NotImplementedException, TimeoutException, NoSuccessException
task
- the task to add.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.void remove(Task<?,?> task) throws NotImplementedException, DoesNotExistException, TimeoutException, NoSuccessException
task
- the task to be removed.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
DoesNotExistException
- is thrown when the container does not contain the specified task.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.void run() throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- is thrown when any of the tasks in the container
is not in NEW state.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.Task<?,?> waitFor() throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- may be thrown when any of the tasks in the container
would throw this on Task.waitFor()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.Task<?,?> waitFor(WaitMode mode) throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
mode
- wait for ALL or ANY task.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- may be thrown when any of the tasks in the container
would throw this on Task.waitFor()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.Task<?,?> waitFor(float timeoutInSeconds) throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
null
is returned.
timeoutInSeconds
- number of seconds to wait.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- may be thrown when any of the tasks in the container
would throw this on Task.waitFor()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.Task<?,?> waitFor(float timeoutInSeconds, WaitMode mode) throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
null
is returned.
timeoutInSeconds
- number of seconds to wait.mode
- wait for ALL or ANY task.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- may be thrown when any of the tasks in the container
would throw this on Task.waitFor()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.void cancel() throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- is thrown when any of the tasks in the container
would throw this on Task.cancel()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.void cancel(float timeoutInSeconds) throws NotImplementedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException
timeoutInSeconds
- time for freeing resources.
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
IncorrectStateException
- is thrown when any of the tasks in the container
would throw this on Task.cancel()
.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
DoesNotExistException
- is thrown when the container does not contain any tasks.int size() throws NotImplementedException, TimeoutException, NoSuccessException
NotImplementedException
TimeoutException
NoSuccessException
Task<?,?> getTask(String id) throws NotImplementedException, DoesNotExistException, TimeoutException, NoSuccessException
id
- the object identifier of the task (typically obtained from the
TASKCONTAINER_STATE
metric).
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
DoesNotExistException
- is thrown when the container does not contain a task for the
specified id.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.Task<?,?>[] getTasks() throws NotImplementedException, TimeoutException, NoSuccessException
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.State[] getStates() throws NotImplementedException, TimeoutException, NoSuccessException
NotImplementedException
- is thrown if the implementation does not provide an
implementation of this method.
TimeoutException
- is thrown when a remote operation did not complete successfully
because the network communication or the remote service timed
out.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |