public interface GridGgfsJob
GridGgfsTask. Before this job is executed, it is assigned one of the
ranges provided by the GridGgfsRecordResolver passed to one of the GridGgfs.execute(...) methods.
execute(GridGgfs, GridGgfsFileRange, GridGgfsInputStream) method is given GridGgfsFileRange this
job is expected to operate on, and already opened GridGgfsInputStream 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 GridGgfsInputStreamJobAdapter, which operates
on GridGgfsRangeInputStream bounded to range start and end, or manually wrap provided input stream with
GridGgfsRangeInputStream.
You can inject any resources in concrete implementation, just as with regular GridComputeJob 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(GridGgfs ggfs,
GridGgfsFileRange range,
GridGgfsInputStream in)
Executes this job.
|
Object execute(GridGgfs ggfs, GridGgfsFileRange range, GridGgfsInputStream in) throws GridException, IOException
ggfs - GGFS 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.GridException - If execution failed.IOException - If file system operation resulted in IO exception.void cancel()
GridFuture.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.
Copyright © 2014. All rights reserved.