use of org.javaswift.joss.instructions.DownloadInstructions in project alluxio by Alluxio.
the class SwiftInputStream method createStream.
@Override
protected InputStream createStream(long startPos, long endPos) throws IOException {
NotFoundException lastException = null;
while (mRetryPolicy.attempt()) {
try {
StoredObject storedObject = mAccount.getContainer(mContainerName).getObject(mObjectPath);
DownloadInstructions downloadInstructions = new DownloadInstructions();
downloadInstructions.setRange(new MidPartLongRange(startPos, endPos - 1));
return storedObject.downloadObjectAsInputStream(downloadInstructions);
} catch (NotFoundException e) {
LOG.warn("Attempt {} to get object {} from container {} failed with exception : {}", mRetryPolicy.getAttemptCount(), mObjectPath, mContainerName, e.toString());
// Object does not exist
lastException = e;
}
}
// Failed after retrying object does not exist
throw lastException;
}
Aggregations