use of org.apache.ignite.igfs.IgfsBlockLocation in project ignite by apache.
the class IgniteHadoopFileSystem method getFileBlockLocations.
/**
* {@inheritDoc}
*/
@Override
public BlockLocation[] getFileBlockLocations(Path path, long start, long len) throws IOException {
A.notNull(path, "path");
IgfsPath igfsPath = convert(path);
enterBusy();
try {
long now = System.currentTimeMillis();
List<IgfsBlockLocation> affinity = new ArrayList<>(rmtClient.affinity(igfsPath, start, len));
BlockLocation[] arr = new BlockLocation[affinity.size()];
for (int i = 0; i < arr.length; i++) arr[i] = convert(affinity.get(i));
if (LOG.isDebugEnabled())
LOG.debug("Fetched file locations [path=" + path + ", fetchTime=" + (System.currentTimeMillis() - now) + ", locations=" + Arrays.asList(arr) + ']');
return arr;
} finally {
leaveBusy();
}
}
use of org.apache.ignite.igfs.IgfsBlockLocation in project ignite by apache.
the class IgniteHadoopFileSystem method getFileBlockLocations.
/**
* {@inheritDoc}
*/
@Override
public BlockLocation[] getFileBlockLocations(FileStatus status, long start, long len) throws IOException {
A.notNull(status, "status");
enterBusy();
try {
IgfsPath path = convert(status.getPath());
long now = System.currentTimeMillis();
List<IgfsBlockLocation> affinity = new ArrayList<>(rmtClient.affinity(path, start, len));
BlockLocation[] arr = new BlockLocation[affinity.size()];
for (int i = 0; i < arr.length; i++) arr[i] = convert(affinity.get(i));
if (LOG.isDebugEnabled())
LOG.debug("Fetched file locations [path=" + path + ", fetchTime=" + (System.currentTimeMillis() - now) + ", locations=" + Arrays.asList(arr) + ']');
return arr;
} catch (FileNotFoundException ignored) {
return EMPTY_BLOCK_LOCATIONS;
} finally {
leaveBusy();
}
}
Aggregations