Package org.jppf.server.protocol
Class ServerTask
java.lang.Object
org.jppf.server.protocol.ServerTask
- All Implemented Interfaces:
Serializable,org.jppf.node.protocol.PositionalElement<ServerTask>
public class ServerTask
extends Object
implements Serializable, org.jppf.node.protocol.PositionalElement<ServerTask>
Representation of an individual task on the server side.
- Author:
- Martin JANDA
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionServerTask(ServerTaskBundleClient bundle, org.jppf.io.DataLocation initialTask, int jobPosition, int maxResubmits) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled to notify that the task broadcast was completed.voidcancel()Mark this task as cancelled.Get the client bundle that owns this task.intGet the number of times a dispatch of this task has expired.org.jppf.io.DataLocationGet the initial serialized task.intGet the maximum number of times a task can be resubmitted.intorg.jppf.io.DataLocationGet the result of the task execution.org.jppf.node.protocol.TaskStategetState()Get the state of this task.intGet the number of times a task resubmitted itself.Get the eventual throwable raised during the processing of this task in the driver.intIncrement and get the number of times a dispatch of this task has expired.intIncrement and get the number of times a task resubmitted itself.booleanisDone()Determine whether this task has completed.booleanvoidresubmit()Mark this task as to be resubmitted followxing expiration of a node dispatch.voidresultReceived(Throwable exception) Called to notify that the task received exception during execution.voidresultReceived(org.jppf.io.DataLocation result) Called to notify that the task received result.voidsetBundle(ServerTaskBundleClient bundle) Get the client bundle that owns this task.voidsetResult(org.jppf.io.DataLocation result) Set the result of the task execution.voidsetReturnedFromNode(boolean returnedFromNode) Set whether this task has returned from the nodevoidsetState(org.jppf.node.protocol.TaskState state) Set the state of this task.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jppf.node.protocol.PositionalElement
setPosition
-
Constructor Details
-
ServerTask
public ServerTask(ServerTaskBundleClient bundle, org.jppf.io.DataLocation initialTask, int jobPosition, int maxResubmits) - Parameters:
bundle- client bundle that owns this task.initialTask- the initial serialized task.jobPosition- the maximum number of times a task can be resubmitted.maxResubmits- the position of this task within the job submitted by the client.
-
-
Method Details
-
getBundle
Get the client bundle that owns this task.- Returns:
ServerTaskBundleClientinstance.
-
setBundle
Get the client bundle that owns this task.- Parameters:
bundle- aServerTaskBundleClientinstance.
-
getInitialTask
public org.jppf.io.DataLocation getInitialTask()Get the initial serialized task.- Returns:
- a
DataLocationinstance.
-
getState
public org.jppf.node.protocol.TaskState getState()Get the state of this task.- Returns:
- a
TaskStateenumerated value.
-
setState
public void setState(org.jppf.node.protocol.TaskState state) Set the state of this task.- Parameters:
state- aTaskStateenumerated value.
-
getResult
public org.jppf.io.DataLocation getResult()Get the result of the task execution.- Returns:
- the result as a
DataLocation.
-
setResult
public void setResult(org.jppf.io.DataLocation result) Set the result of the task execution.- Parameters:
result- the result as aDataLocation.
-
getThrowable
Get the eventual throwable raised during the processing of this task in the driver.- Returns:
- a
Throwableinstance, or null if no exception was raised.
-
cancel
public void cancel()Mark this task as cancelled. -
resubmit
public void resubmit()Mark this task as to be resubmitted followxing expiration of a node dispatch. -
resultReceived
public void resultReceived(org.jppf.io.DataLocation result) Called to notify that the task received result.- Parameters:
result- the result.
-
broadcastResultReceived
public void broadcastResultReceived()Called to notify that the task broadcast was completed. -
resultReceived
Called to notify that the task received exception during execution.- Parameters:
exception- the exception.
-
toString
-
getPosition
public int getPosition()- Specified by:
getPositionin interfaceorg.jppf.node.protocol.PositionalElement<ServerTask>
-
incExpirationCount
public int incExpirationCount()Increment and get the number of times a dispatch of this task has expired.- Returns:
- the new number of expirations as an int.
-
getExpirationCount
public int getExpirationCount()Get the number of times a dispatch of this task has expired.- Returns:
- the new number of expirations as an int.
-
isDone
public boolean isDone()Determine whether this task has completed. This encompasses the cases where it received a result, was cancelled or terminated with an exception.- Returns:
trueif this task is done,falseotherwise.
-
getTaskResubmitCount
public int getTaskResubmitCount()Get the number of times a task resubmitted itself.- Returns:
- the number of resubmits as an int.
-
incResubmitCount
public int incResubmitCount()Increment and get the number of times a task resubmitted itself.- Returns:
- the new number of resubmits as an int.
-
getMaxResubmits
public int getMaxResubmits()Get the maximum number of times a task can be resubmitted.- Returns:
- the maximum number of reesubmits as an int.
-
isReturnedFromNode
public boolean isReturnedFromNode()- Returns:
- whether this task has returned from the node
-
setReturnedFromNode
public void setReturnedFromNode(boolean returnedFromNode) Set whether this task has returned from the node- Parameters:
returnedFromNode-trueif this task has returned from a node,falseotherwise.
-