|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jclouds.openstack.trove.v1.predicates.InstancePredicates
public class InstancePredicates
Tests to see if instance has reached status. This class is most useful when paired with a RetryablePredicate as in the code below. This class can be used to block execution until the Instance status has reached a desired state. This is useful when your Instance needs to be 100% ready before you can continue with execution.
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 Summary | |
|---|---|
InstancePredicates()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InstancePredicates()
| Method Detail |
|---|
public static com.google.common.base.Predicate<Instance> awaitAvailable(InstanceApi instanceApi)
instanceApi - The InstanceApi in the zone where your Instance resides.
public static com.google.common.base.Predicate<Instance> awaitDeleted(InstanceApi instanceApi)
instanceApi - The InstanceApi in the zone 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 zone where your Instance resides.status - Wait until instance in in this status.maxWaitInSec - Maximum time to wait.periodInSec - Interval between retries.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||