public class InstancePredicates extends Object
Instance instance = instanceApi.create(100);
RetryablePredicate<String> awaitAvailable = RetryablePredicate.create(
InstancePredicates.available(instanceApi), 600, 10, 10, TimeUnit.SECONDS);
if (!awaitAvailable.apply(instance.getId())) {
throw new TimeoutException("Timeout on instance: " + instance);
}
You can also use the static convenience methods as follows.
Instance instance = instanceApi.create(100);
if (!InstancePredicates.awaitAvailable(instanceApi).apply(instance.getId())) {
throw new TimeoutException("Timeout on instance: " + instance);
}
Constructor and Description |
---|
InstancePredicates() |
Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Predicate<Instance> |
awaitAvailable(InstanceApi instanceApi)
Wait until an Instance is Available.
|
static com.google.common.base.Predicate<Instance> |
awaitDeleted(InstanceApi instanceApi)
Wait until an Instance no longer exists.
|
static com.google.common.base.Predicate<Instance> |
awaitStatus(InstanceApi instanceApi,
Instance.Status status,
long maxWaitInSec,
long periodInSec)
Wait until instance is in the status specified.
|
public static com.google.common.base.Predicate<Instance> awaitAvailable(InstanceApi instanceApi)
instanceApi
- The InstanceApi in the region where your Instance resides.public static com.google.common.base.Predicate<Instance> awaitDeleted(InstanceApi instanceApi)
instanceApi
- The InstanceApi in the region where your Instance resides.public static com.google.common.base.Predicate<Instance> awaitStatus(InstanceApi instanceApi, Instance.Status status, long maxWaitInSec, long periodInSec)
instanceApi
- The InstanceApi in the region where your Instance resides.status
- Wait until instance in in this status.maxWaitInSec
- Maximum time to wait.periodInSec
- Interval between retries.Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.