while (true)
{
log.info("Sleeping for " + snapshotSleep.get() + " ms");
Thread.sleep(snapshotSleep.get());
DescribeSnapshotsResult describeSnapshotsResult = ec2Client.describeSnapshots(describeSnapshotsRequest);
String state = describeSnapshotsResult.getSnapshots().get(0).getState();
log.info("Snapshot State = " + state);
if ("error".equals(state))
{
return Optional.absent();
}
if ("completed".equals(state))
{
snapshot = describeSnapshotsResult.getSnapshots().get(0);
break;
}
}
ec2Client.deleteVolume(new DeleteVolumeRequest().