org.apache.ignite.igfs.mapreduce

## Interface IgfsJob

All Known Implementing Classes:
  IgfsInputStreamJobAdapter, IgfsJobAdapter

    public interface IgfsJob

Defines executable unit for `IgfsTask`. Before this job is executed, it is assigned one of the ranges provided by the `IgfsRecordResolver` passed to one of the `IgniteFs.execute(...)` methods.

`execute(org.apache.ignite.IgniteFileSystem, IgfsFileRange, org.apache.ignite.igfs.IgfsInputStream)` method is given `IgfsFileRange` this job is expected to operate on, and already opened `IgfsInputStream` for the file this range belongs to.

Note that provided input stream has position already adjusted to range start. However, it will not automatically stop on range end. This is done to provide capability in some cases to look beyond the range end or seek position before the reange start.

In majority of the cases, when you want to process only provided range, you should explicitly control amount of returned data and stop at range end. You can also use `IgfsInputStreamJobAdapter`, which operates on `IgfsRangeInputStream` bounded to range start and end, or manually wrap provided input stream with `IgfsRangeInputStream`.

You can inject any resources in concrete implementation, just as with regular `ComputeJob` implementations.

### Method Summary

Methods
`void` `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).
`Object` `execute(IgniteFileSystem igfs, IgfsFileRange range, IgfsInputStream in)` Executes this job.

### Method Detail

#### execute

    Object execute(IgniteFileSystem igfs,
                 IgfsFileRange range,
                 IgfsInputStream in)
                   throws IgniteException,
                          IOException

Executes this job.

Parameters:
  `igfs` - IGFS instance.
  `range` - File range aligned to record boundaries.
  `in` - Input stream for split file. This input stream is not aligned to range and points to file start by default.
Returns:
  Execution result.
Throws:
  `IgniteException` - If execution failed.
  `IOException` - If file system operation resulted in IO exception.

#### cancel

    void 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). Job is also cancelled when `IgniteFuture.cancel()` is called.

Note that job cancellation is only a hint, and just like with `Thread.interrupt()` method, it is really up to the actual job instance to gracefully finish execution and exit.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015