public void downloadBackup(Exhibitor exhibitor, BackupMetaData backup, OutputStream destination, Map<String, String> configValues) throws Exception
{
byte[] buffer = new byte[MIN_S3_PART_SIZE];
long startMs = System.currentTimeMillis();
RetryPolicy retryPolicy = makeRetryPolicy(configValues);
int retryCount = 0;
boolean done = false;
while ( !done )
{
Throttle throttle = makeThrottle(configValues);
InputStream in = null;
try
{
S3Object object = s3Client.getObject(configValues.get(CONFIG_BUCKET.getKey()), toKey(backup, configValues));
in = object.getObjectContent();
for(;;)
{
int bytesRead = in.read(buffer);
if ( bytesRead < 0 )
{
break;
}
throttle.throttle(bytesRead);
destination.write(buffer, 0, bytesRead);
}
done = true;
}
catch ( Exception e )
{
if ( !retryPolicy.allowRetry(retryCount++, System.currentTimeMillis() - startMs, RetryLoop.getDefaultRetrySleeper()) )
{
done = true;
}
}
finally