Class PlatformAbstractTask
- java.lang.Object
-
- org.apache.ignite.internal.processors.platform.compute.PlatformAbstractTask
-
- All Implemented Interfaces:
Serializable,ComputeTask<Object,Void>
- Direct Known Subclasses:
PlatformBalancingMultiClosureTask,PlatformBalancingSingleClosureTask,PlatformBroadcastingMultiClosureTask,PlatformBroadcastingSingleClosureTask,PlatformFullTask
public abstract class PlatformAbstractTask extends Object implements ComputeTask<Object,Void>
Base class for all interop tasks.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlatformContextctxPlatform context.protected booleandoneDone flag.protected ReadWriteLocklockLock for safe access to native pointers.protected longtaskPtrPointer to the task in the native platform.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPlatformAbstractTask(PlatformContext ctx, long taskPtr)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonDone(Exception e)Callback invoked when task future is completed and all resources could be safely cleaned up.@Nullable Voidreduce(List<ComputeJobResult> results)Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()method.ComputeJobResultPolicyresult(ComputeJobResult res, List<ComputeJobResult> rcvd)Asynchronous callback invoked every time a result from remote execution is received.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.compute.ComputeTask
map
-
-
-
-
Field Detail
-
ctx
protected final PlatformContext ctx
Platform context.
-
taskPtr
protected final long taskPtr
Pointer to the task in the native platform.
-
lock
protected final ReadWriteLock lock
Lock for safe access to native pointers.
-
done
protected boolean done
Done flag.
-
-
Constructor Detail
-
PlatformAbstractTask
protected PlatformAbstractTask(PlatformContext ctx, long taskPtr)
Constructor.- Parameters:
ctx- Platform context.taskPtr- Task pointer.
-
-
Method Detail
-
result
public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
Asynchronous callback invoked every time a result from remote execution is received. It is ultimately upto this method to return a policy based on which the system will either wait for more results, reduce results received so far, or failover this job to another node. SeeComputeJobResultPolicyfor more information about result policies.- Specified by:
resultin interfaceComputeTask<Object,Void>- Parameters:
res- Received remote grid executable result.rcvd- All previously received results. Note that if task class hasComputeTaskNoResultCacheannotation, then this list will be empty.- Returns:
- Result policy that dictates how to process further upcoming job results.
-
reduce
@Nullable public @Nullable Void reduce(List<ComputeJobResult> results)
Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()method.Note, that if some jobs did not succeed and could not be failed over then the list of results passed into this method will include the failed results. Otherwise, failed results will not be in the list.
- Specified by:
reducein interfaceComputeTask<Object,Void>- Parameters:
results- Received results of broadcasted remote executions. Note that if task class hasComputeTaskNoResultCacheannotation, then this list will be empty.- Returns:
- Grid job result constructed from results of remote executions.
-
onDone
public void onDone(Exception e)
Callback invoked when task future is completed and all resources could be safely cleaned up.- Parameters:
e- If failed.
-
-