Package org.jppf.client.balancer
Class ClientTaskBundle
java.lang.Object
org.jppf.utils.collections.MetadataImpl
org.jppf.node.protocol.JPPFTaskBundle
org.jppf.client.balancer.ClientTaskBundle
- All Implemented Interfaces:
Serializable,Comparable<org.jppf.node.protocol.JPPFTaskBundle>,org.jppf.node.protocol.JPPFDistributedJob,org.jppf.node.protocol.TaskBundle,org.jppf.utils.collections.Metadata
public class ClientTaskBundle
extends org.jppf.node.protocol.JPPFTaskBundle
Instances of this class group tasks from the same client together, so they are sent to the same node,
avoiding unnecessary transport overhead.
The goal is to provide a performance enhancement through an adaptive bundling of tasks originating from the same client. The bundle size is computed dynamically, depending on the number of nodes connected to the server, and other factors.
The goal is to provide a performance enhancement through an adaptive bundling of tasks originating from the same client. The bundle size is computed dynamically, depending on the number of nodes connected to the server, and other factors.
- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from class org.jppf.node.protocol.JPPFTaskBundle
currentTaskCount, driverQueueTaskCount, initialTaskCount, taskCountFields inherited from class org.jppf.utils.collections.MetadataImpl
parameters -
Constructor Summary
ConstructorsConstructorDescriptionClientTaskBundle(ClientJob job, Collection<org.jppf.node.protocol.Task<?>> tasks) Initialize this task bundle and set its build number. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Called when this task bundle is cancelled.copy()Make a copy of this bundle.Get the broadcast UUID.Get the client job this job is for.org.jppf.node.protocol.DataProviderGet shared data provider for this task.org.jppf.node.protocol.graph.TaskGraphInfogetJob()Get the job this job is for.List<org.jppf.node.protocol.Task<?>>Get the tasks to be executed by the node.booleanGet the cancelled indicator.booleanGet the requeued indicator.voidjobDispatched(ChannelWrapper channel) Called when all or part of a job is dispatched to a node.voidresubmit()Called when this task bundle should be resubmitted.voidresultsReceived(Throwable throwable) Called to notify that throwable eventually raised while receiving the results.voidresultsReceived(List<org.jppf.node.protocol.Task<?>> results) Called to notify that the results of a number of tasks have been received from the server.voidsetBroadcastUUID(String broadcastUUID) Set the broadcast UUID.voidsetDataProviderL(org.jppf.node.protocol.DataProvider dataProvider) Set shared data provider for this task.voidtaskCompleted(Exception exception) Called to notify that the execution of a task has completed.toString()Methods inherited from class org.jppf.node.protocol.JPPFTaskBundle
compareTo, getCurrentTaskCount, getDriverQueueTaskCount, getExecutionStartTime, getInitialTaskCount, getMetadata, getName, getNodeExecutionTime, getSLA, getTaskCount, getUuid, getUuidPath, isHandshake, isPending, isRequeue, setCurrentTaskCount, setDriverQueueTaskCount, setExecutionStartTime, setHandshake, setInitialTaskCount, setMetadata, setName, setNodeExecutionTime, setRequeue, setSLA, setTaskCount, setUuid, setUuidPathMethods inherited from class org.jppf.utils.collections.MetadataImpl
clear, getAll, getParameter, getParameter, hasParameter, removeParameter, setParameterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jppf.utils.collections.Metadata
clear, getAll, getParameter, getParameter, hasParameter, removeParameter, setParameterMethods inherited from interface org.jppf.node.protocol.TaskBundle
isNotification, setBundleId
-
Constructor Details
-
ClientTaskBundle
Initialize this task bundle and set its build number.- Parameters:
job- the job to execute.tasks- the list of tasks to execute. This list is copy before being stored in this object, such that no link subsists between the input list and the one retained by thisClientTaskBundle.
-
-
Method Details
-
getJob
Get the job this job is for.- Returns:
- a
JPPFJobinstance.
-
getClientJob
Get the client job this job is for.- Returns:
- a
ClientJobinstance.
-
getDataProviderL
public org.jppf.node.protocol.DataProvider getDataProviderL()Get shared data provider for this task.- Returns:
- a
DataProviderinstance.
-
setDataProviderL
public void setDataProviderL(org.jppf.node.protocol.DataProvider dataProvider) Set shared data provider for this task.- Parameters:
dataProvider- aDataProviderinstance.
-
getTasksL
Get the tasks to be executed by the node.- Returns:
- the tasks as a
Listof arrays of bytes.
-
copy
Make a copy of this bundle.- Specified by:
copyin interfaceorg.jppf.node.protocol.TaskBundle- Overrides:
copyin classorg.jppf.node.protocol.JPPFTaskBundle- Returns:
- a new
ClientTaskBundleinstance.
-
getBroadcastUUID
Get the broadcast UUID.- Returns:
- the broadcast UUID as a
String.
-
setBroadcastUUID
Set the broadcast UUID.- Parameters:
broadcastUUID- the broadcast UUID as aString.
-
jobDispatched
Called when all or part of a job is dispatched to a node.- Parameters:
channel- the node to which the job is dispatched.
-
resultsReceived
Called to notify that the results of a number of tasks have been received from the server.- Parameters:
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:
throwable- the throwable that was raised while receiving the results.
-
taskCompleted
Called to notify that the execution of a task has completed.- Parameters:
exception- theExceptionthrown during job execution ornull.
-
resubmit
public void resubmit()Called when this task bundle should be resubmitted. -
isRequeued
public boolean isRequeued()Get the requeued indicator.- Returns:
trueif job is requeued,falseotherwise.
-
cancel
public void cancel()Called when this task bundle is cancelled. -
isCancelled
public boolean isCancelled()Get the cancelled indicator.- Returns:
- <
trueif job is cancelled,falseotherwise.
-
toString
- Overrides:
toStringin classorg.jppf.node.protocol.JPPFTaskBundle
-
getBundleId
- Returns:
- the id for this bundle.
-
getGraphInfo
public org.jppf.node.protocol.graph.TaskGraphInfo getGraphInfo()- Returns:
- information about the task graph, if any, for a job.
-