public class SnapshotPredicates extends Object
Snapshot snapshot = snapshotApi.create(volumeId);
RetryablePredicate<String> awaitAvailable = RetryablePredicate.create(
SnapshotPredicates.available(snapshotApi), 600, 10, 10, TimeUnit.SECONDS);
if (!awaitAvailable.apply(snapshot.getId())) {
throw new TimeoutException("Timeout on snapshot: " + snapshot);
}
You can also use the static convenience methods as so.
Snapshot snapshot = snapshotApi.create(volumeId);
if (!SnapshotPredicates.awaitAvailable(snapshotApi).apply(snapshot.getId())) {
throw new TimeoutException("Timeout on snapshot: " + snapshot);
}
Constructor and Description |
---|
SnapshotPredicates() |
Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Predicate<Snapshot> |
awaitAvailable(SnapshotApi snapshotApi)
Wait until a Snapshot is Available.
|
static com.google.common.base.Predicate<Snapshot> |
awaitDeleted(SnapshotApi snapshotApi)
Wait until a Snapshot no longer exists.
|
static com.google.common.base.Predicate<Snapshot> |
awaitStatus(SnapshotApi snapshotApi,
Volume.Status status,
long maxWaitInSec,
long periodInSec) |
public static com.google.common.base.Predicate<Snapshot> awaitAvailable(SnapshotApi snapshotApi)
snapshotApi
- The SnapshotApi in the region where your Snapshot resides.public static com.google.common.base.Predicate<Snapshot> awaitDeleted(SnapshotApi snapshotApi)
snapshotApi
- The SnapshotApi in the region where your Snapshot resides.public static com.google.common.base.Predicate<Snapshot> awaitStatus(SnapshotApi snapshotApi, Volume.Status status, long maxWaitInSec, long periodInSec)
Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.