public class SnapshotPredicates extends Object
Snapshot snapshot = snapshotApi.create(volumeId);
RetryablePredicate<String> awaitAvailable = new RetryablePredicate<String>(
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 RetryablePredicate<Snapshot> |
awaitAvailable(SnapshotApi snapshotApi)
Wait until a Snapshot is Available.
|
static RetryablePredicate<Snapshot> |
awaitDeleted(SnapshotApi snapshotApi)
Wait until a Snapshot no longer exists.
|
static RetryablePredicate<Snapshot> |
awaitStatus(SnapshotApi snapshotApi,
Volume.Status status,
long maxWaitInSec,
long periodInSec) |
public static RetryablePredicate<Snapshot> awaitAvailable(SnapshotApi snapshotApi)
snapshotApi
- The SnapshotApi in the zone where your Snapshot resides.public static RetryablePredicate<Snapshot> awaitDeleted(SnapshotApi snapshotApi)
snapshotApi
- The SnapshotApi in the zone where your Snapshot resides.public static RetryablePredicate<Snapshot> awaitStatus(SnapshotApi snapshotApi, Volume.Status status, long maxWaitInSec, long periodInSec)
Copyright © 2009-2013 jclouds. All Rights Reserved.