org.jclouds.rackspace.cloudloadbalancers.v1.predicates
Class LoadBalancerPredicates
java.lang.Object
org.jclouds.rackspace.cloudloadbalancers.v1.predicates.LoadBalancerPredicates
public class LoadBalancerPredicates
- extends Object
Tests to see if loadBalancer 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 LoadBalancer status has reached a desired state.
This is useful when your LoadBalancer needs to be 100% ready before you can continue with execution.
LoadBalancer loadBalancer = loadBalancerApi.create(loadBalancerRequest);
RetryablePredicate<String> awaitAvailable = RetryablePredicate.create(
LoadBalancerPredicates.available(loadBalancerApi), 600, 10, 10, TimeUnit.SECONDS);
if (!awaitAvailable.apply(loadBalancer)) {
throw new TimeoutException("Timeout on loadBalancer: " + loadBalancer);
}
You can also use the static convenience methods as so.
LoadBalancer loadBalancer = loadBalancerApi.create(loadBalancerRequest);
if (!LoadBalancerPredicates.awaitAvailable(loadBalancerApi).apply(loadBalancer)) {
throw new TimeoutException("Timeout on loadBalancer: " + loadBalancer);
}
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LoadBalancerPredicates
public LoadBalancerPredicates()
awaitAvailable
public static com.google.common.base.Predicate<LoadBalancer> awaitAvailable(LoadBalancerApi loadBalancerApi)
- Wait until a LoadBalancer is Available.
- Parameters:
loadBalancerApi - The LoadBalancerApi in the zone where your LoadBalancer resides.
- Returns:
- RetryablePredicate That will check the status every 3 seconds for a maxiumum of 5 minutes.
awaitDeleted
public static com.google.common.base.Predicate<LoadBalancer> awaitDeleted(LoadBalancerApi loadBalancerApi)
- Wait until a LoadBalancer no longer exists.
- Parameters:
loadBalancerApi - The LoadBalancerApi in the zone where your LoadBalancer resides.
- Returns:
- RetryablePredicate That will check the whether the LoadBalancer exists
every 3 seconds for a maxiumum of 5 minutes.
awaitStatus
public static com.google.common.base.Predicate<LoadBalancer> awaitStatus(LoadBalancerApi loadBalancerApi,
LoadBalancer.Status status,
long maxWaitInSec,
long periodInSec)
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.