Search Results for

    Show / Hide Table of Contents

    Class ComputeJobAdapter<T>

    Convenience adapter for IComputeJob<TRes> implementations. It provides the following functionality:

    • Default implementation of Cancel() method and ability to check whether cancellation occurred with IsCancelled() method.
    • Ability to set and get job arguments via SetArguments(Object[]) and GetArgument<TArg>(Int32) methods.

    Inheritance
    System.Object
    ComputeJobAdapter<T>
    Implements
    IComputeJob<T>
    Namespace: Apache.Ignite.Core.Compute
    Assembly: Apache.Ignite.Core.dll
    Syntax
    public abstract class ComputeJobAdapter<T> : object, IComputeJob<T>
    Type Parameters
    Name Description
    T

    Constructors

    ComputeJobAdapter()

    No-arg constructor.

    Declaration
    protected ComputeJobAdapter()

    ComputeJobAdapter(Object[])

    Creates job with specified arguments.

    Declaration
    protected ComputeJobAdapter(params object[] args)
    Parameters
    Type Name Description
    System.Object[] args

    Optional job arguments.

    Methods

    Cancel()

    This method is called when system detects that completion of this job can no longer alter the overall outcome (for example, when parent task has already reduced the results).

    Note that job cancellation is only a hint, and it is really up to the actual job instance to gracefully finish execution and exit.

    Declaration
    public void Cancel()

    Execute()

    Executes this job.

    Declaration
    public abstract T Execute()
    Returns
    Type Description
    T

    Job execution result (possibly null). This result will be returned in IComputeJobResult<TRes> object passed into OnResult(IComputeJobResult<TJobRes>, IList<IComputeJobResult<TJobRes>>) on caller node.

    GetArgument<TArg>(Int32)

    Sets given arguments.

    Declaration
    public TArg GetArgument<TArg>(int idx)
    Parameters
    Type Name Description
    System.Int32 idx

    Index of the argument.

    Returns
    Type Description
    TArg
    Type Parameters
    Name Description
    TArg

    IsCancelled()

    This method tests whether or not this job was cancelled. This method is thread-safe and can be called without extra synchronization.

    This method can be periodically called in Execute() method implementation to check whether or not this job cancelled. Note that system calls Cancel() method only as a hint and this is a responsibility of the implementation of the job to properly cancel its execution.

    Declaration
    protected bool IsCancelled()
    Returns
    Type Description
    System.Boolean

    True if this job was cancelled, false otherwise.

    SetArguments(Object[])

    Sets given arguments.

    Declaration
    public void SetArguments(params object[] args)
    Parameters
    Type Name Description
    System.Object[] args

    Optional job arguments to set.

    Implements

    IComputeJob<TRes>
    In This Article
    Back to top © 2015 - 2019 The Apache Software Foundation