public interface IgfsJob
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.
Modifier and Type | Method and Description |
---|---|
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.
|
Object execute(IgniteFileSystem igfs, IgfsFileRange range, IgfsInputStream in) throws IgniteException, IOException
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.IgniteException
- If execution failed.IOException
- If file system operation resulted in IO exception.void cancel()
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.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019