|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
M - The type for the job metadata parameter in
#startJob(UUID, Object).T - The type for the task in #submit(UUID, Object).public interface IJobAndTaskService<M extends IJobMetadata,T extends ITask>
A interface for a service using a job and task model. The service may have
many clients, and each client may start jobs and execute tasks within running
jobs. A job must be started before tasks may be submitted. Tasks run with
some unknown concurrency. The service MUST be sent a heartbeat for each job
to keep tasks running in that job. The heartbeat returns the #of completed
tasks for that job. The client can drain the completed tasks for a job,
transferring information about their Outcome to itself. A pending or
running task may be cancelled, in which case it will show up as completed
(with Status.Cancelled). If the service does not receive several
heatbeats in a row for a job, then it will cancel the job and all tasks
running in that job. When the client is done executing tasks for a job, it
should cancel the job. When a job is cancelled, all state for that job is
thrown away.
Note: This interface extends Remote since it may be used as a remote
service. Per the contract of the Remote interface, methods on this
interface are declared to throw IOException since they may be invoked
by RMI.
| Method Summary | |
|---|---|
boolean |
cancel(UUID job,
UUID task)
Cancel a task. |
void |
cancelJob(UUID job)
Terminate a job. |
Outcome[] |
drain(UUID job)
Drains the Outcomes for all completed tasks. |
UUID |
getServiceUUID()
The unique identifier for this service. |
int |
heartbeat(UUID job)
The service will cancelJob(UUID) the job if it does not continue
to receive heartbeat for that job. |
void |
startJob(M jobMetadata)
Declare a job. |
void |
submit(UUID job,
T task,
long timeout)
Submit a task to be executed as part of a job (asynchronous). |
| Method Detail |
|---|
UUID getServiceUUID()
throws IOException
IOException
void startJob(M jobMetadata)
throws IOException
heartbeat(UUID) messages or the service will
cancel the job.
jobMetadata - The service specific job metadata.
IOException
void cancelJob(UUID job)
throws IOException
heartbeat(UUID) messages for this job.
job - The job identifier.
IllegalStateException - if the job is not known to the service.
IOException
int heartbeat(UUID job)
throws IOException
cancelJob(UUID) the job if it does not continue
to receive heartbeat for that job. The service timeout for a job is on
the order of a few seconds, but clients are encouraged to send heartbeats
ever 100ms.
Note: Clients may also use this message to monitor the progression of tasks for the specified job.
job - The job identifier.
IOException
Outcome[] drain(UUID job)
throws IOException
Outcomes for all completed tasks. The Outcome
for those tasks is no longer available from the service.
job - The job identifier.
Outcomes.
IOException
void submit(UUID job,
T task,
long timeout)
throws IOException
Status, it
will be reported by heartbeat(UUID) and its Outcome will
be made available by drain(UUID).
job - The job identifier.task - The task to be executed.timeout - When non-zero, the timeout in milliseconds for this task once
it begins to execute on the service (this controls the actual
maximum run time of the task rather than the time since the
task was submitted or since the job was started).
IOException
boolean cancel(UUID job,
UUID task)
throws IOException
job - The job identifier.task - The task identifier.
Future.cancel(boolean)).
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||