Class PlatformAbstractTask

    • Field Detail

      • 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. See ComputeJobResultPolicy for more information about result policies.
        Specified by:
        result in interface ComputeTask<Object,​Void>
        Parameters:
        res - Received remote grid executable result.
        rcvd - All previously received results. Note that if task class has ComputeTaskNoResultCache annotation, 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 via ComputeTaskFuture.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:
        reduce in interface ComputeTask<Object,​Void>
        Parameters:
        results - Received results of broadcasted remote executions. Note that if task class has ComputeTaskNoResultCache annotation, 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.