Class 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);
     }
     
     
    • Constructor Detail

      • LoadBalancerPredicates

        public LoadBalancerPredicates()
    • Method Detail

      • awaitAvailable

        public static com.google.common.base.Predicate<LoadBalancer> awaitAvailable​(LoadBalancerApi loadBalancerApi)
        Wait until a LoadBalancer is Available.
        Parameters:
        loadBalancerApi - The LoadBalancerApi in the region 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 region where your LoadBalancer resides.
        Returns:
        RetryablePredicate That will check the whether the LoadBalancer exists every 3 seconds for a maxiumum of 5 minutes.