Package org.jppf.client.balancer
Class AbstractClientJob
java.lang.Object
org.jppf.client.balancer.AbstractClientJob
- Direct Known Subclasses:
ClientJob
Abstract class that support job state management.
- Author:
- Martin JANDA
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractClientJob(JPPFJob job) Initialized abstract client job with task bundle and list of tasks to execute. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsChannel(org.jppf.execute.ExecutorChannel<?> channel) Determine whether this job can be sent to the specified channel.voidaddChannel(org.jppf.execute.ExecutorChannel<?> channel) Add a channel to this job.voidRegisters instance to be called on job finish.booleancancel(boolean mayInterruptIfRunning) Cancels this job.voidClear the channels used to dispatch this job.protected voiddone()Called when task was cancelled or finished.org.jppf.node.protocol.JobClientSLAGet the service level agreement between the job and the client.getJob()Get the underlying task bundle.longGet the job received time.org.jppf.node.protocol.JobMetadataGet the job metadata.getName()Get the user-defined display name for this job.longGet the time at which this wrapper was added to the queue.org.jppf.node.protocol.JobSLAgetSLA()Get the service level agreement between the job and the server.getUuid()Get the universal unique id for this job.booleanbooleanWhether this job is being cancelled.booleanWhether this job is being cancelled or has already been cancelled.booleanisDone()booleanGet the job expired indicator.booleanGet the job pending indicator.voidNotifies that job has expired.voidpreparePolicy(org.jppf.node.policy.ExecutionPolicy policy) Set the parameters needed as bounded variables fro scripted execution policies.voidremoveChannel(org.jppf.execute.ExecutorChannel<?> channel) Add a channel to this job.voidremoveOnDone(Runnable runnable) Deregisters instance to be called on job finish.voidsetClientSLA(org.jppf.node.protocol.JobClientSLA clientSla) Get the service level agreement between the job and the client.voidsetJobReceivedTime(long jobReceivedTime) Set the job received time.voidsetMetadata(org.jppf.node.protocol.JobMetadata metadata) Set the job metadata.voidSet the user-defined display name for this job.voidsetPending(boolean pending) Set the job pending indicator.voidsetQueueEntryTime(long queueEntryTime) Set the time at which this wrapper was added to the queue.voidsetSLA(org.jppf.node.protocol.JobSLA sla) Get the service level agreement between the job and the server.voidSet the universal unique id for this job.protected final booleanupdateStatus(ClientJobStatus expect, ClientJobStatus newStatus) Updates status to new value if old value is equal to expect.
-
Field Details
-
parentJob
Instance of parent broadcast job. -
job
The underlying task bundle.
-
-
Constructor Details
-
AbstractClientJob
Initialized abstract client job with task bundle and list of tasks to execute.- Parameters:
job- underlying task bundle.
-
-
Method Details
-
getJob
Get the underlying task bundle.- Returns:
- a
ClientTaskBundleinstance.
-
getUuid
Get the universal unique id for this job.- Returns:
- the uuid as a string.
-
setUuid
Set the universal unique id for this job.- Parameters:
uuid- the universal unique id.
-
getName
Get the user-defined display name for this job. This is the name displayed in the administration console.- Returns:
- the name as a string.
-
setName
Set the user-defined display name for this job.- Parameters:
name- the display name as a string.
-
getSLA
public org.jppf.node.protocol.JobSLA getSLA()Get the service level agreement between the job and the server.- Returns:
- an instance of
JobSLA.
-
getClientSLA
public org.jppf.node.protocol.JobClientSLA getClientSLA()Get the service level agreement between the job and the client.- Returns:
- an instance of
JobSLA.
-
getMetadata
public org.jppf.node.protocol.JobMetadata getMetadata()Get the job metadata.- Returns:
- an instance of
JobMetadata.
-
setMetadata
public void setMetadata(org.jppf.node.protocol.JobMetadata metadata) Set the job metadata.- Parameters:
metadata- an instance ofJobMetadata.
-
setSLA
public void setSLA(org.jppf.node.protocol.JobSLA sla) Get the service level agreement between the job and the server.- Parameters:
sla- an instance ofJobSLA.
-
setClientSLA
public void setClientSLA(org.jppf.node.protocol.JobClientSLA clientSla) Get the service level agreement between the job and the client.- Parameters:
clientSla- an instance ofJobClientSLA.
-
isJobExpired
public boolean isJobExpired()Get the job expired indicator.- Returns:
trueif job has expired,falseotherwise.
-
jobExpired
public void jobExpired()Notifies that job has expired. -
isPending
public boolean isPending()Get the job pending indicator.- Returns:
trueif job is pending,falseotherwise.
-
setPending
public void setPending(boolean pending) Set the job pending indicator.- Parameters:
pending-trueto indicate that job is pending,falseotherwise
-
updateStatus
Updates status to new value if old value is equal to expect.- Parameters:
expect- the expected value.newStatus- the new value.- Returns:
trueif new status was set.
-
isDone
public boolean isDone()- Returns:
truewhen job is cancelled or finished normally.
-
isCancelled
public boolean isCancelled()- Returns:
truewhen job was cancelled.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Cancels this job.- Parameters:
mayInterruptIfRunning- true if the thread executing this task should be interrupted.- Returns:
- whether cancellation was successful.
-
done
protected void done()Called when task was cancelled or finished. -
addOnDone
Registers instance to be called on job finish.- Parameters:
runnable-Runnableto be called on job finish.
-
removeOnDone
Deregisters instance to be called on job finish.- Parameters:
runnable-Runnableto be called on job finish.
-
getJobReceivedTime
public long getJobReceivedTime()Get the job received time.- Returns:
- the time in milliseconds as a long value.
-
setJobReceivedTime
public void setJobReceivedTime(long jobReceivedTime) Set the job received time.- Parameters:
jobReceivedTime- the time in milliseconds as a long value.
-
getQueueEntryTime
public long getQueueEntryTime()Get the time at which this wrapper was added to the queue.- Returns:
- the time in milliseconds as a long value.
-
setQueueEntryTime
public void setQueueEntryTime(long queueEntryTime) Set the time at which this wrapper was added to the queue.- Parameters:
queueEntryTime- the time in milliseconds as a long value.
-
addChannel
public void addChannel(org.jppf.execute.ExecutorChannel<?> channel) Add a channel to this job.- Parameters:
channel- the channel to add.
-
removeChannel
public void removeChannel(org.jppf.execute.ExecutorChannel<?> channel) Add a channel to this job.- Parameters:
channel- the channel to add.
-
acceptsChannel
public boolean acceptsChannel(org.jppf.execute.ExecutorChannel<?> channel) Determine whether this job can be sent to the specified channel. Currently this method only accepts a single remote channel, and it has to always be the same for the same job. See#remoteChannel.- Parameters:
channel- the channel to check for acceptance.- Returns:
trueif the channel is accepted,falseotherwise.
-
preparePolicy
public void preparePolicy(org.jppf.node.policy.ExecutionPolicy policy) Set the parameters needed as bounded variables fro scripted execution policies.- Parameters:
policy- the root policy to explore.
-
clearChannels
public void clearChannels()Clear the channels used to dispatch this job. -
isCancelling
public boolean isCancelling()Whether this job is being cancelled.- Returns:
truea cancellation request is being processed,falseotherwise.
-
isCancellingOrCancelled
public boolean isCancellingOrCancelled()Whether this job is being cancelled or has already been cancelled.- Returns:
truea cancellation request is being or has been processed,falseotherwise.
-