Package org.jppf.client.balancer
Class ClientJob
java.lang.Object
org.jppf.client.balancer.AbstractClientJob
org.jppf.client.balancer.ClientJob
- Author:
- Martin JANDA, Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intThe original number of tasks in the job.Fields inherited from class org.jppf.client.balancer.AbstractClientJob
job, parentJob -
Constructor Summary
ConstructorsModifierConstructorDescriptionClientJob(JPPFJob job, Collection<org.jppf.node.protocol.Task<?>> tasks) Initialized client job with task bundle and list of tasks to execute.protectedClientJob(JPPFJob job, Collection<org.jppf.node.protocol.Task<?>> tasks, ClientJob parentJob, String broadcastUUID) Initialized client job with task bundle and list of tasks to execute. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbroadcastCompleted(ClientJob broadcastJob) Called to notify that the execution of broadcast job has completed.protected voidbroadcastDispatched(ClientJob broadcastJob) Called when all or part of broadcast job is dispatched to a driver.booleancancel(boolean mayInterruptIfRunning) Cancels this job.copy(int nbTasks) Make a copy of this client job wrapper containing only the first nbTasks tasks it contains.createBroadcastJob(String broadcastUUID) Make a copy of this client job wrapper.intGet the broadcast UUID.Get the status of this job.intGet count of channels on which this job is executed.intGet the current number of tasks in the job.org.jppf.node.protocol.graph.TaskGraphbooleanprotected booleanGet indicator whether job has pending tasks.voidjobDispatched(ClientTaskBundle bundle, ChannelWrapper channel) Called when all or part of a job is dispatched to a node.voidNotify that this job was requeued.protected booleanMerge this client job wrapper with another.voidresultsReceived(ClientTaskBundle bundle, Throwable throwable) Called to notify that throwable eventually raised while receiving the results.voidresultsReceived(ClientTaskBundle bundle, List<org.jppf.node.protocol.Task<?>> results) Called to notify that the results of a number of tasks have been received from the server.voidsetJobStatus(JobStatus jobStatus) Set the status of this job.voidsetOnRequeue(Runnable onRequeue) Set the requeue handler.voidtaskCompleted(ClientTaskBundle bundle, Exception exception) Called to notify that the execution of a task has completed.toString()Methods inherited from class org.jppf.client.balancer.AbstractClientJob
acceptsChannel, addChannel, addOnDone, clearChannels, done, getClientSLA, getJob, getJobReceivedTime, getMetadata, getName, getQueueEntryTime, getSLA, getUuid, isCancelled, isCancelling, isCancellingOrCancelled, isDone, isJobExpired, isPending, jobExpired, preparePolicy, removeChannel, removeOnDone, setClientSLA, setJobReceivedTime, setMetadata, setName, setPending, setQueueEntryTime, setSLA, setUuid, updateStatus
-
Field Details
-
initialTaskCount
protected final int initialTaskCountThe original number of tasks in the job.
-
-
Constructor Details
-
ClientJob
Initialized client job with task bundle and list of tasks to execute.- Parameters:
job- underlying task bundle.tasks- list of tasks to execute.
-
ClientJob
protected ClientJob(JPPFJob job, Collection<org.jppf.node.protocol.Task<?>> tasks, ClientJob parentJob, String broadcastUUID) Initialized client job with task bundle and list of tasks to execute.- Parameters:
job- underlying task bundle.tasks- list of tasks to execute.parentJob- instance of parent broadcast job.broadcastUUID- the broadcast UUID, i.e. the uuid of the connection the job is broadcast to.
-
-
Method Details
-
getTaskCount
public int getTaskCount()Get the current number of tasks in the job.- Returns:
- the number of tasks as an int.
-
createBroadcastJob
Make a copy of this client job wrapper.- Parameters:
broadcastUUID- the broadcast UUID, i.e. the uuid of the connection the job is broadcast to.- Returns:
- a new
ClientJobinstance.
-
copy
Make a copy of this client job wrapper containing only the first nbTasks tasks it contains.- Parameters:
nbTasks- the number of tasks to include in the copy.- Returns:
- a new
ClientJobinstance.
-
merge
Merge this client job wrapper with another.- Parameters:
taskList- list of tasks to merge.- Returns:
truewhen this client job needs to be requeued.
-
getBroadcastUUID
Get the broadcast UUID.- Returns:
- an
Stringinstance.
-
jobDispatched
Called when all or part of a job is dispatched to a node.- Parameters:
bundle- the dispatched job.channel- the node to which the job is dispatched.
-
jobRequeued
public void jobRequeued()Notify that this job was requeued. -
resultsReceived
Called to notify that the results of a number of tasks have been received from the server.- Parameters:
bundle- the executing job.results- the list of tasks whose results have been received from the server.
-
resultsReceived
Called to notify that throwable eventually raised while receiving the results.- Parameters:
bundle- the finished job.throwable- the throwable that was raised while receiving the results.
-
taskCompleted
Called to notify that the execution of a task has completed.- Parameters:
bundle- the completed task.exception- theExceptionthrown during job execution ornull.
-
hasPending
protected boolean hasPending()Get indicator whether job has pending tasks.- Returns:
truewhen job has some pending tasks.
-
getJobStatus
Get the status of this job.- Returns:
- a
JobStatusenumerated value.
-
setJobStatus
Set the status of this job.- Parameters:
jobStatus- aJobStatusenumerated value.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Description copied from class:AbstractClientJobCancels this job.- Overrides:
cancelin classAbstractClientJob- Parameters:
mayInterruptIfRunning- true if the thread executing this task should be interrupted.- Returns:
- whether cancellation was successful.
-
broadcastDispatched
Called when all or part of broadcast job is dispatched to a driver.- Parameters:
broadcastJob- the dispatched job.
-
broadcastCompleted
Called to notify that the execution of broadcast job has completed.- Parameters:
broadcastJob- the completed job.
-
setOnRequeue
Set the requeue handler.- Parameters:
onRequeue-Runnableexecuted on requeue.
-
getNbChannels
public int getNbChannels()Get count of channels on which this job is executed.- Returns:
- the number used for job execution.
-
toString
-
getTaskGraph
public org.jppf.node.protocol.graph.TaskGraph getTaskGraph()- Returns:
- the graph of tasks in the job, if any.
-
hasAvvailableGraphNode
public boolean hasAvvailableGraphNode()- Returns:
trueif there is a graph and an available node in the graph,falseotherwise.
-
getAvailableGraphNodeCount
public int getAvailableGraphNodeCount()- Returns:
- the number of nodes int he graph that can be executed.
-